Skip to content

Commit 6368ca1

Browse files
author
jsymborski
committed
Minor clean up and organization of tests in JsonUtilTest
1 parent 3dd03d1 commit 6368ca1

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

payments-api/src/test/java/com/intuit/payment/util/JsonUtilTest.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class ClassWithPrivateFields {
4242
}
4343

4444
@Test
45-
public void testSerialize() throws SerializationException{
45+
public void testSerialize() throws SerializationException {
4646
Card card = new Card.Builder().number("12345").build();
4747
String cardStr = JsonUtil.serialize(card);
4848
Assert.assertNotNull(cardStr);
@@ -51,31 +51,31 @@ public void testSerialize() throws SerializationException{
5151
}
5252

5353
@Test
54-
public void testDeserialize() throws SerializationException {
55-
String cardStr = "{\"number\":\"12345\"}";
56-
Card card = (Card) JsonUtil.deserialize(cardStr, new TypeReference<Card>() {} );
57-
Assert.assertEquals(card.getNumber(), "12345");
58-
}
54+
public void testNullSerialization() throws SerializationException {
55+
String cardStr = JsonUtil.serialize(null);
56+
Assert.assertNull(cardStr);
57+
}
5958

60-
@Test(expectedExceptions = SerializationException.class)
61-
public void testErrorSerialize() throws SerializationException{
59+
@Test(expectedExceptions = SerializationException.class)
60+
public void testErrorSerialize() throws SerializationException {
6261
// Serializing this causes a InvalidDefinitionException to be thrown
6362
ClassWithPrivateFields classWithPrivateFields = new ClassWithPrivateFields(1, "John");
6463
JsonUtil.serialize(classWithPrivateFields);
6564
}
6665

6766
@Test
68-
public void testNullSerialization() throws SerializationException {
69-
String cardStr = JsonUtil.serialize(null);
70-
Assert.assertNull(cardStr);
71-
}
67+
public void testDeserialize() throws SerializationException {
68+
String cardStr = "{\"number\":\"12345\"}";
69+
Card card = (Card) JsonUtil.deserialize(cardStr, new TypeReference<Card>() {} );
70+
Assert.assertEquals(card.getNumber(), "12345");
71+
}
7272

7373
@Test(expectedExceptions = SerializationException.class)
74-
public void testErrorDeserialize() throws SerializationException{
74+
public void testErrorDeserialize() throws SerializationException {
7575
String cardStr = "{\"number\":\"12345\"\"}";
7676
JsonUtil.deserialize(cardStr, new TypeReference<Card>() {} );
7777
}
78-
78+
7979
@SuppressWarnings("unchecked")
8080
@Test
8181
public void testDeserializeList() throws SerializationException {

0 commit comments

Comments
 (0)