44import java .time .LocalDateTime ;
55import java .time .LocalTime ;
66import java .time .ZoneOffset ;
7- import junit .framework .Test ;
8- import junit .framework .TestCase ;
9- import junit .framework .TestSuite ;
107import quickfix .field .EffectiveTime ;
118import quickfix .field .MDEntryTime ;
129import quickfix .field .converter .UtcTimeOnlyConverter ;
1310
1411import java .util .Iterator ;
1512import java .util .Optional ;
1613
14+ import static org .junit .Assert .assertEquals ;
15+ import static org .junit .Assert .assertFalse ;
16+ import static org .junit .Assert .assertTrue ;
17+ import org .junit .Test ;
18+
1719/**
1820 * Tests the {@link FieldMap} class.
1921 * Specifically, verifies that the setters for {@link UtcTimeStampField} work correctly.
2022 *
2123 * @author toli
22- * @version $Id$
2324 */
24- public class FieldMapTest extends TestCase {
25- public FieldMapTest (String inName ) {
26- super (inName );
27- }
28-
29- public static Test suite () {
30- return new TestSuite (FieldMapTest .class );
31- }
25+ public class FieldMapTest {
3226
27+ @ Test
3328 public void testSetUtcTimeStampField () throws Exception {
3429 FieldMap map = new Message ();
3530 LocalDateTime aDate = LocalDateTime .now ();
@@ -43,6 +38,7 @@ public void testSetUtcTimeStampField() throws Exception {
4338 epochMilliOfLocalDate (map .getField (new EffectiveTime ()).getValue ()));
4439 }
4540
41+ @ Test
4642 public void testSetUtcTimeOnlyField () throws Exception {
4743 FieldMap map = new Message ();
4844 LocalTime aDate = LocalTime .now ();
@@ -59,6 +55,7 @@ public void testSetUtcTimeOnlyField() throws Exception {
5955 /**
6056 * Try a subclass of {@link UtcTimeOnlyField} and {@link UtcTimeStampField} directly
6157 */
58+ @ Test
6259 public void testSpecificFields () throws Exception {
6360 FieldMap map = new Message ();
6461 LocalDateTime aDate = LocalDateTime .now ();
@@ -80,6 +77,7 @@ private void testOrdering(int[] vals, int[] order, int[] expected) {
8077 assertEquals (String .valueOf (e ), it .next ().getObject ());
8178 }
8279
80+ @ Test
8381 public void testOrdering () {
8482 testOrdering (new int [] { 1 , 2 , 3 }, null , new int [] { 1 , 2 , 3 });
8583 testOrdering (new int [] { 3 , 2 , 1 }, null , new int [] { 1 , 2 , 3 });
@@ -93,6 +91,7 @@ public void testOrdering() {
9391 testOrdering (new int [] { 3 , 2 , 1 }, new int [] { 3 , 1 }, new int [] { 3 , 1 , 2 });
9492 }
9593
94+ @ Test
9695 public void testOptionalString () {
9796 FieldMap map = new Message ();
9897 map .setField (new StringField (128 , "bigbank" ));
@@ -102,6 +101,7 @@ public void testOptionalString() {
102101 assertFalse (map .getOptionalString (129 ).isPresent ());
103102 }
104103
104+ @ Test
105105 public void testOptionalDecimal () {
106106 FieldMap map = new Message ();
107107 map .setField (new DecimalField (44 , new BigDecimal ("1565.10" )));
@@ -114,4 +114,14 @@ public void testOptionalDecimal() {
114114 private long epochMilliOfLocalDate (LocalDateTime localDateTime ) {
115115 return localDateTime .toInstant (ZoneOffset .UTC ).toEpochMilli ();
116116 }
117+
118+ @ Test
119+ public void testRemoveGroup () {
120+ FieldMap map = new Message ();
121+ Group group = new Group (73 ,11 );
122+ map .addGroup (group );
123+ assertTrue (map .hasGroup (73 ));
124+ map .removeGroup (73 );
125+ assertFalse (map .hasGroup (73 ));
126+ }
117127}
0 commit comments