Skip to content

Commit c22e418

Browse files
committed
added tests for #1085
1 parent f1a7e55 commit c22e418

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

modules/swagger-jaxrs/src/test/scala/SimpleScannerTest.scala

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,7 @@ class SimpleScannerTest extends FlatSpec with Matchers {
307307
val swagger = new Reader(new Swagger()).read(classOf[Resource1073])
308308
swagger.getPaths() should be (null)
309309
}
310-
}
311-
312-
@RunWith(classOf[JUnitRunner])
313-
class SimpleScannerTest2 extends FlatSpec with Matchers {
310+
314311
it should "scan a resource with body parameters" in {
315312
val swagger = new Reader(new Swagger()).read(classOf[ResourceWithBodyParams])
316313
val param = swagger.getPaths().get("/testShort").getPost().getParameters().get(0).asInstanceOf[BodyParameter]
@@ -348,4 +345,12 @@ class SimpleScannerTest2 extends FlatSpec with Matchers {
348345
item.getParameters().size() should be (1)
349346
}
350347
}
348+
349+
it should "verify top-level path params per #1085" in {
350+
val swagger = new Reader(new Swagger()).read(classOf[Resource1085])
351+
val params = swagger.getPaths().get("/external/info/{id}").getGet().getParameters()
352+
val param = params.get(0)
353+
param.getName() should be ("id")
354+
param.isInstanceOf[PathParameter] should be (true)
355+
}
351356
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package resources;
2+
3+
import com.wordnik.swagger.annotations.*;
4+
5+
import javax.ws.rs.*;
6+
import javax.ws.rs.core.Response;
7+
8+
import java.util.*;
9+
10+
@Api(value = "/external/info/", description = "it's an api")
11+
@Path("external/info/{id}")
12+
public class Resource1085 {
13+
@ApiOperation(value="test")
14+
@GET
15+
public Response getTest(@PathParam("id") Long id) {
16+
return Response.ok().build();
17+
}
18+
}

0 commit comments

Comments
 (0)