Skip to content

Commit bdc8b06

Browse files
BAEL-2412
Remove boolean and char fields from some of the examples.
1 parent 78096d4 commit bdc8b06

2 files changed

Lines changed: 3 additions & 10 deletions

File tree

gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@ public class PrimitiveBundleInitialized {
88
public long longValue = 1L;
99
public float floatValue = 1.0f;
1010
public double doubleValue = 1;
11-
public boolean booleanValue = true;
12-
public char charValue = 'a';
1311
// @formatter:on
1412

1513
public String toString() {
1614
return "{" + "byte: " + byteValue + ", " + "short: " + shortValue + ", "
1715
+ "int: " + intValue + ", " + "long: " + longValue + ", "
18-
+ "float: " + floatValue + ", " + "double: " + doubleValue + ", "
19-
+ "boolean: " + booleanValue + ", " + "char: " + charValue + "}";
16+
+ "float: " + floatValue + ", " + "double: " + doubleValue + "}";
2017
}
2118
}

gson/src/test/java/org/baeldung/gson/primitives/UnitTest.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public class UnitTest {
141141
// @formatter:off
142142
String json = "{\"byteValue\": null, \"shortValue\": null, "
143143
+ "\"intValue\": null, " + "\"longValue\": null, \"floatValue\": null"
144-
+ ", \"doubleValue\": null" + ", \"booleanValue\": null, \"charValue\": null}";
144+
+ ", \"doubleValue\": null}";
145145
// @formatter:on
146146
PrimitiveBundleInitialized model = gson.fromJson(json,
147147
PrimitiveBundleInitialized.class);
@@ -152,8 +152,6 @@ public class UnitTest {
152152
assertEquals(1, model.longValue);
153153
assertEquals(1, model.floatValue, 0.0001);
154154
assertEquals(1, model.doubleValue, 0.0001);
155-
assertTrue(model.booleanValue);
156-
assertEquals('a', model.charValue);
157155
}
158156

159157
@Test(expected = JsonSyntaxException.class) public void fromJsonEmptyString() {
@@ -181,7 +179,7 @@ public class UnitTest {
181179
// @formatter:off
182180
String json = "{\"byteValue\": \"15\", \"shortValue\": \"15\", "
183181
+ "\"intValue\": \"15\", " + "\"longValue\": \"15\", \"floatValue\": \"15.0\""
184-
+ ", \"doubleValue\": \"15.0\"" + ", \"booleanValue\": \"false\", \"charValue\": \"z\"}";
182+
+ ", \"doubleValue\": \"15.0\"}";
185183
// @formatter:on
186184
PrimitiveBundleInitialized model = gson.fromJson(json,
187185
PrimitiveBundleInitialized.class);
@@ -192,8 +190,6 @@ public class UnitTest {
192190
assertEquals(15, model.longValue);
193191
assertEquals(15, model.floatValue, 0.0001);
194192
assertEquals(15, model.doubleValue, 0.0001);
195-
assertFalse(model.booleanValue);
196-
assertEquals('z', model.charValue);
197193
}
198194

199195
@Test public void fromJsonBooleanFrom2ValueInteger() {

0 commit comments

Comments
 (0)