@Test public void testAddQuestion() { Analysis a = new Analysis("analysis", Maps.newHashMap()); a.addQuestion("question", "questionContent"); assertThat(a.getQuestions().get("question"), equalTo("questionContent")); _thrown.expect(BatfishException.class); _thrown.expectMessage(equalTo("Question question already exists for analysis analysis")); a.addQuestion("question", "questionContent"); }
public void addQuestion(String questionName, String questionContent) { if (_questions.containsKey(questionName)) { throw new BatfishException( String.format("Question %s already exists for analysis %s", questionName, _name)); } _questions.put(questionName, questionContent); }
Analysis { public void addQuestion(String questionName, String questionContent) { if (_questions.containsKey(questionName)) { throw new BatfishException( String.format("Question %s already exists for analysis %s", questionName, _name)); } _questions.put(questionName, questionContent); } }
Analysis { public void addQuestion(String questionName, String questionContent) { if (_questions.containsKey(questionName)) { throw new BatfishException( String.format("Question %s already exists for analysis %s", questionName, _name)); } _questions.put(questionName, questionContent); } @JsonCreator  Analysis(
      @JsonProperty(PROP_NAME) String name,
      @JsonProperty(PROP_QUESTIONS) @Nullable Map<String, String> questions); }
Analysis { public void addQuestion(String questionName, String questionContent) { if (_questions.containsKey(questionName)) { throw new BatfishException( String.format("Question %s already exists for analysis %s", questionName, _name)); } _questions.put(questionName, questionContent); } @JsonCreator  Analysis(
      @JsonProperty(PROP_NAME) String name,
      @JsonProperty(PROP_QUESTIONS) @Nullable Map<String, String> questions); @JsonProperty(PROP_NAME) String getName(); @JsonProperty(PROP_QUESTIONS) Map<String, String> getQuestions(); void addQuestion(String questionName, String questionContent); void deleteQuestion(String questionName); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
Analysis { public void addQuestion(String questionName, String questionContent) { if (_questions.containsKey(questionName)) { throw new BatfishException( String.format("Question %s already exists for analysis %s", questionName, _name)); } _questions.put(questionName, questionContent); } @JsonCreator  Analysis(
      @JsonProperty(PROP_NAME) String name,
      @JsonProperty(PROP_QUESTIONS) @Nullable Map<String, String> questions); @JsonProperty(PROP_NAME) String getName(); @JsonProperty(PROP_QUESTIONS) Map<String, String> getQuestions(); void addQuestion(String questionName, String questionContent); void deleteQuestion(String questionName); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }