Java Code Examples for io.swagger.models.parameters.SerializableParameter#setCollectionFormat()
The following examples show how to use
io.swagger.models.parameters.SerializableParameter#setCollectionFormat() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSerializableParameterExtractorTest.java From vertx-swagger with Apache License 2.0 | 6 votes |
@Test() public void testArrayMulti() { String name = "myName"; SerializableParameter parameter = new QueryParameter(); parameter.setName("myName"); parameter.setType("array"); parameter.setCollectionFormat("multi"); List<String> paramsList = new ArrayList<>(); paramsList.add("toto"); paramsList.add("tutu"); paramsList.add("titi"); MultiMap params = MultiMap.caseInsensitiveMultiMap(); params.add(name, paramsList); Object result = abstractSerializableParameterExtractor.extract(name, parameter, params); Assert.assertArrayEquals(paramsList.toArray(), ((List) result).toArray()); }
Example 2
Source File: AbstractSerializableParameterExtractorTest.java From vertx-swagger with Apache License 2.0 | 5 votes |
@Test() public void testArray() { String name = "myName"; SerializableParameter parameter = new QueryParameter(); parameter.setName("myName"); parameter.setType("array"); parameter.setCollectionFormat(null); String param = "toto,tutu,titi"; MultiMap params = MultiMap.caseInsensitiveMultiMap(); params.add(name, param); Object result = abstractSerializableParameterExtractor.extract(name, parameter, params); Assert.assertArrayEquals(new String[] { "toto", "tutu", "titi" }, ((List) result).toArray()); }
Example 3
Source File: AbstractSerializableParameterExtractorTest.java From vertx-swagger with Apache License 2.0 | 5 votes |
@Test() public void testArraySsv() { String name = "myName"; SerializableParameter parameter = new QueryParameter(); parameter.setName("myName"); parameter.setType("array"); parameter.setCollectionFormat("ssv"); String param = "toto tutu titi"; MultiMap params = MultiMap.caseInsensitiveMultiMap(); params.add(name, param); Object result = abstractSerializableParameterExtractor.extract(name, parameter, params); Assert.assertArrayEquals(new String[] { "toto", "tutu", "titi" }, ((List) result).toArray()); }
Example 4
Source File: AbstractSerializableParameterExtractorTest.java From vertx-swagger with Apache License 2.0 | 5 votes |
@Test() public void testArrayCsv() { String name = "myName"; SerializableParameter parameter = new QueryParameter(); parameter.setName("myName"); parameter.setType("array"); parameter.setCollectionFormat("csv"); String param = "toto,tutu,titi"; MultiMap params = MultiMap.caseInsensitiveMultiMap(); params.add(name, param); Object result = abstractSerializableParameterExtractor.extract(name, parameter, params); Assert.assertArrayEquals(new String[] { "toto", "tutu", "titi" }, ((List) result).toArray()); }
Example 5
Source File: AbstractSerializableParameterExtractorTest.java From vertx-swagger with Apache License 2.0 | 5 votes |
@Test() public void testArrayTsv() { String name = "myName"; SerializableParameter parameter = new QueryParameter(); parameter.setName("myName"); parameter.setType("array"); parameter.setCollectionFormat("tsv"); String param = "toto\ttutu\ttiti"; MultiMap params = MultiMap.caseInsensitiveMultiMap(); params.add(name, param); Object result = abstractSerializableParameterExtractor.extract(name, parameter, params); Assert.assertArrayEquals(new String[] { "toto", "tutu", "titi" }, ((List) result).toArray()); }
Example 6
Source File: AbstractSerializableParameterExtractorTest.java From vertx-swagger with Apache License 2.0 | 5 votes |
@Test() public void testArrayPipes() { String name = "myName"; SerializableParameter parameter = new QueryParameter(); parameter.setName("myName"); parameter.setType("array"); parameter.setCollectionFormat("pipes"); String param = "toto|tutu|titi"; MultiMap params = MultiMap.caseInsensitiveMultiMap(); params.add(name, param); Object result = abstractSerializableParameterExtractor.extract(name, parameter, params); Assert.assertArrayEquals(new String[] { "toto", "tutu", "titi" }, ((List) result).toArray()); }
Example 7
Source File: AbstractSerializableParameterExtractorTest.java From vertx-swagger with Apache License 2.0 | 5 votes |
@Test() public void testArrayOther() { String name = "myName"; SerializableParameter parameter = new QueryParameter(); parameter.setName("myName"); parameter.setType("array"); parameter.setCollectionFormat("anyOtherValue"); String param = "toto,tutu,titi"; MultiMap params = MultiMap.caseInsensitiveMultiMap(); params.add(name, param); Object result = abstractSerializableParameterExtractor.extract(name, parameter, params); Assert.assertArrayEquals(new String[] { "toto", "tutu", "titi" }, ((List) result).toArray()); }