@Test(expected = PlanningException.class) public void addAlternative_addNewAlternativeWithLeadingWhitespaceThrowsException() throws PlanningException { Alternative altToAdd = new Alternative(" name", "trailing whitespace"); alternativesDefinition.addAlternative(altToAdd); }
public void addAlternative(Alternative alternative) throws PlanningException { if (!isAlternativeNameUnique(alternative.getName())) { throw new PlanningException("A unique name must be provided for the alternative."); } if (!isAlternativeNameValid(alternative.getName())) { String msg = String.format("The alternative name must not start or end with a whitespace. [%s]", alternative.getName()); throw new PlanningException(msg); } alternative.setAlternativesDefinition(this); alternatives.add(alternative); }
AlternativesDefinition implements Serializable, ITouchable { public void addAlternative(Alternative alternative) throws PlanningException { if (!isAlternativeNameUnique(alternative.getName())) { throw new PlanningException("A unique name must be provided for the alternative."); } if (!isAlternativeNameValid(alternative.getName())) { String msg = String.format("The alternative name must not start or end with a whitespace. [%s]", alternative.getName()); throw new PlanningException(msg); } alternative.setAlternativesDefinition(this); alternatives.add(alternative); } }
AlternativesDefinition implements Serializable, ITouchable { public void addAlternative(Alternative alternative) throws PlanningException { if (!isAlternativeNameUnique(alternative.getName())) { throw new PlanningException("A unique name must be provided for the alternative."); } if (!isAlternativeNameValid(alternative.getName())) { String msg = String.format("The alternative name must not start or end with a whitespace. [%s]", alternative.getName()); throw new PlanningException(msg); } alternative.setAlternativesDefinition(this); alternatives.add(alternative); }  }
AlternativesDefinition implements Serializable, ITouchable { public void addAlternative(Alternative alternative) throws PlanningException { if (!isAlternativeNameUnique(alternative.getName())) { throw new PlanningException("A unique name must be provided for the alternative."); } if (!isAlternativeNameValid(alternative.getName())) { String msg = String.format("The alternative name must not start or end with a whitespace. [%s]", alternative.getName()); throw new PlanningException(msg); } alternative.setAlternativesDefinition(this); alternatives.add(alternative); }  Alternative alternativeByName(String name); List<Alternative> getAlternatives(); int getId(); void setId(int id); String getDescription(); void setDescription(String description); List<Alternative> getConsideredAlternatives(); void setConsideredAlternatives(List<Alternative> consideredAlternatives); ChangeLog getChangeLog(); void setChangeLog(ChangeLog value); boolean isChanged(); void touch(); void handleChanges(IChangesHandler h); void removeAlternative(Alternative alternative); String createUniqueName(String name); void addAlternative(Alternative alternative); @SuppressWarnings("deprecation") void renameAlternative(Alternative alternative, String newName); }
AlternativesDefinition implements Serializable, ITouchable { public void addAlternative(Alternative alternative) throws PlanningException { if (!isAlternativeNameUnique(alternative.getName())) { throw new PlanningException("A unique name must be provided for the alternative."); } if (!isAlternativeNameValid(alternative.getName())) { String msg = String.format("The alternative name must not start or end with a whitespace. [%s]", alternative.getName()); throw new PlanningException(msg); } alternative.setAlternativesDefinition(this); alternatives.add(alternative); }  Alternative alternativeByName(String name); List<Alternative> getAlternatives(); int getId(); void setId(int id); String getDescription(); void setDescription(String description); List<Alternative> getConsideredAlternatives(); void setConsideredAlternatives(List<Alternative> consideredAlternatives); ChangeLog getChangeLog(); void setChangeLog(ChangeLog value); boolean isChanged(); void touch(); void handleChanges(IChangesHandler h); void removeAlternative(Alternative alternative); String createUniqueName(String name); void addAlternative(Alternative alternative); @SuppressWarnings("deprecation") void renameAlternative(Alternative alternative, String newName);  }