@Test public void putItemWithExpected() { createGenericTable(tableName); AttributeValue value = new AttributeValue("test1"); Map<String, ExpectedAttributeValue> expectedMap = new HashMap<String, ExpectedAttributeValue>(); expectedMap.put("id", new ExpectedAttributeValue(false)); Map<String, AttributeValue> item = createGenericItem(value, null); AmazonDynamoDB client = getClient(); client.putItem(new PutItemRequest(tableName, item).withExpected(expectedMap)); try { client.putItem(new PutItemRequest(tableName, item).withExpected(expectedMap)); Assert.assertTrue(false); // Should have thrown a ConditionalCheckFailedException } catch (ConditionalCheckFailedException ccfe) { } }