Skip to content

Commit 3515adf

Browse files
committed
removed broken assert macro
1 parent 2b9376b commit 3515adf

File tree

8 files changed

+231
-170
lines changed

8 files changed

+231
-170
lines changed

samples/java-jaxrs-cxf/src/test/scala/ResourceListingIT.scala_ renamed to samples/java-jaxrs-cxf/src/test/scala/ResourceListingIT.scala

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,66 +14,66 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.wordnik.test.swagger.integration
17+
import com.wordnik.swagger.model._
1818

19-
import com.wordnik.swagger.core._
20-
import com.wordnik.swagger.core.util.JsonUtil
19+
import com.wordnik.swagger.core.util.{ ScalaJsonUtil, JsonSerializer }
2120

2221
import org.junit.runner.RunWith
2322

2423
import org.scalatest.junit.JUnitRunner
2524
import org.scalatest.FlatSpec
26-
import org.scalatest.matchers.ShouldMatchers
25+
import org.scalatest.Matchers
2726

2827
import scala.collection.JavaConversions._
2928

3029
import scala.io._
3130

3231
@RunWith(classOf[JUnitRunner])
33-
class ResourceListingIT extends FlatSpec with ShouldMatchers {
32+
class ResourceListingIT extends FlatSpec with Matchers {
3433
it should "read a resource listing" in {
35-
val json = Source.fromURL("http://localhost:8002/api/api-docs.json").mkString
36-
val doc = JsonUtil.mapper.readValue(json, classOf[Documentation])
37-
assert(doc.getApis.size === 2)
38-
assert((doc.getApis.map(api => api.getPath).toSet & Set("/api-docs/pet", "/api-docs/user")).size == 2)
34+
val json = Source.fromURL("http://localhost:8002/api/api-docs").mkString
35+
val doc = JsonSerializer.asResourceListing(json)
36+
37+
doc.apis.size should be (2)
38+
(doc.apis.map(api => api.path).toSet & Set("/pet", "/user")).size should be (2)
3939
}
4040

41-
it should "read the resource listing in XML" in {
41+
ignore should "read the resource listing in XML" in {
4242
val xmlString = Source.fromURL("http://localhost:8002/api/api-docs.xml").mkString
4343
val xml = scala.xml.XML.loadString(xmlString)
44-
assert(((xml \ "apis").map(api => (api \ "path").text).toSet & Set("/api-docs/pet", "/api-docs/user")).size == 2)
44+
((xml \ "apis").map(api => (api \ "path").text).toSet & Set("/pet", "/user")).size should be (2)
4545
}
4646

4747
it should "read the pet api description" in {
4848
val json = Source.fromURL("http://localhost:8002/api/api-docs/pet").mkString
49-
val doc = JsonUtil.mapper.readValue(json, classOf[Documentation])
50-
assert(doc.getApis.size === 3)
51-
assert((doc.getApis.map(api => api.getPath).toSet &
49+
val doc = JsonSerializer.asApiListing(json)
50+
doc.apis.size should be (3)
51+
(doc.apis.map(api => api.path).toSet &
5252
Set("/pet/{petId}",
5353
"/pet/findByStatus",
54-
"/pet/findByTags")).size == 3)
54+
"/pet/findByTags")).size should be (3)
5555
}
5656

57-
it should "read the user api with array and list data types as post data" in {
57+
ignore should "read the user api with array and list data types as post data" in {
5858
val json = Source.fromURL("http://localhost:8002/api/api-docs/user").mkString
59-
val doc = JsonUtil.mapper.readValue(json, classOf[Documentation])
60-
assert(doc.getApis.size === 6)
61-
assert((doc.getApis.map(api => api.getPath).toSet &
59+
val doc = JsonSerializer.asApiListing(json)
60+
doc.apis.size should be (3)
61+
(doc.apis.map(api => api.path).toSet &
6262
Set("/user",
6363
"/user/createWithArray",
64-
"/user/createWithList")).size == 3)
64+
"/user/createWithList")).size should be (3)
6565

66-
var param = doc.getApis.filter(api => api.getPath == "/user/createWithList")(0).getOperations()(0).getParameters()(0)
67-
assert(param.getDataType() === "List[User]")
66+
var param = doc.apis.filter(api => api.path == "/user/createWithList")(0).operations(0).parameters(0)
67+
param.dataType should be ("List[User]")
6868
}
6969

70-
it should "read the pet api description in XML" in {
70+
ignore should "read the pet api description in XML" in {
7171
val xmlString = Source.fromURL("http://localhost:8002/api/api-docs/pet").mkString
7272
val xml = scala.xml.XML.loadString(xmlString)
7373

74-
assert(((xml \ "apis").map(api => (api \ "path").text).toSet &
74+
((xml \ "apis").map(api => (api \ "path").text).toSet &
7575
Set("/pet/{petId}",
7676
"/pet/findByStatus",
77-
"/pet/findByTags")).size == 3)
77+
"/pet/findByTags")).size should be (3)
7878
}
7979
}

samples/java-jaxrs-no-annotations/src/test/scala/ResourceListingIT.scala

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.wordnik.test.swagger.integration
18-
1917
import com.wordnik.swagger.model._
2018

2119
import com.wordnik.swagger.core.util.{ ScalaJsonUtil, JsonSerializer }
@@ -24,58 +22,58 @@ import org.junit.runner.RunWith
2422

2523
import org.scalatest.junit.JUnitRunner
2624
import org.scalatest.FlatSpec
27-
import org.scalatest.matchers.ShouldMatchers
25+
import org.scalatest.Matchers
2826

2927
import scala.collection.JavaConversions._
3028

3129
import scala.io._
3230

3331
@RunWith(classOf[JUnitRunner])
34-
class ResourceListingIT extends FlatSpec with ShouldMatchers {
32+
class ResourceListingIT extends FlatSpec with Matchers {
3533
it should "read a resource listing" in {
3634
val json = Source.fromURL("http://localhost:8002/api/api-docs").mkString
3735
val doc = JsonSerializer.asResourceListing(json)
3836

39-
assert(doc.apis.size === 2)
40-
assert((doc.apis.map(api => api.path).toSet & Set("/pet", "/user")).size == 2)
37+
doc.apis.size should be (2)
38+
(doc.apis.map(api => api.path).toSet & Set("/pet", "/user")).size should be (2)
4139
}
4240

4341
ignore should "read the resource listing in XML" in {
4442
val xmlString = Source.fromURL("http://localhost:8002/api/api-docs.xml").mkString
4543
val xml = scala.xml.XML.loadString(xmlString)
46-
assert(((xml \ "apis").map(api => (api \ "path").text).toSet & Set("/pet", "/user")).size == 2)
44+
((xml \ "apis").map(api => (api \ "path").text).toSet & Set("/pet", "/user")).size should be (2)
4745
}
4846

4947
it should "read the pet api description" in {
5048
val json = Source.fromURL("http://localhost:8002/api/api-docs/pet").mkString
5149
val doc = JsonSerializer.asApiListing(json)
52-
assert(doc.apis.size === 3)
53-
assert((doc.apis.map(api => api.path).toSet &
50+
doc.apis.size should be (3)
51+
(doc.apis.map(api => api.path).toSet &
5452
Set("/pet/{petId}",
5553
"/pet/findByStatus",
56-
"/pet/findByTags")).size == 3)
54+
"/pet/findByTags")).size should be (3)
5755
}
5856

5957
ignore should "read the user api with array and list data types as post data" in {
6058
val json = Source.fromURL("http://localhost:8002/api/api-docs/user").mkString
6159
val doc = JsonSerializer.asApiListing(json)
62-
assert(doc.apis.size === 3)
63-
assert((doc.apis.map(api => api.path).toSet &
60+
doc.apis.size should be (3)
61+
(doc.apis.map(api => api.path).toSet &
6462
Set("/user",
6563
"/user/createWithArray",
66-
"/user/createWithList")).size == 3)
64+
"/user/createWithList")).size should be (3)
6765

6866
var param = doc.apis.filter(api => api.path == "/user/createWithList")(0).operations(0).parameters(0)
69-
assert(param.dataType === "List[User]")
67+
param.dataType should be ("List[User]")
7068
}
7169

7270
ignore should "read the pet api description in XML" in {
7371
val xmlString = Source.fromURL("http://localhost:8002/api/api-docs/pet").mkString
7472
val xml = scala.xml.XML.loadString(xmlString)
7573

76-
assert(((xml \ "apis").map(api => (api \ "path").text).toSet &
74+
((xml \ "apis").map(api => (api \ "path").text).toSet &
7775
Set("/pet/{petId}",
7876
"/pet/findByStatus",
79-
"/pet/findByTags")).size == 3)
77+
"/pet/findByTags")).size should be (3)
8078
}
8179
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* Copyright 2013 Wordnik, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import com.wordnik.swagger.model._
18+
19+
import com.wordnik.swagger.core.util.{ ScalaJsonUtil, JsonSerializer }
20+
21+
import org.junit.runner.RunWith
22+
23+
import org.scalatest.junit.JUnitRunner
24+
import org.scalatest.FlatSpec
25+
import org.scalatest.Matchers
26+
27+
import scala.collection.JavaConversions._
28+
29+
import scala.io._
30+
31+
@RunWith(classOf[JUnitRunner])
32+
class ResourceListingIT extends FlatSpec with Matchers {
33+
it should "read a resource listing" in {
34+
val json = Source.fromURL("http://localhost:8002/api/api-docs").mkString
35+
val doc = JsonSerializer.asResourceListing(json)
36+
37+
doc.apis.size should be (1)
38+
(doc.apis.map(api => api.path).toSet & Set("/pet")).size should be (1)
39+
}
40+
41+
ignore should "read the resource listing in XML" in {
42+
val xmlString = Source.fromURL("http://localhost:8002/api/api-docs.xml").mkString
43+
val xml = scala.xml.XML.loadString(xmlString)
44+
((xml \ "apis").map(api => (api \ "path").text).toSet & Set("/pet", "/user")).size should be (2)
45+
}
46+
47+
it should "read the pet api description" in {
48+
val json = Source.fromURL("http://localhost:8002/api/api-docs/pet").mkString
49+
val doc = JsonSerializer.asApiListing(json)
50+
doc.apis.size should be (2)
51+
(doc.apis.map(api => api.path).toSet &
52+
Set("/pet/{petId}/owner",
53+
"/pet/{petId}")).size should be (2)
54+
}
55+
56+
ignore should "read the user api with array and list data types as post data" in {
57+
val json = Source.fromURL("http://localhost:8002/api/api-docs/user").mkString
58+
val doc = JsonSerializer.asApiListing(json)
59+
doc.apis.size should be (3)
60+
(doc.apis.map(api => api.path).toSet &
61+
Set("/user",
62+
"/user/createWithArray",
63+
"/user/createWithList")).size should be (3)
64+
65+
var param = doc.apis.filter(api => api.path == "/user/createWithList")(0).operations(0).parameters(0)
66+
param.dataType should be ("List[User]")
67+
}
68+
69+
ignore should "read the pet api description in XML" in {
70+
val xmlString = Source.fromURL("http://localhost:8002/api/api-docs/pet").mkString
71+
val xml = scala.xml.XML.loadString(xmlString)
72+
73+
((xml \ "apis").map(api => (api \ "path").text).toSet &
74+
Set("/pet/{petId}",
75+
"/pet/findByStatus",
76+
"/pet/findByTags")).size should be (3)
77+
}
78+
}

