Code question, inventory.contains

I hope this is the right category to ask a coding question. I am fairly new to java and trying to get an existing plugin to work with sponge.
Issue is how to check if the player inventory contains a specific item.

Code fragment is…

boolean hasItem;
Inventory inventory = player.getInventory();
hasItem = inventory.contains(ItemTypes.WRITABLE_BOOK);

hasItem is always false.
What is the right way to do this?

Well, does the inventory in fact contain a book and quill? Remember this is different from a written book.

Edit: The code is right, but IIRC Inventory#contains is broken.

Yes, the inventory has a book, book & quill, and another enchanted book, so I think I am covered there.
I then found this post,

which basically says the same thing about the code being broken. I will try the latest release and see if that helps. The above test was with API 5.1.0, which I probably should have mentioned to begin with.