@Test
 public void testErrorChangeUserInfo() {
   final JSONObject jsonObject = new JSONObject();
   jsonObject.put("login", faker.name().firstName());
   jsonObject.put("password", faker.name().lastName());
   jsonObject.put("email", faker.internet().emailAddress());
   jsonObject.put("imgData", "");
   final Response json =
       target("user")
           .path("1")
           .request(MediaType.APPLICATION_JSON)
           .post(Entity.json(jsonObject.toString()));
   assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), json.getStatus());
 }
Exemplo n.º 2
0
  public static TestPerson randomPerson() {
    Random random = new Random();

    TestPerson randomPerson = new TestPerson();

    PropertyMap pm = randomPerson.getPropertyMap();

    Name fakeName = faker.name();

    pm.put("firstName", fakeName.firstName());
    pm.put("lastName", fakeName.lastName());
    pm.put("email", faker.internet().emailAddress());

    if (random.nextBoolean()) {
      Business bInfo = faker.business();
      pm.put("creditCard.Type", bInfo.creditCardType());
      pm.put("creditCard.Number", bInfo.creditCardNumber());
      pm.put("creditCard.Expiry", bInfo.creditCardExpiry());
    }

    return randomPerson;
  }