adding following modules with updated testcase : DB, Filter, Json (#1410)

* adding ratpack module

* adding pom.xml

* adding following modules with updated testcase : DB, Filter, Json
This commit is contained in:
Abhinab Kanrar
2017-03-15 15:33:32 +05:30
committed by maibin
parent 5cd552a16b
commit f6e570c6ca
7 changed files with 159 additions and 28 deletions

View File

@@ -4,10 +4,17 @@ 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 ApplicationTest {
@@ -23,6 +30,16 @@ public class ApplicationTest {
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"));
}
@After
public void shutdown() {
appUnderTest.close();