### Question:
MongoDbOauthConsumerStoreRepository implements OAuthConsumerStoreRepository { @Override public OAuthConsumerStore findByUriAndServiceName(String gadgetUri, String serviceName) { return template.findOne(query(where("gadgetUri").is(gadgetUri).andOperator(where("serviceName").is(serviceName))), CLASS, OAUTH_CONSUMER_COLLECTION); }  @Override OAuthConsumerStore findByUriAndServiceName(String gadgetUri, String serviceName); @Override Class<? extends OAuthConsumerStore> getType(); @Override OAuthConsumerStore get(String id); @Override OAuthConsumerStore save(OAuthConsumerStore item); @Override void delete(OAuthConsumerStore item); @Override List<OAuthConsumerStore> getAll(); @Override List<OAuthConsumerStore> getLimitedList(int offset, int limit); @Override int getCountAll(); void setTemplate(MongoOperations template); static final Class<OAuthConsumerStoreImpl> CLASS; }### Answer:
@Test public void findUriAndServiceNameValid() { String gadgetUri = "gadgetUri"; String serviceName = "serviceName"; OAuthConsumerStoreImpl found = new OAuthConsumerStoreImpl(); expect(template.findOne(query(where("gadgetUri").is(gadgetUri).andOperator(where("serviceName").is(serviceName))), MongoDbOauthConsumerStoreRepository.CLASS, CollectionNames.OAUTH_CONSUMER_COLLECTION)).andReturn(found); replay(template); OAuthConsumerStore returned = oauthConsumerStoreRepository.findByUriAndServiceName(gadgetUri, serviceName); assertThat((OAuthConsumerStoreImpl) returned, is(sameInstance(found))); }