samples/java-jaxrs-subresource/src/test/scala/com/wordnik/test/swagger/integration/ResourceListingIT.scala

Whitespace-only changes.

samples/java-jaxrs/src/test/scala/ResourceListingIT.scala

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.wordnik.test.swagger.integration
18-
1917
import com.wordnik.swagger.model._
2018

2119
import com.wordnik.swagger.core.util.{ ScalaJsonUtil, JsonSerializer }
@@ -24,58 +22,58 @@ import org.junit.runner.RunWith
2422

2523
import org.scalatest.junit.JUnitRunner
2624
import org.scalatest.FlatSpec
27-
import org.scalatest.matchers.ShouldMatchers
25+
import org.scalatest.Matchers
2826

2927
import scala.collection.JavaConversions._
3028

3129
import scala.io._
3230

3331
@RunWith(classOf[JUnitRunner])
34-
class ResourceListingIT extends FlatSpec with ShouldMatchers {
32+
class ResourceListingIT extends FlatSpec with Matchers {
3533
it should "read a resource listing" in {
3634
val json = Source.fromURL("http://localhost:8002/api/api-docs").mkString
3735
val doc = JsonSerializer.asResourceListing(json)
3836

39-
assert(doc.apis.size === 2)
40-
assert((doc.apis.map(api => api.path).toSet & Set("/pet", "/user")).size == 2)
37+
doc.apis.size should be (2)
38+
(doc.apis.map(api => api.path).toSet & Set("/pet", "/user")).size should be (2)
4139
}
4240

4341
ignore should "read the resource listing in XML" in {
4442
val xmlString = Source.fromURL("http://localhost:8002/api/api-docs.xml").mkString
4543
val xml = scala.xml.XML.loadString(xmlString)
46-
assert(((xml \ "apis").map(api => (api \ "path").text).toSet & Set("/pet", "/user")).size == 2)
44+
((xml \ "apis").map(api => (api \ "path").text).toSet & Set("/pet", "/user")).size should be (2)
4745
}
4846

4947
it should "read the pet api description" in {
5048
val json = Source.fromURL("http://localhost:8002/api/api-docs/pet").mkString
5149
val doc = JsonSerializer.asApiListing(json)
52-
assert(doc.apis.size === 3)
53-
assert((doc.apis.map(api => api.path).toSet &
50+
doc.apis.size should be (3)
51+
(doc.apis.map(api => api.path).toSet &
5452
Set("/pet/{petId}",
5553
"/pet/findByStatus",
56-
"/pet/findByTags")).size == 3)
54+
"/pet/findByTags")).size should be (3)
5755
}
5856

5957
ignore should "read the user api with array and list data types as post data" in {
6058
val json = Source.fromURL("http://localhost:8002/api/api-docs/user").mkString
6159
val doc = JsonSerializer.asApiListing(json)
62-
assert(doc.apis.size === 3)
63-
assert((doc.apis.map(api => api.path).toSet &
60+
doc.apis.size should be (3)
61+
(doc.apis.map(api => api.path).toSet &
6462
Set("/user",
6563
"/user/createWithArray",
66-
"/user/createWithList")).size == 3)
64+
"/user/createWithList")).size should be (3)
6765

6866
var param = doc.apis.filter(api => api.path == "/user/createWithList")(0).operations(0).parameters(0)
69-
assert(param.dataType === "List[User]")
67+
param.dataType should be ("List[User]")
7068
}
7169

7270
ignore should "read the pet api description in XML" in {
7371
val xmlString = Source.fromURL("http://localhost:8002/api/api-docs/pet").mkString
7472
val xml = scala.xml.XML.loadString(xmlString)
7573

76-
assert(((xml \ "apis").map(api => (api \ "path").text).toSet &
74+
((xml \ "apis").map(api => (api \ "path").text).toSet &
7775
Set("/pet/{petId}",
7876
"/pet/findByStatus",
79-
"/pet/findByTags")).size == 3)
77+
"/pet/findByTags")).size should be (3)
8078
}
8179
}

0 commit comments

Comments
 (0)