@Test public void setProductModulesForAProductThatDoesNotExist(){ final RepositoryHandler repositoryHandler = GrapesTestUtils.getRepoHandlerMock(); final ProductHandler productHandler = new ProductHandler(repositoryHandler); Exception exception = null; try { final List<String> moduleNames = Lists.newArrayList("module1", "module2", "module3"); productHandler.setProductModules("doesNotExist", moduleNames); } catch(Exception e){ exception = e; } assertNotNull(exception); }
public void setProductModules(final String name, final List<String> moduleNames) { final DbProduct dbProduct = getProduct(name); dbProduct.setModules(moduleNames); repositoryHandler.store(dbProduct); }
ProductHandler { public void setProductModules(final String name, final List<String> moduleNames) { final DbProduct dbProduct = getProduct(name); dbProduct.setModules(moduleNames); repositoryHandler.store(dbProduct); } }
ProductHandler { public void setProductModules(final String name, final List<String> moduleNames) { final DbProduct dbProduct = getProduct(name); dbProduct.setModules(moduleNames); repositoryHandler.store(dbProduct); } ProductHandler(final RepositoryHandler repositoryHandler); }
ProductHandler { public void setProductModules(final String name, final List<String> moduleNames) { final DbProduct dbProduct = getProduct(name); dbProduct.setModules(moduleNames); repositoryHandler.store(dbProduct); } ProductHandler(final RepositoryHandler repositoryHandler); void create(final DbProduct dbProduct); void update(final DbProduct dbProduct); List<String> getProductNames(); DbProduct getProduct(final String name); void deleteProduct(final String name); void setProductModules(final String name, final List<String> moduleNames); }
ProductHandler { public void setProductModules(final String name, final List<String> moduleNames) { final DbProduct dbProduct = getProduct(name); dbProduct.setModules(moduleNames); repositoryHandler.store(dbProduct); } ProductHandler(final RepositoryHandler repositoryHandler); void create(final DbProduct dbProduct); void update(final DbProduct dbProduct); List<String> getProductNames(); DbProduct getProduct(final String name); void deleteProduct(final String name); void setProductModules(final String name, final List<String> moduleNames);  }