// Test: put item with HashKey @Test public void putItemWithHashKey() { createTable(hashTableName, createStringAttributeDefinition("code")); TestClassWithHashKey value = new TestClassWithHashKey(); value.setCode("hash1"); value.setStringData("string1"); value.setIntData(1); value.setStringSetData(set("stringSetVal1", "stringSetVal2")); value.setNumberSetData(set(1, 2)); mapper.save(value); }
@Test public void putItemWithHashKeyOverwriteItem() { try { createTable(hashTableName, createStringAttributeDefinition("code")); } catch (ResourceInUseException riue) { // The table is already created, do nothing } TestClassWithHashKey value2a = new TestClassWithHashKey(); value2a.setCode("hash2"); value2a.setStringData("string2a"); value2a.setIntData(21); value2a.setStringSetData(set("stringSetVal2a1", "stringSetVal2a2")); value2a.setNumberSetData(set(3, 4)); mapper.save(value2a); TestClassWithHashKey value2b = new TestClassWithHashKey(); value2b.setCode("hash2"); value2b.setStringData("string2b"); value2b.setIntData(22); value2b.setStringSetData(set("stringSetVal2b1", "stringSetVal2b2")); value2b.setNumberSetData(set(5, 6)); mapper.save(value2b); }