Skip to content

Commit 8727fb5

Browse files
committed
test: Fix ConvertJaxRsAnnotationTest
1 parent 1e743b9 commit 8727fb5

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

components/sbm-recipes-jee-to-boot/src/test/java/org/springframework/sbm/jee/jaxrs/actions/ConvertJaxRsAnnotationsTest.java

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -205,26 +205,28 @@ void replaceMethodAnnotations() throws Exception {
205205
" }\n" +
206206
"}";
207207

208+
@Language("java")
208209
String expected =
209-
"import org.springframework.web.bind.annotation.RequestMapping;\n" +
210-
"import org.springframework.web.bind.annotation.RequestMethod;\n" +
211-
"import org.springframework.web.bind.annotation.RestController;\n" +
212-
"import javax.ws.rs.PathParam;\n" +
213-
"import javax.ws.rs.core.MediaType;\n" +
214-
"\n" +
215-
"\n" +
216-
"@RestController\n" +
217-
"@RequestMapping(value = \"/hello\")\n" +
218-
"class ControllerClass {\n" +
219-
" @RequestMapping(value = \"/json/{name}\", produces = {\"image/jpeg\", \"image/gif\", \"image/png\", MediaType.APPLICATION_XML}, consumes = \"application/json\"," +
220-
" method = {RequestMethod.POST, RequestMethod.GET, RequestMethod.PUT, RequestMethod.DELETE})\n" +
221-
" public String getHelloWorldJSON(@PathParam(\"name\") String name) {\n" +
222-
" return \"Hello\";\n" +
223-
" }\n" +
224-
" public String notAnEndpoint(@PathParam(\"name\") String name) {\n" +
225-
" return \"Hello\";\n" +
226-
" }\n" +
227-
"}";
210+
"""
211+
import org.springframework.web.bind.annotation.RequestMapping;
212+
import org.springframework.web.bind.annotation.RequestMethod;
213+
import org.springframework.web.bind.annotation.RestController;
214+
215+
import javax.ws.rs.PathParam;
216+
import javax.ws.rs.core.MediaType;
217+
218+
219+
@RestController
220+
@RequestMapping(value = "/hello")
221+
class ControllerClass {
222+
@RequestMapping(value = "/json/{name}", produces = {"image/jpeg", "image/gif", "image/png", MediaType.APPLICATION_XML}, consumes = "application/json", method = {RequestMethod.POST, RequestMethod.GET, RequestMethod.PUT, RequestMethod.DELETE})
223+
public String getHelloWorldJSON(@PathParam("name") String name) {
224+
return "Hello";
225+
}
226+
public String notAnEndpoint(@PathParam("name") String name) {
227+
return "Hello";
228+
}
229+
}""";
228230

229231
ProjectContext projectContext = TestProjectContext.buildProjectContext()
230232
.withJavaSources(sourceCode)

0 commit comments

Comments
 (0)