Source:
<code>public void testFeedbackQuestionDetailsAdaptor_withComposedQuestionDetails_shouldSerializeToConcreteClass() { FeedbackTextQuestionDetails questionDetails = new FeedbackTextQuestionDetails("Question text."); ArrayList<FeedbackParticipantType> participants = new ArrayList<>(); participants.add(FeedbackParticipantType.OWN_TEAM_MEMBERS); participants.add(FeedbackParticipantType.RECEIVER); FeedbackQuestionAttributes fqa = FeedbackQuestionAttributes.builder() .withCourseId("testingCourse") .withFeedbackSessionName("testFeedbackSession") .withGiverType(FeedbackParticipantType.INSTRUCTORS) .withRecipientType(FeedbackParticipantType.SELF) <START> .withNumOfEntitiesToGiveFeedbackTo(1) <END> .withQuestionNumber(1) .withQuestionType(FeedbackQuestionType.TEXT) .withQuestionDetails(questionDetails) .withShowGiverNameTo(participants) .withShowRecipientNameTo(participants) .withShowResponseTo(participants) .build(); try { String serializeString = JsonUtils.toJson(fqa); assertEquals("{\n" + " \"feedbackSessionName\": \"testFeedbackSession\",\n" + " \"courseId\": \"testingCourse\",\n" + " \"questionDetails\": {\n" + " \"recommendedLength\": 0,\n" + " \"questionType\": \"TEXT\",\n" + " \"questionText\": \"Question text.\"\n" + " },\n" + " \"questionNumber\": 1,\n" + " \"questionType\": \"TEXT\",\n" + " \"giverType\": \"INSTRUCTORS\",\n" + " \"recipientType\": \"SELF\",\n" + " \"numberOfEntitiesToGiveFeedbackTo\": 1,\n" + " \"showResponsesTo\": [\n" + " \"RECEIVER\"\n" + " ],\n" + " \"showGiverNameTo\": [\n" + " \"RECEIVER\"\n" + " ],\n" + " \"showRecipientNameTo\": [\n" + " \"RECEIVER\"\n" + " ]\n" + "}", serializeString); } catch (JsonParseException e) { fail("error detected during serializing"); } }</code><technical_language>I Const.MAX_POSSIBLE_RECIPIENTS here</technical_language>

Target:
public void testFeedbackQuestionDetailsAdaptor_withComposedQuestionDetails_shouldSerializeToConcreteClass() { FeedbackTextQuestionDetails questionDetails = new FeedbackTextQuestionDetails("Question text."); ArrayList<FeedbackParticipantType> participants = new ArrayList<>(); participants.add(FeedbackParticipantType.OWN_TEAM_MEMBERS); participants.add(FeedbackParticipantType.RECEIVER); FeedbackQuestionAttributes fqa = FeedbackQuestionAttributes.builder() .withCourseId("testingCourse") .withFeedbackSessionName("testFeedbackSession") .withGiverType(FeedbackParticipantType.INSTRUCTORS) .withRecipientType(FeedbackParticipantType.SELF) .withNumOfEntitiesToGiveFeedbackTo(Const.MAX_POSSIBLE_RECIPIENTS) .withQuestionNumber(1) .withQuestionType(FeedbackQuestionType.TEXT) .withQuestionDetails(questionDetails) .withShowGiverNameTo(participants) .withShowRecipientNameTo(participants) .withShowResponseTo(participants) .build(); try { String serializeString = JsonUtils.toJson(fqa); assertEquals("{\n" + " \"feedbackSessionName\": \"testFeedbackSession\",\n" + " \"courseId\": \"testingCourse\",\n" + " \"questionDetails\": {\n" + " \"recommendedLength\": 0,\n" + " \"questionType\": \"TEXT\",\n" + " \"questionText\": \"Question text.\"\n" + " },\n" + " \"questionNumber\": 1,\n" + " \"questionType\": \"TEXT\",\n" + " \"giverType\": \"INSTRUCTORS\",\n" + " \"recipientType\": \"SELF\",\n" + " \"numberOfEntitiesToGiveFeedbackTo\": -100,\n" + " \"showResponsesTo\": [\n" + " \"RECEIVER\"\n" + " ],\n" + " \"showGiverNameTo\": [\n" + " \"RECEIVER\"\n" + " ],\n" + " \"showRecipientNameTo\": [\n" + " \"RECEIVER\"\n" + " ]\n" + "}", serializeString); } catch (JsonParseException e) { fail("error detected during serializing"); } }