diff --git a/artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/ExampleDictionary.java b/artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/ExampleDictionary.java index 3cb6d3f88c..579004fe2f 100644 --- a/artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/ExampleDictionary.java +++ b/artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/ExampleDictionary.java @@ -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"; diff --git a/artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/generation/AbstractDecoderGeneratorTest.java b/artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/generation/AbstractDecoderGeneratorTest.java index 6cb11281b4..10a80e1a32 100644 --- a/artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/generation/AbstractDecoderGeneratorTest.java +++ b/artio-codecs/src/test/java/uk/co/real_logic/artio/dictionary/generation/AbstractDecoderGeneratorTest.java @@ -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 { @@ -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();