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 412c21a commit 4743851
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,10 @@ public final class ExampleDictionary
"8=FIX.4.4\0019=71\00135=0\001115=abc\001116=2\001117=1.1\001127=19700101-00:00:00.001" +
"\001120=2\001121=1\001121=2\00110=053\001";

public static final String REPEATING_GROUP_MESSAGE_WITH_THREE =
"8=FIX.4.4\0019=71\00135=0\001115=abc\001116=2\001117=1.1\001127=19700101-00:00:00.001" +
"\001120=3\001121=1\001121=1\001121=2\00110=053\001";

public static final String SINGLE_REPEATING_GROUP_MESSAGE =
"8=FIX.4.4\0019=65\00135=0\001115=abc\001116=2\001117=1.1\001127=19700101-00:00:00.001" +
"\001120=1\001121=2\00110=052\001";
Expand Down
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,16 @@ 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 (final 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 4743851

Please sign in to comment.