Ejemplo n.º 1
0
 @Test
 public void serializeCustomerError() throws JsonProcessingException {
   JsonService jsonService = new JsonService();
   CustomerError error = new CustomerError();
   int pos = jsonService.writeAsOuterString(error).indexOf("type");
   assertTrue(jsonService.writeAsOuterString(error).indexOf("type", pos + 1) == -1);
 }
Ejemplo n.º 2
0
 @Test
 public void sessionIdHide() throws JsonProcessingException {
   JsonService jsonService = new JsonService();
   AuthRequest authRequest = new AuthRequest();
   assertTrue(!jsonService.writeAsOuterString(authRequest).contains("sessionId"));
   assertTrue(new String(jsonService.writeValueAsBytes(authRequest)).contains("sessionId"));
 }
Ejemplo n.º 3
0
 @Test
 public void serializeDateFormat() throws JsonProcessingException {
   JsonService jsonService = new JsonService();
   AuthResponse response = new AuthResponse();
   response.setData(new AuthResponseData());
   response.getData().setApiTokenExpirationDate(new DateTime(2016, 2, 14, 0, 0));
   assertTrue(
       jsonService
           .writeAsOuterString(response)
           .contains("\"api_token_expiration_date\":\"2016-02"));
 }