Skip to content

Commit

Permalink
adding a test to guide resolution of issue #525
Browse files Browse the repository at this point in the history
  • Loading branch information
lucianoviana committed Oct 23, 2024
1 parent 0fe3af7 commit 3a389c6
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,16 @@ public void shouldReasonablyValidateGroupNumbersLessThanTheNumberOfElementsInThe
assertInvalid(decoder, INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP, 120);
}

//TODO this test was added to guide the bugfix
@Test
public void shouldReasonablyValidateGroupNumbersLessThanTheNumberOfElementsInTheGroupList() throws Exception
{
final Decoder decoder = decodeHeartbeatWithRejectingUnknownFields(
REPEATING_GROUP_MESSAGE_WITH_THREE, REPEATING_GROUP_MESSAGE_WITH_TOO_HIGH_NUMBER_FIELD);

// assertInvalid(decoder, INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP, 120);
}

@Test
public void shouldSupportGroupNumbersGreaterThanTheNumberOfElementsInTheNestedGroup() throws Exception
{
Expand Down Expand Up @@ -1879,6 +1889,15 @@ Decoder decodeHeartbeatWithoutValidation(final String example) throws Exception
return decoder;
}

private Decoder decodeHeartbeatWithRejectingUnknownFields(final String... example) throws Exception
{
final Decoder decoder = (Decoder)heartbeatWithRejectingUnknownFields.getConstructor().newInstance();
for (String s : example) {
decode(s, decoder);
}
return decoder;
}

private Decoder decodeHeartbeatWithRejectingUnknownFields(final String example) throws Exception
{
final Decoder decoder = (Decoder)heartbeatWithRejectingUnknownFields.getConstructor().newInstance();
Expand Down

0 comments on commit 3a389c6

Please sign in to comment.