This commit is contained in:
Tian Baoqiang
2017-07-28 04:58:24 -05:00
committed by Grzegorz Piwowarek
parent 0a631ac326
commit 9e193396ef
8 changed files with 215 additions and 45 deletions
@@ -0,0 +1,41 @@
package com.baeldung.spring;
import org.junit.Test;
import ratpack.test.MainClassApplicationUnderTest;
import java.io.IOException;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
/**
* @author aiet
*/
public class EmbedRatpackAppIntegrationTest {
MainClassApplicationUnderTest appUnderTest = new MainClassApplicationUnderTest(EmbedRatpackApp.class);
@Test
public void whenSayHello_thenGotWelcomeMessage() {
assertEquals("hello baeldung!", appUnderTest
.getHttpClient()
.getText("/hello"));
}
@Test
public void whenRequestList_thenGotArticles() throws IOException {
assertEquals(3, appUnderTest
.getHttpClient()
.getText("/list")
.split(",").length);
}
@Test
public void whenRequestStaticResource_thenGotStaticContent() {
assertThat(appUnderTest
.getHttpClient()
.getText("/"), containsString("page is static"));
}
}