### Question:
Question extends Item { public Object getAnswer() { if (answerType == null) { throw new IllegalStateException("answerType has not been specified"); } QuestionType basicAnswerType = getBasicAnswerType(); if (basicAnswerType.equals(QuestionType.TYPE_TEXT)) { return textAnswer; } if (basicAnswerType.equals(QuestionType.TYPE_NUMBER)) { return numberAnswer; } if (basicAnswerType.equals(QuestionType.TYPE_DECIMAL)) { return decimalAnswer; } if (basicAnswerType.equals(QuestionType.TYPE_BOOLEAN)) { return booleanAnswer; } if (basicAnswerType.equals(QuestionType.TYPE_DATE)) { return getDateAnswer(); } if (basicAnswerType.equals(QuestionType.TYPE_LIST)) { return listAnswer; } throw new IllegalStateException(); } Question();  Question(String type);  Question(String type, String label); void setDateFormat(String dateFormat); String getPreLabel(); void setPreLabel(String preLabel); String getPostLabel(); void setPostLabel(String postLabel); String getReason(); void setReason(String reason); boolean isRequired(); void setRequired(boolean required); boolean isFinalAnswer(); void setFinalAnswer(boolean finalAnswer); QuestionType getAnswerType(); void setAnswerType(QuestionType answerType); QuestionType getBasicAnswerType(); String getLabel(); void setLabel(String label); String getLastAnswer(); @Modifies( "answered" ) void setLastAnswer(String lastAnswer); String getTextAnswer(); @Modifies( "answered" ) void setTextAnswer(String textAnswer); Long getNumberAnswer(); @Modifies( "answered" ) void setNumberAnswer(Long numberAnswer); BigDecimal getDecimalAnswer(); @Modifies( "answered" ) void setDecimalAnswer(BigDecimal decimalAnswer); Boolean getBooleanAnswer(); @Modifies( "answered" ) void setBooleanAnswer(Boolean booleanAnswer); Date getDateAnswer(); @Modifies( "answered" ) void setDateAnswer(Date dateAnswer); @Modifies( "answered" ) void setDateAnswer(String dateAnswer); String getListAnswer(); @Modifies( "answered" ) void setListAnswer(String listAnswer); List<String> getAnswerAsList(); @Modifies( { "lastAnswer", "decimalAnswer", "numberAnswer", "textAnswer", "booleanAnswer", "listAnswer", "dateAnswer", "answered" } ) void setAnswer(Object answer); @Modifies( { "numberAnswer", "answered" } ) void setAnswer(long l); @Modifies( { "decimalAnswer", "answered" } ) void setAnswer(double d); @Modifies( { "booleanAnswer", "answered" } ) void setAnswer(boolean b); Object getAnswer(); boolean isAnswered(); @Modifies( { "lastAnswer", "decimalAnswer", "numberAnswer", "textAnswer", "booleanAnswer", "listAnswer", "dateAnswer", "answered" } ) void fit(String answerValue, QuestionType basicAnswerType); @Modifies( { "presentationStyles", "stylesList" } ) void removePresentationStyle(String presentationStyle); @Modifies( { "presentationStyles", "stylesList" } ) void addPresentationStyle(String presentationStyle); String[] split(String text, String delimiter); @Override String toString();  }### Answer:
@Test public void testGetAnswer() { Question q = new Question(); try { q.getAnswer(); fail(); } catch (IllegalStateException e) { } q.setAnswerType(Question.QuestionType.TYPE_DECIMAL); q.setDecimalAnswer(new BigDecimal("4.56")); assertEquals(new BigDecimal("4.56"), q.getAnswer()); }