Ejemplo n.º 1
0
 @Test
 public void testFromJsonObjectNoText() {
   JsonObject jsonObject =
       Json.createObjectBuilder()
           .add(GoalStatus.FIELD_GOAL_ID, g1.getGoalID().toJsonObject())
           .add(GoalStatus.FIELD_STATUS, g1.getStatus())
           .build();
   GoalStatus p = GoalStatus.fromJsonObject(jsonObject);
   assertEquals(g1.getGoalID(), p.getGoalID());
   assertEquals(g1.getStatus(), p.getStatus());
   assertEquals("", p.getText());
 }
Ejemplo n.º 2
0
 @Test
 public void testFromJsonObject() {
   JsonObject jsonObject =
       Json.createObjectBuilder()
           .add(GoalStatus.FIELD_GOAL_ID, g1.getGoalID().toJsonObject())
           .add(GoalStatus.FIELD_STATUS, g1.getStatus())
           .add(GoalStatus.FIELD_TEXT, g1.getText())
           .build();
   GoalStatus p = GoalStatus.fromJsonObject(jsonObject);
   assertEquals(g1.toString(), p.toString());
   assertEquals(g1.toJsonObject(), p.toJsonObject());
   assertEquals(g1.getMessageType(), p.getMessageType());
   assertEquals(g1.getGoalID(), p.getGoalID());
   assertEquals(g1.getStatus(), p.getStatus());
   assertEquals(g1.getText(), p.getText());
   assertNotSame(g1, p);
   assertNotSame(g1.toString(), p.toString());
   assertNotSame(g1.toJsonObject(), p.toJsonObject());
 }