diff --git a/src/test/java/io/swagger/test/examples/ExampleBuilderTest.java b/src/test/java/io/swagger/test/examples/ExampleBuilderTest.java
index c4e47cd1..47bc33e3 100644
--- a/src/test/java/io/swagger/test/examples/ExampleBuilderTest.java
+++ b/src/test/java/io/swagger/test/examples/ExampleBuilderTest.java
@@ -39,6 +39,8 @@
import java.util.HashMap;
import java.util.Map;
+import static org.testng.Assert.assertEquals;
+
public class ExampleBuilderTest {
static {
// register the JSON serializer
@@ -99,7 +101,7 @@ public void testXmlJackson() throws Exception {
definitions.put("Address", address);
- Example rep = (Example) ExampleBuilder.fromProperty(new RefProperty("User"), definitions);
+ Example rep = ExampleBuilder.fromProperty(new RefProperty("User"), definitions);
String xmlString = new XmlExampleSerializer().serialize(rep);
assertEqualsIgnoreLineEnding(xmlString, "fehguy12345 El Monte BlvdLos Altos HillsCA94022keySVP Engineering9");
@@ -256,21 +258,21 @@ public void testRecursiveModel() throws Exception {
public void testEmptyStringArrayJsonModel() throws Exception {
ArrayExample example = new ArrayExample();
example.add(new StringExample());
- Assert.assertEquals(Json.pretty(example), "[ null ]");
+ assertEquals(Json.pretty(example), "[ null ]");
}
@Test
public void testEmptyDoubleArrayJsonModel() throws Exception {
ArrayExample example = new ArrayExample();
example.add(new DoubleExample());
- Assert.assertEquals(Json.pretty(example), "[ 4.56 ]");
+ assertEquals(Json.pretty(example), "[ 4.56 ]");
}
@Test
public void testDoubleArrayModelAsString() throws Exception {
ArrayExample example = new ArrayExample();
example.add(new DoubleExample());
- Assert.assertEquals(example.asString(), "[4.56]");
+ assertEquals(example.asString(), "[4.56]");
}
@Test
@@ -283,7 +285,25 @@ public void testEmptyArrayXmlModel() throws Exception {
Assert.assertNull(xmlString);
}
+ @Test
+ public void testIssue133() throws Exception {
+ IntegerProperty integerProperty = new IntegerProperty();
+ integerProperty.setFormat("int64");
+ integerProperty.setExample(new Long(4321));
+ Model model = new ModelImpl()
+ .property("int64", integerProperty);
+
+ Map definitions = new HashMap<>();
+ definitions.put("Address", model);
+
+ Example rep = ExampleBuilder.fromProperty(new RefProperty("Address"), definitions);
+ assertEquals(Json.pretty(rep),
+ "{\n" +
+ " \"int64\" : 4321\n" +
+ "}");
+ }
+
private void assertEqualsIgnoreLineEnding(String actual, String expected) {
- Assert.assertEquals(actual.replace("\n", System.getProperty("line.separator")), expected);
+ assertEquals(actual.replace("\n", System.getProperty("line.separator")), expected);
}
}
diff --git a/src/test/java/io/swagger/test/integration/responses/SchemaResponseIT.java b/src/test/java/io/swagger/test/integration/responses/SchemaResponseIT.java
index e95fb608..8bbfe009 100644
--- a/src/test/java/io/swagger/test/integration/responses/SchemaResponseIT.java
+++ b/src/test/java/io/swagger/test/integration/responses/SchemaResponseIT.java
@@ -83,7 +83,7 @@ public void testIssue130() throws Exception {
public void testResponseHeaders() throws Exception {
Map body = new HashMap();
try {
- client.invokeAPI("/issue-133.2", "GET", new HashMap(), body,
+ client.invokeAPI("/issue-132.2", "GET", new HashMap(), body,
new HashMap(), null, null, null, new String[0]);
Assert.fail("Exception was expected!");
}
diff --git a/src/test/swagger/sample1.yaml b/src/test/swagger/sample1.yaml
index 5d44b98d..be595e0a 100644
--- a/src/test/swagger/sample1.yaml
+++ b/src/test/swagger/sample1.yaml
@@ -439,19 +439,33 @@ paths:
type: integer
format: int32
example: 99
- /issue-133:
+ /issue-132:
get:
parameters: []
responses:
303:
- description: issue 133
+ description: issue 132
headers:
Location:
type: string
format: url
example: 'http://foo.bar/other'
description: URI of the entity affected by the property change
- /issue-133.2:
+ /issue-132.2:
+ get:
+ parameters: []
+ responses:
+ 303:
+ description: issue 132, alternate example
+ headers:
+ _links:
+ description: array of locations
+ type: array
+ items:
+ type: string
+ format: url
+ example: 'http://foo.bar/other'
+ /issue-132.2:
get:
parameters: []
responses: