11package quickfix ;
22
3- import java .math .BigDecimal ;
4- import java .time .LocalDateTime ;
5- import java .time .LocalTime ;
6- import java .time .ZoneOffset ;
3+ import org .junit .Test ;
74import quickfix .field .EffectiveTime ;
85import quickfix .field .MDEntryTime ;
96import quickfix .field .converter .UtcTimeOnlyConverter ;
107
8+ import java .math .BigDecimal ;
9+ import java .time .LocalDateTime ;
10+ import java .time .LocalTime ;
11+ import java .time .ZoneOffset ;
1112import java .util .Iterator ;
1213import java .util .Optional ;
1314
1415import static org .junit .Assert .assertEquals ;
1516import static org .junit .Assert .assertFalse ;
17+ import static org .junit .Assert .assertThrows ;
1618import static org .junit .Assert .assertTrue ;
17- import org .junit .Test ;
1819
1920/**
2021 * Tests the {@link FieldMap} class.
@@ -79,16 +80,16 @@ private void testOrdering(int[] vals, int[] order, int[] expected) {
7980
8081 @ Test
8182 public void testOrdering () {
82- testOrdering (new int [] { 1 , 2 , 3 }, null , new int [] { 1 , 2 , 3 });
83- testOrdering (new int [] { 3 , 2 , 1 }, null , new int [] { 1 , 2 , 3 });
84- testOrdering (new int [] { 1 , 2 , 3 }, new int [] { 1 , 2 , 3 }, new int [] { 1 , 2 , 3 });
85- testOrdering (new int [] { 3 , 2 , 1 }, new int [] { 1 , 2 , 3 }, new int [] { 1 , 2 , 3 });
86- testOrdering (new int [] { 1 , 2 , 3 }, new int [] { 1 , 3 , 2 }, new int [] { 1 , 3 , 2 });
87- testOrdering (new int [] { 3 , 2 , 1 }, new int [] { 1 , 3 , 2 }, new int [] { 1 , 3 , 2 });
88- testOrdering (new int [] { 1 , 2 , 3 }, new int [] { 1 , 3 }, new int [] { 1 , 3 , 2 });
89- testOrdering (new int [] { 3 , 2 , 1 }, new int [] { 1 , 3 }, new int [] { 1 , 3 , 2 });
90- testOrdering (new int [] { 1 , 2 , 3 }, new int [] { 3 , 1 }, new int [] { 3 , 1 , 2 });
91- testOrdering (new int [] { 3 , 2 , 1 }, new int [] { 3 , 1 }, new int [] { 3 , 1 , 2 });
83+ testOrdering (new int []{ 1 , 2 , 3 }, null , new int []{ 1 , 2 , 3 });
84+ testOrdering (new int []{ 3 , 2 , 1 }, null , new int []{ 1 , 2 , 3 });
85+ testOrdering (new int []{ 1 , 2 , 3 }, new int []{ 1 , 2 , 3 }, new int []{ 1 , 2 , 3 });
86+ testOrdering (new int []{ 3 , 2 , 1 }, new int []{ 1 , 2 , 3 }, new int []{ 1 , 2 , 3 });
87+ testOrdering (new int []{ 1 , 2 , 3 }, new int []{ 1 , 3 , 2 }, new int []{ 1 , 3 , 2 });
88+ testOrdering (new int []{ 3 , 2 , 1 }, new int []{ 1 , 3 , 2 }, new int []{ 1 , 3 , 2 });
89+ testOrdering (new int []{ 1 , 2 , 3 }, new int []{ 1 , 3 }, new int []{ 1 , 3 , 2 });
90+ testOrdering (new int []{ 3 , 2 , 1 }, new int []{ 1 , 3 }, new int []{ 1 , 3 , 2 });
91+ testOrdering (new int []{ 1 , 2 , 3 }, new int []{ 3 , 1 }, new int []{ 3 , 1 , 2 });
92+ testOrdering (new int []{ 3 , 2 , 1 }, new int []{ 3 , 1 }, new int []{ 3 , 1 , 2 });
9293 }
9394
9495 @ Test
@@ -111,14 +112,21 @@ public void testOptionalDecimal() {
111112 assertFalse (map .getOptionalDecimal (6 ).isPresent ());
112113 }
113114
115+ @ Test
116+ public void testNullFieldException () {
117+ FieldMap map = new Message ();
118+ StringField field = new StringField (0 , null );
119+ assertThrows (FieldException .class , () -> map .setField (field ));
120+ }
121+
114122 private long epochMilliOfLocalDate (LocalDateTime localDateTime ) {
115123 return localDateTime .toInstant (ZoneOffset .UTC ).toEpochMilli ();
116124 }
117125
118126 @ Test
119127 public void testRemoveGroup () {
120128 FieldMap map = new Message ();
121- Group group = new Group (73 ,11 );
129+ Group group = new Group (73 , 11 );
122130 map .addGroup (group );
123131 assertTrue (map .hasGroup (73 ));
124132 map .removeGroup (73 );
0 commit comments