Skip to content

Commit 0b78f4b

Browse files
committed
adding a test to guide resolution of issue #525
1 parent 0fe3af7 commit 0b78f4b

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/ExampleDictionary.java

+4
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,10 @@ public final class ExampleDictionary
387387
"8=FIX.4.4\0019=71\00135=0\001115=abc\001116=2\001117=1.1\001127=19700101-00:00:00.001" +
388388
"\001120=2\001121=1\001121=2\00110=053\001";
389389

390+
public static final String REPEATING_GROUP_MESSAGE_WITH_THREE =
391+
"8=FIX.4.4\0019=71\00135=0\001115=abc\001116=2\001117=1.1\001127=19700101-00:00:00.001" +
392+
"\001120=3\001121=1\001121=1\001121=2\00110=053\001";
393+
390394
public static final String SINGLE_REPEATING_GROUP_MESSAGE =
391395
"8=FIX.4.4\0019=65\00135=0\001115=abc\001116=2\001117=1.1\001127=19700101-00:00:00.001" +
392396
"\001120=1\001121=2\00110=052\001";

artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/generation/AbstractDecoderGeneratorTest.java

+20
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,16 @@ public void shouldReasonablyValidateGroupNumbersLessThanTheNumberOfElementsInThe
838838
assertInvalid(decoder, INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP, 120);
839839
}
840840

841+
//TODO this test was added to guide the bugfix
842+
@Test
843+
public void shouldReasonablyValidateGroupNumbersLessThanTheNumberOfElementsInTheGroupList() throws Exception
844+
{
845+
final Decoder decoder = decodeHeartbeatWithRejectingUnknownFields(
846+
REPEATING_GROUP_MESSAGE_WITH_THREE, REPEATING_GROUP_MESSAGE_WITH_TOO_HIGH_NUMBER_FIELD);
847+
848+
// assertInvalid(decoder, INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP, 120);
849+
}
850+
841851
@Test
842852
public void shouldSupportGroupNumbersGreaterThanTheNumberOfElementsInTheNestedGroup() throws Exception
843853
{
@@ -1879,6 +1889,16 @@ Decoder decodeHeartbeatWithoutValidation(final String example) throws Exception
18791889
return decoder;
18801890
}
18811891

1892+
private Decoder decodeHeartbeatWithRejectingUnknownFields(final String... example) throws Exception
1893+
{
1894+
final Decoder decoder = (Decoder)heartbeatWithRejectingUnknownFields.getConstructor().newInstance();
1895+
for (final String s : example)
1896+
{
1897+
decode(s, decoder);
1898+
}
1899+
return decoder;
1900+
}
1901+
18821902
private Decoder decodeHeartbeatWithRejectingUnknownFields(final String example) throws Exception
18831903
{
18841904
final Decoder decoder = (Decoder)heartbeatWithRejectingUnknownFields.getConstructor().newInstance();

0 commit comments

Comments
 (0)