Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding a test to guide resolution of issue #525 #526

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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);
Comment on lines +845 to +846

Check notice

Code scanning / CodeQL

Unread local variable Note test

Variable 'Decoder decoder' is never read.

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

@Test
public void shouldSupportGroupNumbersGreaterThanTheNumberOfElementsInTheNestedGroup() throws Exception
{
Expand Down Expand Up @@ -1879,6 +1889,16 @@
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