File tree Expand file tree Collapse file tree 2 files changed +37
-3
lines changed
modules/swagger-jaxrs/src/test/scala Expand file tree Collapse file tree 2 files changed +37
-3
lines changed Original file line number Diff line number Diff line change 11import resources ._
22
3+ import models ._
4+
35import com .wordnik .swagger .jaxrs .config ._
46import com .wordnik .swagger .models .parameters ._
57import com .wordnik .swagger .models .properties .MapProperty
@@ -18,8 +20,13 @@ import org.scalatest.Matchers
1820@ RunWith (classOf [JUnitRunner ])
1921class SubResourceScannerTest extends FlatSpec with Matchers {
2022 it should " scan a resource with subresources" in {
21- // val swagger = new Reader(new Swagger()).read(classOf[ResourceWithSubResources])
22- // Json.prettyPrint(swagger)
23+ val swagger = new Reader (new Swagger ()).read(classOf [ResourceWithSubResources ])
24+
25+ val employees = swagger.getPaths().get(" /employees" ).getGet
26+ employees.getOperationId() should be (" getTest" )
27+
28+ val employeesId = swagger.getPaths().get(" /employees/{id}" ).getGet
29+ employeesId.getOperationId() should be (" getSubresourceOperation" )
2330 }
2431
2532 it should " scan another resource with subresources" in {
@@ -36,4 +43,12 @@ class SubResourceScannerTest extends FlatSpec with Matchers {
3643
3744 swagger.getPaths().keySet().size() should be (2 )
3845 }
39- }
46+
47+ it should " find a body param" in {
48+ val swagger = new Reader (new Swagger ()).read(classOf [Resource942 ])
49+ val post = swagger.getPaths().get(" /test" ).getPost
50+ val param = post.getParameters().get(0 ).asInstanceOf [BodyParameter ];
51+
52+ param.getSchema should not be (null )
53+ }
54+ }
Original file line number Diff line number Diff line change 1+ package resources ;
2+
3+ import models .Employee ;
4+ import com .wordnik .swagger .annotations .*;
5+
6+ import javax .ws .rs .*;
7+ import javax .ws .rs .core .Response ;
8+
9+ import java .util .*;
10+
11+ @ Api ("/test" )
12+ @ Path ("/test" )
13+ public class Resource942 {
14+ @ ApiOperation (value ="test" )
15+ @ POST
16+ public void addTest (Employee employee ) {
17+ return ;
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments