updateItem only verified if the expectedAttribute was null or empty when the item wasn't in the database. But the java client add version: valueExists=False when the version field is used.

Now if expectedAttribute s not empty, it validates that it contains only valueExists=false for all fields..

Refactor to use validatedExpected() everywhere instead of doing the same code again and again.