@@ -80,6 +80,7 @@ private static void assertFloatingEquals(Number expected, ValueTag<? extends Num
8080 }
8181
8282 @ Test
83+ @ SuppressWarnings ("DataFlowIssue" )
8384 void testConstructor () {
8485 {
8586 var tag = new ByteTag ();
@@ -93,6 +94,9 @@ void testConstructor() {
9394 tag = new ByteTag ("Meow" , (byte ) 114 );
9495 assertEquals ("Meow" , tag .getName ());
9596 assertIntegralEquals ((byte ) 114 , tag );
97+
98+ assertThrows (NullPointerException .class , () -> new ByteTag (null ));
99+ assertThrows (NullPointerException .class , () -> new ByteTag (null , (byte ) 114 ));
96100 }
97101
98102 {
@@ -107,6 +111,9 @@ void testConstructor() {
107111 tag = new ShortTag ("Meow" , (short ) 114 );
108112 assertEquals ("Meow" , tag .getName ());
109113 assertIntegralEquals ((short ) 114 , tag );
114+
115+ assertThrows (NullPointerException .class , () -> new ShortTag (null ));
116+ assertThrows (NullPointerException .class , () -> new ShortTag (null , (short ) 114 ));
110117 }
111118
112119 {
@@ -121,6 +128,9 @@ void testConstructor() {
121128 tag = new IntTag ("Meow" , 114 );
122129 assertEquals ("Meow" , tag .getName ());
123130 assertIntegralEquals (114 , tag );
131+
132+ assertThrows (NullPointerException .class , () -> new IntTag (null ));
133+ assertThrows (NullPointerException .class , () -> new IntTag (null , 114 ));
124134 }
125135
126136 {
@@ -135,6 +145,9 @@ void testConstructor() {
135145 tag = new LongTag ("Meow" , 114L );
136146 assertEquals ("Meow" , tag .getName ());
137147 assertIntegralEquals (114L , tag );
148+
149+ assertThrows (NullPointerException .class , () -> new LongTag (null ));
150+ assertThrows (NullPointerException .class , () -> new LongTag (null , 114L ));
138151 }
139152
140153 {
@@ -149,6 +162,9 @@ void testConstructor() {
149162 tag = new FloatTag ("Meow" , 114.0f );
150163 assertEquals ("Meow" , tag .getName ());
151164 assertFloatingEquals (114.0f , tag );
165+
166+ assertThrows (NullPointerException .class , () -> new FloatTag (null ));
167+ assertThrows (NullPointerException .class , () -> new FloatTag (null , 114.0f ));
152168 }
153169
154170 {
@@ -164,6 +180,9 @@ void testConstructor() {
164180 assertEquals ("Meow" , tag .getName ());
165181 assertFloatingEquals (114.0 , tag );
166182
183+
184+ assertThrows (NullPointerException .class , () -> new DoubleTag (null ));
185+ assertThrows (NullPointerException .class , () -> new DoubleTag (null , 114.0 ));
167186 }
168187
169188 {
@@ -184,6 +203,10 @@ void testConstructor() {
184203 assertEquals ("Hello" , tag .get ());
185204 assertEquals ("Hello" , tag .getValue ());
186205 assertEquals ("Hello" , tag .getAsString ());
206+
207+ assertThrows (NullPointerException .class , () -> new StringTag (null ));
208+ assertThrows (NullPointerException .class , () -> new StringTag (null , "Hello" ));
209+ assertThrows (NullPointerException .class , () -> new StringTag ("Meow" , null ));
187210 }
188211 }
189212
0 commit comments