### Question:
MongoDbOauthConsumerStoreRepository implements OAuthConsumerStoreRepository { @Override public OAuthConsumerStore save(OAuthConsumerStore item) { template.save(item, OAUTH_CONSUMER_COLLECTION); return item; }  @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 save_Valid(){ OAuthConsumerStore item = new OAuthConsumerStoreImpl(); template.save(item, CollectionNames.OAUTH_CONSUMER_COLLECTION); expectLastCall(); replay(template); OAuthConsumerStore returned = oauthConsumerStoreRepository.save(item); verify(template); }
@Test public void save_Null_Id(){ OAuthConsumerStore item = new OAuthConsumerStoreImpl(); item.setId("1232"); template.save(item, CollectionNames.OAUTH_CONSUMER_COLLECTION); expectLastCall(); replay(template); OAuthConsumerStore returned = oauthConsumerStoreRepository.save(item); assertThat(item, is(sameInstance(returned))); }