11package uk .co .real_logic .sbe .generation .csharp ;
22
3+ import static org .mockito .Mockito .mock ;
4+ import static org .mockito .Mockito .verify ;
35import static uk .co .real_logic .sbe .xml .XmlSchemaParser .parse ;
46
57import org .agrona .generation .StringWriterOutputManager ;
6- import org .junit .Test ;
8+ import org .junit .* ;
79
810import uk .co .real_logic .sbe .TestUtil ;
911import uk .co .real_logic .sbe .ir .Ir ;
1012import uk .co .real_logic .sbe .xml .IrGenerator ;
1113import uk .co .real_logic .sbe .xml .MessageSchema ;
1214import uk .co .real_logic .sbe .xml .ParserOptions ;
1315
16+ import java .io .PrintStream ;
17+
1418public class Issue567GroupSizeTest
1519{
20+ public static final String ERR_MSG =
21+ "WARNING: at <sbe:message name=\" issue567\" > <group name=\" group\" > \" numInGroup\" should be UINT8 or UINT16" ;
22+
23+ private PrintStream err ;
24+ private PrintStream mockErr = mock (PrintStream .class );
25+
26+ @ Before
27+ public void before ()
28+ {
29+ err = System .err ;
30+ System .setErr (mockErr );
31+ }
32+
33+ @ After
34+ public void after ()
35+ {
36+ System .setErr (err );
37+ verify (mockErr ).println (ERR_MSG );
38+ }
39+
1640 @ Test (expected = IllegalArgumentException .class )
1741 public void shouldThrowWhenUsingATypeThatIsNotConstrainedToFitInAnIntAsTheGroupSize () throws Exception
1842 {
19- // Arrange
2043 final ParserOptions options = ParserOptions .builder ().stopOnError (true ).build ();
2144 final MessageSchema schema = parse (TestUtil .getLocalResource ("issue567-invalid.xml" ), options );
2245 final IrGenerator irg = new IrGenerator ();
@@ -33,7 +56,6 @@ public void shouldThrowWhenUsingATypeThatIsNotConstrainedToFitInAnIntAsTheGroupS
3356 @ Test
3457 public void shouldGenerateWhenUsingATypeThatIsConstrainedToFitInAnIntAsTheGroupSize () throws Exception
3558 {
36- // Arrange
3759 final ParserOptions options = ParserOptions .builder ().stopOnError (true ).build ();
3860 final MessageSchema schema = parse (TestUtil .getLocalResource ("issue567-valid.xml" ), options );
3961 final IrGenerator irg = new IrGenerator ();
0 commit comments