### Question:
DynamoDBCompressedObjectPersister implements ObjectPersister<T> { @Override public DataObjectFeed<T> retrieve(List<Query> queries) { throw new NotImplementedException(); } DynamoDBCompressedObjectPersister(String tableName,
            String persistenceKeyFieldName, AWSDynamoDBFactory AWSDynamoDBFactory, Class<T> clazz); void setZlibUtil(ZlibUtil zlibUtil); @Override DataObjectFeed<T> retrieve(List<Query> queries); @Override T retrieve(String identifier); @Override T persist(T object); @Override T update(T object); @Override void delete(String identifier); String getPersistenceKeyFieldName(); String getTableName(); void setIdGenerator(IdGenerator idGenerator); static final String DATA_BLOB; }### Answer:
@Test public void testMissingRetrieve() { doReturn(new GetItemResult()).when(mockAmazonDynamoDB).getItem(any(GetItemRequest.class)); Assert.assertNull(objectPersister.retrieve(TEST_ITEM_ID)); }
@Test(expectedExceptions = RuntimeException.class) public void testNullBlobRetrieve() { GetItemResult getItemResult = new GetItemResult(); Map<String, AttributeValue> itemMap = new HashMap<>(); getItemResult.setItem(itemMap); doReturn(getItemResult).when(mockAmazonDynamoDB).getItem(any(GetItemRequest.class)); objectPersister.retrieve(TEST_ITEM_ID); }
@Test(expectedExceptions = RuntimeException.class) public void testNullBlobSizeRetrieve() { GetItemResult getItemResult = new GetItemResult(); Map<String, AttributeValue> itemMap = new HashMap<>(); itemMap.put(DynamoDBCompressedObjectPersister.DATA_BLOB, new AttributeValue().withB(ByteBuffer.wrap(new byte[1]))); getItemResult.setItem(itemMap); doReturn(getItemResult).when(mockAmazonDynamoDB).getItem(any(GetItemRequest.class)); objectPersister.retrieve(TEST_ITEM_ID); }