@@ -118,6 +118,24 @@ void testNullTripleTyped() {
118118 assertNotNull (triple );
119119 }
120120
121+ @ Test
122+ void testOf () {
123+ final ImmutableTriple <Integer , String , Boolean > triple = ImmutableTriple .of (0 , "foo" , Boolean .FALSE );
124+ assertEquals (0 , triple .left .intValue ());
125+ assertEquals (0 , triple .getLeft ().intValue ());
126+ assertEquals ("foo" , triple .middle );
127+ assertEquals ("foo" , triple .getMiddle ());
128+ assertEquals (Boolean .FALSE , triple .right );
129+ assertEquals (Boolean .FALSE , triple .getRight ());
130+ final ImmutableTriple <Object , String , Boolean > triple2 = ImmutableTriple .of (null , "bar" , Boolean .TRUE );
131+ assertNull (triple2 .left );
132+ assertNull (triple2 .getLeft ());
133+ assertEquals ("bar" , triple2 .middle );
134+ assertEquals ("bar" , triple2 .getMiddle ());
135+ assertEquals (Boolean .TRUE , triple2 .right );
136+ assertEquals (Boolean .TRUE , triple2 .getRight ());
137+ }
138+
121139 @ Test
122140 void testOfNonNull () {
123141 assertThrows (NullPointerException .class , () -> ImmutableTriple .ofNonNull (null , null , null ));
@@ -150,24 +168,6 @@ void testToString() {
150168 assertEquals ("(one,two,three)" , MutableTriple .of ("one" , "two" , "three" ).toString ());
151169 }
152170
153- @ Test
154- void testTripleOf () {
155- final ImmutableTriple <Integer , String , Boolean > triple = ImmutableTriple .of (0 , "foo" , Boolean .FALSE );
156- assertEquals (0 , triple .left .intValue ());
157- assertEquals (0 , triple .getLeft ().intValue ());
158- assertEquals ("foo" , triple .middle );
159- assertEquals ("foo" , triple .getMiddle ());
160- assertEquals (Boolean .FALSE , triple .right );
161- assertEquals (Boolean .FALSE , triple .getRight ());
162- final ImmutableTriple <Object , String , Boolean > triple2 = ImmutableTriple .of (null , "bar" , Boolean .TRUE );
163- assertNull (triple2 .left );
164- assertNull (triple2 .getLeft ());
165- assertEquals ("bar" , triple2 .middle );
166- assertEquals ("bar" , triple2 .getMiddle ());
167- assertEquals (Boolean .TRUE , triple2 .right );
168- assertEquals (Boolean .TRUE , triple2 .getRight ());
169- }
170-
171171 @ Test
172172 void testUseAsKeyOfHashMap () {
173173 final HashMap <ImmutableTriple <Object , Object , Object >, String > map = new HashMap <>();
0 commit comments