Fix test names (#1853)
* upgrade to spring boot 1.5.2 * add full update to REST API * modify ratings controller * upgrade herold * fix integration test * fix integration test * minor fix * fix integration test * fix integration test * minor cleanup * minor cleanup * remove log4j properties * use standard logbook.xml * remove log4j dependencies * remove commons-logging * merge * fix conflict * exclude commons-logging dependency * cleanup * minor fix * minor fix * fix dependency issues * Revert "fix dependency issues" This reverts commit 83bf1f9fd2e1a9a55f9cacb085669568b06b49ec. * fix dependency issues * minor fix * minor fix * minor fix * cleanup generated files * fix commons-logging issue * add parent to pom * cleanup parent dependencies * cleanup pom * cleanup pom * add missing parent * fix logging issue * fix test names
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
package com.baeldung;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
import com.baeldung.model.Employee;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import ratpack.test.MainClassApplicationUnderTest;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(JUnit4.class)
|
||||
public class ApplicationIntegrationTest {
|
||||
|
||||
MainClassApplicationUnderTest appUnderTest = new MainClassApplicationUnderTest(Application.class);
|
||||
|
||||
@Test
|
||||
public void givenDefaultUrl_getStaticText() {
|
||||
assertEquals("Welcome to baeldung ratpack!!!", appUnderTest.getHttpClient().getText("/"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenDynamicUrl_getDynamicText() {
|
||||
assertEquals("Hello dummybot!!!", appUnderTest.getHttpClient().getText("/dummybot"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenUrl_getListOfEmployee() throws JsonProcessingException {
|
||||
List<Employee> employees = new ArrayList<Employee>();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
employees.add(new Employee(1L, "Mr", "John Doe"));
|
||||
employees.add(new Employee(2L, "Mr", "White Snow"));
|
||||
|
||||
assertEquals(mapper.writeValueAsString(employees), appUnderTest.getHttpClient().getText("/data/employees"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenStaticUrl_getDynamicText() {
|
||||
assertEquals(21, appUnderTest.getHttpClient().getText("/randomString").length());
|
||||
}
|
||||
|
||||
@After
|
||||
public void shutdown() {
|
||||
appUnderTest.close();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user