configure test profiles
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
package org.baeldung;
|
||||
|
||||
public interface Consts {
|
||||
int APPLICATION_PORT = 8080;
|
||||
int APPLICATION_PORT = 8082;
|
||||
}
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ import com.google.common.base.Charsets;
|
||||
public class RestTemplateLiveTest {
|
||||
|
||||
private RestTemplate restTemplate;
|
||||
private static final String fooResourceUrl = "http://localhost:" + APPLICATION_PORT + "/auth/foos";
|
||||
private static final String fooResourceUrl = "http://localhost:" + APPLICATION_PORT + "/spring-security-rest-full/auth/foos";
|
||||
|
||||
@Before
|
||||
public void beforeTest() {
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public abstract class AbstractLiveTest<T extends Serializable> {
|
||||
//
|
||||
|
||||
protected String getURL() {
|
||||
return "http://localhost:" + APPLICATION_PORT + "/auth/foos";
|
||||
return "http://localhost:" + APPLICATION_PORT + "/spring-security-rest-full/auth/foos";
|
||||
}
|
||||
|
||||
protected final RequestSpecification givenAuth() {
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ public class JPASpecificationLiveTest {
|
||||
|
||||
private User userTom;
|
||||
|
||||
private final String URL_PREFIX = "http://localhost:8080/auth/users/spec?search=";
|
||||
private final String URL_PREFIX = "http://localhost:8082/spring-security-rest-full/auth/users/spec?search=";
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
|
||||
@@ -14,17 +14,17 @@ import com.jayway.restassured.specification.RequestSpecification;
|
||||
public class MyUserLiveTest {
|
||||
|
||||
private final MyUser userJohn = new MyUser("john", "doe", "john@doe.com", 11);
|
||||
|
||||
private String URL_PREFIX = "http://localhost:8082/spring-security-rest-full/auth/api/myusers";
|
||||
@Test
|
||||
public void whenGettingListOfUsers_thenCorrect() {
|
||||
final Response response = givenAuth().get("http://localhost:8080/auth/api/myusers");
|
||||
final Response response = givenAuth().get(URL_PREFIX);
|
||||
final MyUser[] result = response.as(MyUser[].class);
|
||||
assertEquals(result.length, 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenFirstName_whenGettingListOfUsers_thenCorrect() {
|
||||
final Response response = givenAuth().get("http://localhost:8080/auth/api/myusers?firstName=john");
|
||||
final Response response = givenAuth().get(URL_PREFIX + "?firstName=john");
|
||||
final MyUser[] result = response.as(MyUser[].class);
|
||||
assertEquals(result.length, 1);
|
||||
assertEquals(result[0].getEmail(), userJohn.getEmail());
|
||||
@@ -32,14 +32,14 @@ public class MyUserLiveTest {
|
||||
|
||||
@Test
|
||||
public void givenPartialLastName_whenGettingListOfUsers_thenCorrect() {
|
||||
final Response response = givenAuth().get("http://localhost:8080/auth/api/myusers?lastName=do");
|
||||
final Response response = givenAuth().get(URL_PREFIX + "?lastName=do");
|
||||
final MyUser[] result = response.as(MyUser[].class);
|
||||
assertEquals(result.length, 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenEmail_whenGettingListOfUsers_thenIgnored() {
|
||||
final Response response = givenAuth().get("http://localhost:8080/auth/api/myusers?email=john");
|
||||
final Response response = givenAuth().get(URL_PREFIX + "?email=john");
|
||||
final MyUser[] result = response.as(MyUser[].class);
|
||||
assertEquals(result.length, 2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user