DefaultStoreService implements StoreService { @Override public Store create(final String name) { final Store store = new Store().setName(name); return repository.save(store); } DefaultStoreService(final StoreRepository repository); @Override Store create(final String name); @Override Collection<Store> create(final String... names);  }
@Test public void testCreateOne() { final Store store = service.create("My Store"); assertThat(store, is(notNullValue())); assertThat(store.getName(), is("My Store")); }
@Test public void testCreateMultiple() { final Collection<Store> stores = service.create("Store #1", "Store #2"); assertThat(stores, is(notNullValue())); assertThat(stores, hasSize(2)); for (Store store : stores) { assertThat(store.getId(), is(notNullValue())); assertThat(store.getName(), isIn(Arrays.asList("Store #1", "Store #2"))); } }