/** * Adds a value to this set if the boolean value is <jk>true</jk> * * @param b The boolean value. * @param t The value to add. * @return This object (for method chaining). */ public ASet<T> appendIf(boolean b, T t) { if (b) append(t); return this; } }
/** * Test method for {@link Operation#produces(java.lang.Object[])}. */ @Test public void testProduces() { Operation t = new Operation(); t.produces(new ASet<MediaType>().appendAll(MediaType.forString("text/foo"))); t.produces(MediaType.forString("text/bar")); t.produces("text/baz"); t.produces(new StringBuilder("text/qux")); t.produces((Object)new String[]{"text/quux"}); t.produces((Object)new ASet<String>().append("text/quuux")); t.produces("['text/quuuux']"); t.produces("[]"); t.produces((Object)null); assertObjectEquals("['text/foo','text/bar','text/baz','text/qux','text/quux','text/quuux','text/quuuux']", t.getProduces()); assertInstanceOf(List.class, t.getProduces()); for (MediaType mt : t.getProduces()) assertInstanceOf(MediaType.class, mt); }
/** * Test method for {@link Swagger#produces(java.lang.Object[])}. */ @Test public void testProduces() { Swagger t = new Swagger(); t.produces(new ASet<MediaType>().appendAll(MediaType.forString("text/foo"))); t.produces(MediaType.forString("text/bar")); t.produces("text/baz"); t.produces(new StringBuilder("text/qux")); t.produces((Object)new String[]{"text/quux"}); t.produces((Object)new ASet<String>().append("text/quuux")); t.produces("['text/quuuux']"); t.produces("[]"); t.produces((Object)null); assertObjectEquals("['text/foo','text/bar','text/baz','text/qux','text/quux','text/quuux','text/quuuux']", t.getProduces()); assertInstanceOf(List.class, t.getProduces()); for (MediaType mt : t.getProduces()) assertInstanceOf(MediaType.class, mt); }
/** * Adds a value to this set if the boolean value is <jk>true</jk> * * @param b The boolean value. * @param t The value to add. * @return This object (for method chaining). */ public ASet<T> appendIf(boolean b, T t) { if (b) append(t); return this; } }
/** * Test method for {@link Operation#consumes(java.lang.Object[])}. */ @Test public void testConsumes() { Operation t = new Operation(); t.consumes(new ASet<MediaType>().appendAll(MediaType.forString("text/foo"))); t.consumes(MediaType.forString("text/bar")); t.consumes("text/baz"); t.consumes(new StringBuilder("text/qux")); t.consumes((Object)new String[]{"text/quux"}); t.consumes((Object)new ASet<String>().append("text/quuux")); t.consumes("['text/quuuux']"); t.consumes("[]"); t.consumes((Object)null); assertObjectEquals("['text/foo','text/bar','text/baz','text/qux','text/quux','text/quuux','text/quuuux']", t.getConsumes()); assertInstanceOf(List.class, t.getConsumes()); for (MediaType mt : t.getConsumes()) assertInstanceOf(MediaType.class, mt); }
/** * Adds a value to this set if the boolean value is <jk>true</jk> * * @param b The boolean value. * @param t The value to add. * @return This object (for method chaining). */ public ASet<T> appendIf(boolean b, T t) { if (b) append(t); return this; } }
/** * Test method for {@link Swagger#consumes(java.lang.Object[])}. */ @Test public void testConsumes() { Swagger t = new Swagger(); t.consumes(new ASet<MediaType>().appendAll(MediaType.forString("text/foo"))); t.consumes(MediaType.forString("text/bar")); t.consumes("text/baz"); t.consumes(new StringBuilder("text/qux")); t.consumes((Object)new String[]{"text/quux"}); t.consumes((Object)new ASet<String>().append("text/quuux")); t.consumes("['text/quuuux']"); t.consumes("[]"); t.consumes((Object)null); assertObjectEquals("['text/foo','text/bar','text/baz','text/qux','text/quux','text/quuux','text/quuuux']", t.getConsumes()); assertInstanceOf(List.class, t.getConsumes()); for (MediaType mt : t.getConsumes()) assertInstanceOf(MediaType.class, mt); }
public A init() { f1 = AEnum.FOO; f2 = AEnum.BAR; f3 = new AEnum[]{AEnum.FOO,null}; f4 = new AEnum[][]{{AEnum.FOO,null},null}; f5 = new AList<AEnum>().append(AEnum.FOO); f6 = new AList<AEnum>().append(AEnum.FOO); f7 = new ASet<AEnum>().append(AEnum.FOO); f8 = new ASet<AEnum>().append(AEnum.FOO); return this; } }
/** * Test method for {@link Operation#parameters(java.lang.Object[])}. */ @Test public void testParameters() { Operation t = new Operation(); t.parameters(new ASet<ParameterInfo>().appendAll(parameterInfo("a1","a2"))); t.parameters(parameterInfo("b1","b2")); t.parameters("{in:'c1',name:'c2'}"); t.parameters(new StringBuilder("{in:'d1',name:'d2'}")); t.parameters((Object)new String[]{"{in:'e1',name:'e2'}"}); t.parameters((Object)new ASet<String>().append("{in:'f1',name:'f2'}")); t.parameters("[{in:'g1',name:'g2'}]"); t.parameters("[]"); t.parameters((Object)null); assertObjectEquals("[{'in':'a1',name:'a2'},{'in':'b1',name:'b2'},{'in':'c1',name:'c2'},{'in':'d1',name:'d2'},{'in':'e1',name:'e2'},{'in':'f1',name:'f2'},{'in':'g1',name:'g2'}]", t.getParameters()); assertInstanceOf(List.class, t.getParameters()); for (ParameterInfo pi : t.getParameters()) assertInstanceOf(ParameterInfo.class, pi); }
public B init() { f1 = BEnum.FOO; f2 = BEnum.BAR; f3 = new BEnum[]{BEnum.FOO,null}; f4 = new BEnum[][]{{BEnum.FOO,null},null}; f5 = new AList<BEnum>().append(BEnum.FOO); f6 = new AList<BEnum>().append(BEnum.FOO); f7 = new ASet<BEnum>().append(BEnum.FOO); f8 = new ASet<BEnum>().append(BEnum.FOO); return this; } }
.set("responses", new AMap<Integer,ResponseInfo>().append(1,responseInfo("g"))) .set("schemes", new ASet<String>().appendAll("h")) .set("security", new ASet<Map<String,List<String>>>().append(new AMap<String,List<String>>().append("i1",new AList<String>().append("i2")))) .set("summary", "j") .set("tags", new ASet<String>().appendAll("k"))
/** * Test method for {@link Operation#securities(java.lang.Object[])}. */ @Test public void testSecurities() { Operation t = new Operation(); t.securities(new ASet<Map<String,List<String>>>().append(new AMap<String,List<String>>().append("a1",new AList<String>().append("a2")))); t.securities(new AMap<String,List<String>>().append("b1",new AList<String>().append("b2"))); t.securities("{c1:['c2']}"); t.securities(new StringBuilder("{d1:['d2']}")); t.securities((Object)new String[]{"{e1:['e2']}"}); t.securities((Object)new ASet<String>().append("{f1:['f2']}")); t.securities("[{g1:['g2']}]"); t.securities("[]"); t.securities((Object)null); assertObjectEquals("[{a1:['a2']},{b1:['b2']},{c1:['c2']},{d1:['d2']},{e1:['e2']},{f1:['f2']},{g1:['g2']}]", t.getSecurity()); assertInstanceOf(List.class, t.getSecurity()); }
.set("responses", new AMap<String,ResponseInfo>().append("j", responseInfo("j1"))) .set("schemes", new ASet<String>().appendAll("k1")) .set("security", new ASet<Map<String,List<String>>>().append(new AMap<String,List<String>>().append("l1",new AList<String>().append("l2")))) .set("securityDefinitions", new AMap<String,SecurityScheme>().append("m", securityScheme("m1"))) .set("swagger", "n")
/** * Test method for {@link Swagger#securities(java.lang.Object[])}. */ @Test public void testSecurities() { Swagger t = new Swagger(); //Collection<Map<String,List<String>>> t.securities(new ASet<Map<String,List<String>>>().append(new AMap<String,List<String>>().append("a1",new AList<String>().append("a2")))); t.securities(new AMap<String,List<String>>().append("b1",new AList<String>().append("b2"))); t.securities("{c1:['c2']}"); t.securities(new StringBuilder("{d1:['d2']}")); t.securities((Object)new String[]{"{e1:['e2']}"}); t.securities((Object)new ASet<String>().append("{f1:['f2']}")); t.securities("[{g1:['g2']}]"); t.securities("[]"); t.securities((Object)null); assertObjectEquals("[{a1:['a2']},{b1:['b2']},{c1:['c2']},{d1:['d2']},{e1:['e2']},{f1:['f2']},{g1:['g2']}]", t.getSecurity()); assertInstanceOf(List.class, t.getSecurity()); }
/** * Test method for {@link Swagger#setSecurity(java.util.Collection)}. */ @Test public void testSetSecurity() { Swagger t = new Swagger(); t.setSecurity(new ASet<Map<String,List<String>>>().append(new AMap<String,List<String>>().append("foo",new AList<String>().append("bar")))); assertObjectEquals("[{foo:['bar']}]", t.getSecurity()); assertInstanceOf(List.class, t.getSecurity()); t.setSecurity(new ASet<Map<String,List<String>>>()); assertObjectEquals("[]", t.getSecurity()); assertInstanceOf(List.class, t.getSecurity()); t.setSecurity(null); assertNull(t.getSecurity()); }
/** * Test method for {@link Operation#setSecurity(java.util.Collection)}. */ @Test public void testSetSecurity() { Operation t = new Operation(); t.setSecurity(new ASet<Map<String, List<String>>>().append(new AMap<String,List<String>>().append("foo",new AList<String>().append("bar")))); assertObjectEquals("[{foo:['bar']}]", t.getSecurity()); assertInstanceOf(List.class, t.getSecurity()); t.setSecurity(new ASet<Map<String, List<String>>>()); assertObjectEquals("[]", t.getSecurity()); assertInstanceOf(List.class, t.getSecurity()); t.setSecurity(null); assertNull(t.getSecurity()); }
/** * Test method for {@link Operation#addSecurity(java.util.List)}. */ @Test public void testAddSecurity() { Operation t = new Operation(); t.addSecurity(new ASet<Map<String, List<String>>>().append(new AMap<String,List<String>>().append("foo",new AList<String>().append("bar")))); assertObjectEquals("[{foo:['bar']}]", t.getSecurity()); assertInstanceOf(List.class, t.getSecurity()); t.addSecurity(new ASet<Map<String, List<String>>>()); assertObjectEquals("[{foo:['bar']}]", t.getSecurity()); assertInstanceOf(List.class, t.getSecurity()); t.addSecurity(null); assertObjectEquals("[{foo:['bar']}]", t.getSecurity()); assertInstanceOf(List.class, t.getSecurity()); }
/** * Test method for {@link Swagger#addSecurity(java.util.Collection)}. */ @Test public void testAddSecurity() { Swagger t = new Swagger(); t.addSecurity(new ASet<Map<String,List<String>>>().append(new AMap<String,List<String>>().append("foo",new AList<String>().append("bar")))); assertObjectEquals("[{foo:['bar']}]", t.getSecurity()); assertInstanceOf(List.class, t.getSecurity()); t.addSecurity(new ASet<Map<String,List<String>>>()); assertObjectEquals("[{foo:['bar']}]", t.getSecurity()); assertInstanceOf(List.class, t.getSecurity()); t.addSecurity(null); assertObjectEquals("[{foo:['bar']}]", t.getSecurity()); assertInstanceOf(List.class, t.getSecurity()); }
.set("enum", new ASet<String>().append("b")) .set("collectionFormat", "c") .set("description", "d")
.set("enum", new ASet<String>().append("b")) .set("collectionFormat", "c") .set("exclusiveMaximum", true)