@Test public void b_shouldListMoreThanOneMailInBox() { for (int i = 0; i < 2; i++) { enviaEmailSimples(); } final String json = given() .contentType(ContentType.JSON) .accept(ContentType.JSON) .pathParam("nNumber", myMessageProvider.getnNumber()) .expect() .statusCode(OK) .log() .ifError() .when() .get(SHOW_ALL) .asString(); JsonPath jp = new JsonPath(json); final Collection<?> inbox = jp.get(""); assertThat(inbox.size(), greaterThan(1)); }
@Test public void a_shouldConnectinWithMailBox() { String json = given() .contentType(ContentType.JSON) .accept(ContentType.JSON) .body(myMessageProvider) .expect() .statusCode(OK) .log() .ifError() .post(CONNECT) .andReturn() .asString(); myMessageProvider = given(json).getObject("", MyMessageProvider.class); assertThat(myMessageProvider.isConnected(), is(true)); }
@Test public void b_shouldListAllMailInBox() { enviaEmailSimples(); final String json = given() .contentType(ContentType.JSON) .accept(ContentType.JSON) .pathParam("nNumber", myMessageProvider.getnNumber()) .expect() .statusCode(OK) .log() .ifError() .when() .get(SHOW_ALL) .asString(); JsonPath jp = new JsonPath(json); final Collection<?> inbox = jp.get(""); assertThat(inbox, is(not((nullValue())))); }
@BeforeClass public static void getMailBoxProvider() { myMessageProvider = new MyMessageProvider(); myMessageProvider.setnNumber("demo"); myMessageProvider.setPassword("123456"); }