Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stojsavljevic committed Dec 26, 2023
1 parent 4760a0b commit f21f136
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ChildFirstCtxControllerTests extends ParentCtxDefinition {
@Test
void testChildFirst() throws Exception {

Map<String, String> response = restTemplate.getForObject("/", Map.class);
Map<String, String> response = this.restTemplate.getForObject("/", Map.class);

Assertions.assertAll("Response from the first child context is wrong!",
() -> Assertions.assertEquals("parent_bean", response.get("parentBean")),
Expand All @@ -50,7 +50,7 @@ void testChildFirst() throws Exception {
@Test
void testChildFirstNotExists() throws Exception {

Map<String, ?> response = restTemplate.getForObject("/dummy", Map.class);
Map<String, ?> response = this.restTemplate.getForObject("/dummy", Map.class);

Assertions.assertAll("Error response for non-existing URL on the first child context is wrong!",
() -> Assertions.assertEquals("Not Found", response.get("error")),
Expand All @@ -63,7 +63,7 @@ void testChildFirstNotExists() throws Exception {
@Test
void testChildFirstActuator() throws Exception {

Map<String, String> response = restTemplate.getForObject("/actuator/beans", Map.class);
Map<String, String> response = this.restTemplate.getForObject("/actuator/beans", Map.class);

Assertions.assertNotNull(response.get("contexts"), "Actuator response is wrong!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ChildSecondCtxControllerTests extends ParentCtxDefinition {
@Test
void testChildSecond() throws Exception {

Map<String, String> response = restTemplate.getForObject("/", Map.class);
Map<String, String> response = this.restTemplate.getForObject("/", Map.class);

Assertions.assertAll("Response from the second child context is wrong!",
() -> Assertions.assertEquals("parent_bean", response.get("parentBean")),
Expand All @@ -50,7 +50,7 @@ void testChildSecond() throws Exception {
@Test
void testChildSecondNotExists() throws Exception {

Map<String, ?> response = restTemplate.getForObject("/dummy", Map.class);
Map<String, ?> response = this.restTemplate.getForObject("/dummy", Map.class);

Assertions.assertAll("Error response for non-existing URL on the second child context is wrong!",
() -> Assertions.assertEquals("Not Found", response.get("error")),
Expand All @@ -63,7 +63,7 @@ void testChildSecondNotExists() throws Exception {
@Test
void testChildSecondActuator() throws Exception {

Map<String, String> response = restTemplate.getForObject("/actuator/beans", Map.class);
Map<String, String> response = this.restTemplate.getForObject("/actuator/beans", Map.class);

Assertions.assertNotNull(response.get("contexts"), "Actuator response is wrong!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ abstract class CommonTest {
@Test
void testActuator() throws Exception {

Map<String, String> response = restTemplate.getForObject("http://localhost:{actuatorPort}/actuator/beans", Map.class, this.actuatorPort);
Map<String, String> response = this.restTemplate.getForObject("http://localhost:{actuatorPort}/actuator/beans", Map.class, this.actuatorPort);

Assertions.assertNotNull(response.get("contexts"), "Actuator response is wrong!");
}

int getChildPort() {

AnnotationConfigServletWebServerApplicationContext childContext = applicationContext
AnnotationConfigServletWebServerApplicationContext childContext = this.applicationContext
.getBean(AnnotationConfigServletWebServerApplicationContext.class);
return childContext.getWebServer().getPort();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class MultiCtxControllerTests extends CommonTest {
@Test
void testChild() throws Exception {

Map<String, String> response = restTemplate.getForObject("http://localhost:{childPort}/child", Map.class, getChildPort());
Map<String, String> response = this.restTemplate.getForObject("http://localhost:{childPort}/child", Map.class, getChildPort());

Assertions.assertAll("Response from child context is wrong!",
() -> Assertions.assertNull(response.get("parentBean")),
Expand All @@ -25,7 +25,7 @@ void testChild() throws Exception {
@Test
void testChildNotExists() throws Exception {

Map<String, ?> response = restTemplate.getForObject("http://localhost:{childPort}/child/dummy", Map.class, getChildPort());
Map<String, ?> response = this.restTemplate.getForObject("http://localhost:{childPort}/child/dummy", Map.class, getChildPort());

Assertions.assertAll("Error response for non-existing URL on child context is wrong!",
() -> Assertions.assertEquals("Not Found", response.get("error")),
Expand All @@ -38,7 +38,7 @@ void testChildNotExists() throws Exception {
@Test
void testParent() throws Exception {

Map<String, String> response = restTemplate.getForObject("/parent", Map.class);
Map<String, String> response = this.restTemplate.getForObject("/parent", Map.class);

Assertions.assertAll("Response from parent context is wrong!",
() -> Assertions.assertEquals("parent_bean", response.get("parentBean")),
Expand All @@ -52,7 +52,7 @@ void testParent() throws Exception {
@Test
void testParentNotExists() throws Exception {

Map<String, ?> response = restTemplate.getForObject("/parent/dummy", Map.class);
Map<String, ?> response = this.restTemplate.getForObject("/parent/dummy", Map.class);

Assertions.assertAll("Error response for non-existing URL on parent context is wrong!",
() -> Assertions.assertEquals("Not Found", response.get("error")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MultiCtxWithParentProfileControllerTests extends CommonTest {
@Test
void testChildWithParent() throws Exception {

Map<String, String> response = restTemplate.getForObject("http://localhost:{childPort}/child", Map.class,
Map<String, String> response = this.restTemplate.getForObject("http://localhost:{childPort}/child", Map.class,
getChildPort());

Assertions.assertAll("Response from child context is wrong!",
Expand All @@ -28,7 +28,7 @@ void testChildWithParent() throws Exception {
@Test
void testChildNotExists() throws Exception {

Map<String, ?> response = restTemplate.getForObject("http://localhost:{childPort}/child/dummy", Map.class,
Map<String, ?> response = this.restTemplate.getForObject("http://localhost:{childPort}/child/dummy", Map.class,
getChildPort());

Assertions.assertAll("Error response for non-existing URL on child context is wrong!",
Expand All @@ -42,7 +42,7 @@ void testChildNotExists() throws Exception {
@Test
void testParent() throws Exception {

Map<String, String> response = restTemplate.getForObject("/parent", Map.class);
Map<String, String> response = this.restTemplate.getForObject("/parent", Map.class);

Assertions.assertAll("Response from parent context is wrong!",
() -> Assertions.assertEquals("parent_bean", response.get("parentBean")),
Expand All @@ -56,7 +56,7 @@ void testParent() throws Exception {
@Test
void testParentNotExists() throws Exception {

Map<String, ?> response = restTemplate.getForObject("/parent/dummy", Map.class);
Map<String, ?> response = this.restTemplate.getForObject("/parent/dummy", Map.class);

Assertions.assertAll("Error response for non-existing URL on parent context is wrong!",
() -> Assertions.assertEquals("Not Found", response.get("error")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MultiCtxControllerTests {
@Test
void testParent() throws Exception {

Map<String, String> response = restTemplate.getForObject("/", Map.class);
Map<String, String> response = this.restTemplate.getForObject("/", Map.class);

Assertions.assertAll("Response from parent context is wrong!",
() -> Assertions.assertEquals("parent_bean", response.get("parentBean")),
Expand All @@ -35,7 +35,7 @@ void testParent() throws Exception {
@Test
void testParentNotExists() throws Exception {

Map<String, ?> response = restTemplate.getForObject("/dummy", Map.class);
Map<String, ?> response = this.restTemplate.getForObject("/dummy", Map.class);

Assertions.assertAll("Error response for non-existing URL on parent context is wrong!",
() -> Assertions.assertEquals("Not Found", response.get("error")),
Expand All @@ -54,7 +54,7 @@ void testParentActuator() throws Exception {
@Test
void testChildFirst() throws Exception {

Map<String, String> response = restTemplate.getForObject("/first/", Map.class);
Map<String, String> response = this.restTemplate.getForObject("/first/", Map.class);

Assertions.assertAll("Response from the first child context is wrong!",
() -> Assertions.assertEquals("parent_bean", response.get("parentBean")),
Expand All @@ -70,7 +70,7 @@ void testChildFirst() throws Exception {
@Test
void testChildFirstNotExists() throws Exception {

Map<String, ?> response = restTemplate.getForObject("/first/dummy", Map.class);
Map<String, ?> response = this.restTemplate.getForObject("/first/dummy", Map.class);

Assertions.assertAll("Error response for non-existing URL on the first child context is wrong!",
() -> Assertions.assertEquals("Not Found", response.get("error")),
Expand All @@ -89,7 +89,7 @@ void testChildFirstActuator() throws Exception {
@Test
void testChildSecond() throws Exception {

Map<String, String> response = restTemplate.getForObject("/second/", Map.class);
Map<String, String> response = this.restTemplate.getForObject("/second/", Map.class);

Assertions.assertAll("Response from the second child context is wrong!",
() -> Assertions.assertEquals("parent_bean", response.get("parentBean")),
Expand All @@ -105,7 +105,7 @@ void testChildSecond() throws Exception {
@Test
void testChildSecondNotExists() throws Exception {

Map<String, ?> response = restTemplate.getForObject("/second/dummy", Map.class);
Map<String, ?> response = this.restTemplate.getForObject("/second/dummy", Map.class);

Assertions.assertAll("Error response for non-existing URL on the second child context is wrong!",
() -> Assertions.assertEquals("Not Found", response.get("error")),
Expand All @@ -123,7 +123,7 @@ void testChildSecondActuator() throws Exception {
@SuppressWarnings("unchecked")
void testActuator(String URL, String message) throws Exception {

Map<String, String> response = restTemplate.getForObject(URL, Map.class);
Map<String, String> response = this.restTemplate.getForObject(URL, Map.class);

Assertions.assertNotNull(response.get("contexts"), message);
}
Expand Down

0 comments on commit f21f136

Please sign in to comment.