### Question:
MongoDbApplicationDataRepository implements ApplicationDataRepository { @Override public List<ApplicationData> getApplicationData(List<String> userIds, String appId) { return CollectionUtils.<ApplicationData>toBaseTypedList(template.find(query(where("appUrl").is(appId).andOperator(where("userId").in(userIds))), CLASS, APP_DATA_COLLECTION)); }  @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 getApplicationData_Valid() { List<String> userIds = Arrays.asList("123"); String appId = "blah"; List<ApplicationDataImpl> found = new ArrayList<ApplicationDataImpl>(); expect(template.find(query(where("appUrl").is(appId).andOperator(where("userId").in(userIds))), applicationDataRepository.CLASS, CollectionNames.APP_DATA_COLLECTION)).andReturn(found); replay(template); List<ApplicationData> appData = applicationDataRepository.getApplicationData(userIds, appId); }
@Test public void getApplicationData_Single_Valid_(){ String personId = "personid"; String appId = "appId"; ApplicationDataImpl found = new ApplicationDataImpl(); expect(template.findOne(query(where("appUrl").is(appId).andOperator(where("userId").is(personId))),applicationDataRepository.CLASS, CollectionNames.APP_DATA_COLLECTION )).andReturn(found); replay(template); assertThat((ApplicationDataImpl)applicationDataRepository.getApplicationData(personId, appId), is(sameInstance(found))); }