### Question:
MongoDbApplicationDataRepository implements ApplicationDataRepository { @Override public ApplicationData save(ApplicationData item) { template.save(item, APP_DATA_COLLECTION); return item; }  @Override List<ApplicationData> getApplicationData(List<String> userIds, String appId); @Override ApplicationData getApplicationData(String personId, String appId); @Override Class<? extends ApplicationData> getType(); @Override ApplicationData get(String id); @Override ApplicationData save(ApplicationData item); @Override void delete(ApplicationData item); @Override List<ApplicationData> getAll(); @Override List<ApplicationData> getLimitedList(int offset, int limit); @Override int getCountAll(); void setTemplate(MongoOperations template); static final Class<ApplicationDataImpl> CLASS; }### Answer:
@Test public void save_Valid(){ ApplicationData item = new ApplicationDataImpl(); template.save(item, CollectionNames.APP_DATA_COLLECTION); expectLastCall(); replay(template); ApplicationData saved = applicationDataRepository.save(item); verify(template); }
@Test public void save_Id_Set(){ ApplicationData item = new ApplicationDataImpl(); item.setId("123"); template.save(item, CollectionNames.APP_DATA_COLLECTION); expectLastCall(); replay(template); ApplicationData saved = applicationDataRepository.save(item); assertThat(saved, is(sameInstance(item))); }