|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2022 the original author or authors. |
|
|
|
* Copyright 2002-2023 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -48,15 +48,12 @@ public class DefaultControllerSpecTests { |
|
|
|
.exchange() |
|
|
|
.exchange() |
|
|
|
.expectStatus().isOk() |
|
|
|
.expectStatus().isOk() |
|
|
|
.expectBody(String.class).isEqualTo("Success"); |
|
|
|
.expectBody(String.class).isEqualTo("Success"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void controllerEmptyPath() { |
|
|
|
|
|
|
|
new DefaultControllerSpec(new MyController()).build() |
|
|
|
new DefaultControllerSpec(new MyController()).build() |
|
|
|
.get().uri("") |
|
|
|
.get().uri("") |
|
|
|
.exchange() |
|
|
|
.exchange() |
|
|
|
.expectStatus().isOk() |
|
|
|
.expectStatus().isOk() |
|
|
|
.expectBody(String.class).isEqualTo("Success empty path"); |
|
|
|
.expectBody(String.class).isEqualTo("Success"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
@ -121,19 +118,15 @@ public class DefaultControllerSpecTests { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unused") |
|
|
|
@RestController |
|
|
|
@RestController |
|
|
|
private static class MyController { |
|
|
|
private static class MyController { |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/") |
|
|
|
@GetMapping |
|
|
|
public String handleRootPath() { |
|
|
|
public String handleRootPath() { |
|
|
|
return "Success"; |
|
|
|
return "Success"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping |
|
|
|
|
|
|
|
public String handleEmptyPath() { |
|
|
|
|
|
|
|
return "Success empty path"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/exception") |
|
|
|
@GetMapping("/exception") |
|
|
|
public void handleWithError() { |
|
|
|
public void handleWithError() { |
|
|
|
throw new IllegalStateException(); |
|
|
|
throw new IllegalStateException(); |
|
|
|
|