Skip to content

Commit

Permalink
Minor test refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Feb 20, 2021
1 parent b2e92b6 commit d5f91ec
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,19 @@ enum Example2 {
Example2(int x) { this.x = x; }
}

public void testEnumFromInt1850() throws Exception
private final ObjectMapper MAPPER = newJsonMapper();

public void testEnumFromInt1850Method() throws Exception
{
final ObjectMapper mapper = newJsonMapper();

String json = mapper.writeValueAsString(Example1.A);
Example1 e1 = mapper.readValue(json, Example1.class);
String json = MAPPER.writeValueAsString(Example1.A);
Example1 e1 = MAPPER.readValue(json, Example1.class);
assertEquals(Example1.A, e1);
}

json = mapper.writeValueAsString(Example2.A);
Example2 e2 = mapper.readValue(json, Example2.class);
public void testEnumFromInt1850Field() throws Exception
{
String json = MAPPER.writeValueAsString(Example2.A);
Example2 e2 = MAPPER.readValue(json, Example2.class);
assertEquals(Example2.A, e2);
}
}

0 comments on commit d5f91ec

Please sign in to comment.