You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2018/07/01 21:59:28 UTC
[juneau] 02/02: Tests, formatting.
This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
commit 311b7b8319216e7a2f0022a99bb31a4f6043c424
Author: JamesBognar <ja...@apache.org>
AuthorDate: Sun Jul 1 17:59:06 2018 -0400
Tests, formatting.
---
.../java/org/apache/juneau/BeanFilterTest.java | 4 +-
.../java/org/apache/juneau/BeanMapErrorsTest.java | 12 +-
.../test/java/org/apache/juneau/BeanMapTest.java | 8 +-
.../juneau/CloseableByteArrayInputStream.java | 6 +-
.../org/apache/juneau/CloseableStringReader.java | 6 +-
.../test/java/org/apache/juneau/ComboInput.java | 6 +-
.../java/org/apache/juneau/ComboRoundTripTest.java | 10 +-
.../java/org/apache/juneau/ComboSerializeTest.java | 4 +-
.../java/org/apache/juneau/ContextCacheTest.java | 64 +-
.../java/org/apache/juneau/DynaBeanComboTest.java | 14 +-
.../java/org/apache/juneau/ObjectListTest.java | 6 +-
.../test/java/org/apache/juneau/ObjectMapTest.java | 14 +-
.../java/org/apache/juneau/PojoExamplesTest.java | 44 +-
.../java/org/apache/juneau/PropertyStoreTest.java | 790 ++++++++++-----------
.../java/org/apache/juneau/XmlValidatorParser.java | 2 +-
.../a/rttests/RoundTripAddClassAttrsTest.java | 24 +-
.../juneau/a/rttests/RoundTripBeanMapsTest.java | 6 +-
.../apache/juneau/a/rttests/RoundTripEnumTest.java | 20 +-
.../juneau/a/rttests/RoundTripGenericsTest.java | 2 +-
.../apache/juneau/a/rttests/RoundTripMapsTest.java | 22 +-
.../RoundTripObjectsWithSpecialMethodsTest.java | 2 +-
.../a/rttests/RoundTripPrimitivesBeansTest.java | 16 +-
.../a/rttests/RoundTripSimpleObjectsTest.java | 2 +-
.../a/rttests/RoundTripTransformBeansTest.java | 4 +-
.../apache/juneau/config/ConfigBuilderTest.java | 2 +-
.../juneau/config/ConfigMapListenerTest.java | 168 ++---
.../org/apache/juneau/config/ConfigMapTest.java | 412 +++++------
.../java/org/apache/juneau/config/ConfigTest.java | 268 +++----
.../apache/juneau/config/store/FileStoreTest.java | 24 +-
.../juneau/config/store/MemoryStoreTest.java | 10 +-
.../test/java/org/apache/juneau/csv/CsvTest.java | 2 +-
.../apache/juneau/dto/cognos/CognosXmlTest.java | 2 +-
.../apache/juneau/dto/html5/Html5BasicTest.java | 2 +-
.../juneau/dto/jsonschema/JsonSchemaTest.java | 2 +-
.../org/apache/juneau/dto/swagger/ContactTest.java | 28 +-
.../dto/swagger/ExternalDocumentationTest.java | 26 +-
.../apache/juneau/dto/swagger/HeaderInfoTest.java | 144 ++--
.../org/apache/juneau/dto/swagger/InfoTest.java | 50 +-
.../org/apache/juneau/dto/swagger/ItemsTest.java | 138 ++--
.../org/apache/juneau/dto/swagger/LicenseTest.java | 30 +-
.../apache/juneau/dto/swagger/OperationTest.java | 98 +--
.../juneau/dto/swagger/ParameterInfoTest.java | 176 ++---
.../juneau/dto/swagger/ResponseInfoTest.java | 58 +-
.../apache/juneau/dto/swagger/SchemaInfoTest.java | 228 +++---
.../juneau/dto/swagger/SecuritySchemeTest.java | 76 +-
.../juneau/dto/swagger/SwaggerBuilderTest.java | 8 +-
.../org/apache/juneau/dto/swagger/SwaggerTest.java | 172 ++---
.../org/apache/juneau/dto/swagger/TagTest.java | 38 +-
.../org/apache/juneau/dto/swagger/XmlTest.java | 50 +-
.../java/org/apache/juneau/html/BasicHtmlTest.java | 14 +-
.../org/apache/juneau/html/CommonParserTest.java | 6 +-
.../java/org/apache/juneau/html/CommonTest.java | 8 +-
.../juneau/httppart/HttpPartSchemaTest_Body.java | 174 ++---
.../httppart/HttpPartSchemaTest_FormData.java | 188 ++---
.../juneau/httppart/HttpPartSchemaTest_Header.java | 174 ++---
.../juneau/httppart/HttpPartSchemaTest_Path.java | 170 ++---
.../juneau/httppart/HttpPartSchemaTest_Query.java | 190 ++---
.../apache/juneau/httppart/UonPartParserTest.java | 4 +-
.../java/org/apache/juneau/https/AcceptTest.java | 14 +-
.../org/apache/juneau/https/ContentTypeTest.java | 2 +-
.../org/apache/juneau/jena/CommonParserTest.java | 6 +-
.../java/org/apache/juneau/jena/CommonTest.java | 8 +-
.../java/org/apache/juneau/jena/RdfParserTest.java | 4 +-
.../test/java/org/apache/juneau/jena/RdfTest.java | 2 +-
.../org/apache/juneau/json/CommonParserTest.java | 6 +-
.../java/org/apache/juneau/json/CommonTest.java | 8 +-
.../juneau/json/JsonParserEdgeCasesTest.java | 4 +-
.../org/apache/juneau/json/JsonParserTest.java | 8 +-
.../juneau/json/JsonSchemaSerializerTest.java | 110 +--
.../test/java/org/apache/juneau/json/JsonTest.java | 12 +-
.../apache/juneau/msgpack/MsgPackParserTest.java | 16 +-
.../apache/juneau/svl/ResolvingObjectMapTest.java | 8 +-
.../apache/juneau/svl/vars/RestrictedVarsTest.java | 28 +-
.../org/apache/juneau/testutils/TestUtils.java | 22 +-
.../apache/juneau/testutils/pojos/Constants.java | 2 +-
.../pojos/PrimitiveAtomicObjectsBean.java | 4 +-
.../testutils/pojos/PrimitiveObjectsBean.java | 22 +-
.../juneau/testutils/pojos/TestEnumToString.java | 9 +-
.../apache/juneau/transforms/BuilderComboTest.java | 32 +-
.../juneau/transforms/EnumerationSwapTest.java | 2 +-
.../apache/juneau/transforms/IteratorSwapTest.java | 2 +-
.../juneau/transforms/LocalizedDatesTest.java | 8 +-
.../org/apache/juneau/transforms/PojoSwapTest.java | 34 +-
.../apache/juneau/transforms/ReaderFilterTest.java | 22 +-
.../juneau/transforms/ReaderObjectSwapTest.java | 66 +-
.../transforms/SwapsAnnotationComboTest.java | 123 +++-
.../apache/juneau/uon/CommonParser_UonTest.java | 6 +-
.../java/org/apache/juneau/uon/Common_UonTest.java | 8 +-
.../java/org/apache/juneau/uon/UonParserTest.java | 8 +-
.../urlencoding/CommonParser_UrlEncodingTest.java | 6 +-
.../juneau/urlencoding/Common_UrlEncodingTest.java | 8 +-
.../urlencoding/UrlEncodingSerializerTest.java | 2 +-
.../org/apache/juneau/utils/ClassUtilsTest.java | 34 +-
.../apache/juneau/utils/CollectionUtilsTest.java | 26 +-
.../org/apache/juneau/utils/FilteredMapTest.java | 6 +-
.../org/apache/juneau/utils/IdentityListTest.java | 2 +-
.../org/apache/juneau/utils/JavadocLinkTester.java | 18 +-
.../java/org/apache/juneau/utils/MultiSetTest.java | 20 +-
.../org/apache/juneau/utils/PojoMergeTest.java | 8 +-
.../org/apache/juneau/utils/StringUtilsTest.java | 22 +-
.../apache/juneau/utils/TransformCacheTest.java | 16 +-
.../java/org/apache/juneau/xml/BasicXmlTest.java | 18 +-
.../org/apache/juneau/xml/CommonParserTest.java | 6 +-
.../java/org/apache/juneau/xml/CommonTest.java | 8 +-
.../org/apache/juneau/xml/XmlCollapsedTest.java | 10 +-
.../apache/juneau/xml/XmlIgnoreCommentsTest.java | 40 +-
.../apache/juneau/yaml/proto/CommonParserTest.java | 6 +-
.../org/apache/juneau/yaml/proto/CommonTest.java | 8 +-
108 files changed, 2581 insertions(+), 2517 deletions(-)
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/BeanFilterTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/BeanFilterTest.java
index 815c812..3e1b8e2 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/BeanFilterTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/BeanFilterTest.java
@@ -94,7 +94,7 @@ public class BeanFilterTest {
String r = s.serialize(c1);
assertEquals("{f0:'f0'}", r);
- List<C1> l = new LinkedList<C1>();
+ List<C1> l = new LinkedList<>();
l.add(new C2());
r = s.serialize(l);
assertEquals("[{f0:'f0'}]", r);
@@ -119,7 +119,7 @@ public class BeanFilterTest {
String r = s.serialize(d1);
assertEquals("{f0:'f0'}", r);
- List<D1> l = new LinkedList<D1>();
+ List<D1> l = new LinkedList<>();
l.add(new D2());
r = s.serialize(l);
assertEquals("[{f0:'f0'}]", r);
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/BeanMapErrorsTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/BeanMapErrorsTest.java
index 032683e..c7fd766 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/BeanMapErrorsTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/BeanMapErrorsTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -28,7 +28,7 @@ public class BeanMapErrorsTest {
@Test
public void beanPropertyMethodNotInBeanProperties() {
BeanContext bc = BeanContext.DEFAULT;
-
+
try {
bc.getClassMeta(A1.class);
fail();
@@ -36,11 +36,11 @@ public class BeanMapErrorsTest {
assertEquals("org.apache.juneau.BeanMapErrorsTest$A1: Found @BeanProperty(\"f2\") but name was not found in @Bean(properties)", e.getMessage());
}
}
-
+
@Bean(properties="f1")
public static class A1 {
public int f1;
-
+
@BeanProperty("f2")
public int f2() {
return -1;
@@ -53,7 +53,7 @@ public class BeanMapErrorsTest {
@Test
public void beanPropertyFieldNotInBeanProperties() {
BeanContext bc = BeanContext.DEFAULT;
-
+
try {
bc.getClassMeta(A2.class);
fail();
@@ -64,7 +64,7 @@ public class BeanMapErrorsTest {
@Bean(properties="f1")
public static class A2 {
public int f1;
-
+
@BeanProperty("f2")
public int f2;
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/BeanMapTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/BeanMapTest.java
index 9c7679d..55d5cfe 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/BeanMapTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/BeanMapTest.java
@@ -504,7 +504,7 @@ public class BeanMapTest {
public static class D1 {
public D2 b;
public List<D2> lb1;
- public List<D2> lb2 = new ArrayList<D2>();
+ public List<D2> lb2 = new ArrayList<>();
public D2[] ab1;
public D2[] ab2 = new D2[0];
}
@@ -615,7 +615,7 @@ public class BeanMapTest {
public List<G> l1;
- public List<G> l2 = new LinkedList<G>();
+ public List<G> l2 = new LinkedList<>();
@BeanProperty(type=List.class,params={G.class})
public List<G> l3;
@@ -627,7 +627,7 @@ public class BeanMapTest {
public List<G> getM1() { return m1; }
public void setM1(List<G> m1) { this.m1 = m1; }
- private List<G> m2 = new LinkedList<G>();
+ private List<G> m2 = new LinkedList<>();
public List<G> getM2() { return m2; }
public void setM2(List<G> m2) { this.m2 = m2; }
@@ -1891,7 +1891,7 @@ public class BeanMapTest {
}
public static class Y {
- public List<String> f1 = new LinkedList<String>();
+ public List<String> f1 = new LinkedList<>();
}
//====================================================================================================
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/CloseableByteArrayInputStream.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/CloseableByteArrayInputStream.java
index 46ddce8..716d4a0 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/CloseableByteArrayInputStream.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/CloseableByteArrayInputStream.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -23,14 +23,14 @@ public class CloseableByteArrayInputStream extends ByteArrayInputStream {
public CloseableByteArrayInputStream(byte[] buf) {
super(buf);
}
-
+
@Override
public int read() {
if (isClosed)
throw new RuntimeException("Stream is closed");
return super.read();
}
-
+
@Override
public void close() {
isClosed = true;
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/CloseableStringReader.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/CloseableStringReader.java
index 79a5480..836a3b5 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/CloseableStringReader.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/CloseableStringReader.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -23,14 +23,14 @@ public class CloseableStringReader extends StringReader {
public CloseableStringReader(String in) {
super(in);
}
-
+
@Override
public int read() throws IOException {
if (isClosed)
throw new RuntimeException("Reader is closed");
return super.read();
}
-
+
@Override
public int read(char[] cbuf, int off, int len) throws IOException {
if (isClosed)
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ComboInput.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ComboInput.java
index d7ab88a..7f5be00 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ComboInput.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ComboInput.java
@@ -81,17 +81,17 @@ public class ComboInput<T> {
/**
* Returns the input object.
* Override this method if you want it dynamically created each time.
- * @throws Exception
+ * @throws Exception
*/
public T getInput() throws Exception {
return in;
}
-
+
/**
* Override this method if you want to do a post-parse verification on the object.
* <p>
* Note that a Function would be preferred here, but it's not available in Java 6.
- *
+ *
* @param o The object returned by the parser.
*/
public void verify(T o) {}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ComboRoundTripTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ComboRoundTripTest.java
index bfad48d..1d4fccb 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ComboRoundTripTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ComboRoundTripTest.java
@@ -115,12 +115,12 @@ public abstract class ComboRoundTripTest {
"parseRdfXmlR",
};
- private static final Set<String> runTestsSet = new HashSet<String>(Arrays.asList(runTests));
+ private static final Set<String> runTestsSet = new HashSet<>(Arrays.asList(runTests));
private final boolean SKIP_RDF_TESTS = Boolean.getBoolean("skipRdfTests");
- private Map<Serializer,Serializer> serializerMap = new IdentityHashMap<Serializer,Serializer>();
- private Map<Parser,Parser> parserMap = new IdentityHashMap<Parser,Parser>();
+ private Map<Serializer,Serializer> serializerMap = new IdentityHashMap<>();
+ private Map<Parser,Parser> parserMap = new IdentityHashMap<>();
public ComboRoundTripTest(ComboInput<?> comboInput) {
this.comboInput = comboInput;
@@ -413,7 +413,7 @@ public abstract class ComboRoundTripTest {
public void c11_serializeHtml() throws Exception {
testSerialize("serializeHtml", sHtml, comboInput.html);
}
-
+
@Test
public void c12_parseHtml() throws Exception {
testParse("parseHtml", sHtml, pHtml, comboInput.html);
@@ -423,7 +423,7 @@ public abstract class ComboRoundTripTest {
public void c13_verifyHtml() throws Exception {
testParseVerify("verifyHtml", sHtml, pHtml);
}
-
+
//--------------------------------------------------------------------------------
// HTML - 't' property
//--------------------------------------------------------------------------------
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ComboSerializeTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ComboSerializeTest.java
index 51f6236..fa497f4 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ComboSerializeTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ComboSerializeTest.java
@@ -91,11 +91,11 @@ public abstract class ComboSerializeTest {
"serializeRdfXmlR",
};
- private static final Set<String> runTestsSet = new HashSet<String>(Arrays.asList(runTests));
+ private static final Set<String> runTestsSet = new HashSet<>(Arrays.asList(runTests));
private final boolean SKIP_RDF_TESTS = Boolean.getBoolean("skipRdfTests");
- private Map<Serializer,Serializer> serializerMap = new IdentityHashMap<Serializer,Serializer>();
+ private Map<Serializer,Serializer> serializerMap = new IdentityHashMap<>();
public ComboSerializeTest(ComboInput<?> comboInput) {
this.comboInput = comboInput;
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ContextCacheTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ContextCacheTest.java
index 772c4f2..59e0146 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ContextCacheTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ContextCacheTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -21,36 +21,36 @@ import org.junit.*;
* Tests the ContextCache class.
*/
public class ContextCacheTest {
-
+
//-------------------------------------------------------------------------------------------------------------------
// Basic tests
//-------------------------------------------------------------------------------------------------------------------
-
+
@Test
public void testBasic() {
-
+
PropertyStoreBuilder psb = PropertyStore.create();
PropertyStore ps = psb.build();
-
+
A a = ContextCache.INSTANCE.create(A.class, ps);
B b = ContextCache.INSTANCE.create(B.class, ps);
C c = ContextCache.INSTANCE.create(C.class, ps);
-
+
assertObjectEquals("{f1:'xxx'}", a);
assertObjectEquals("{f1:'xxx',f2:-1}", b);
assertObjectEquals("{f1:'xxx',f2:-1,f3:false}", c);
-
+
A a2 = ContextCache.INSTANCE.create(A.class, ps);
B b2 = ContextCache.INSTANCE.create(B.class, ps);
C c2 = ContextCache.INSTANCE.create(C.class, ps);
-
+
assertTrue(a == a2);
assertTrue(b == b2);
assertTrue(c == c2);
-
+
psb.set("A.f1", "foo");
ps = psb.build();
-
+
a2 = ContextCache.INSTANCE.create(A.class, ps);
b2 = ContextCache.INSTANCE.create(B.class, ps);
c2 = ContextCache.INSTANCE.create(C.class, ps);
@@ -58,15 +58,15 @@ public class ContextCacheTest {
assertObjectEquals("{f1:'foo'}", a2);
assertObjectEquals("{f1:'foo',f2:-1}", b2);
assertObjectEquals("{f1:'foo',f2:-1,f3:false}", c2);
-
+
assertTrue(a != a2);
assertTrue(b != b2);
assertTrue(c != c2);
-
+
a = a2; b = b2; c = c2;
-
+
ps = psb.set("B.f2.i", 123).build();
-
+
a2 = ContextCache.INSTANCE.create(A.class, ps);
b2 = ContextCache.INSTANCE.create(B.class, ps);
c2 = ContextCache.INSTANCE.create(C.class, ps);
@@ -74,15 +74,15 @@ public class ContextCacheTest {
assertObjectEquals("{f1:'foo'}", a2);
assertObjectEquals("{f1:'foo',f2:123}", b2);
assertObjectEquals("{f1:'foo',f2:123,f3:false}", c2);
-
+
assertTrue(a == a2);
assertTrue(b != b2);
assertTrue(c != c2);
a = a2; b = b2; c = c2;
-
+
ps = psb.set("C.f3.b", true).build();
-
+
a2 = ContextCache.INSTANCE.create(A.class, ps);
b2 = ContextCache.INSTANCE.create(B.class, ps);
c2 = ContextCache.INSTANCE.create(C.class, ps);
@@ -90,15 +90,15 @@ public class ContextCacheTest {
assertObjectEquals("{f1:'foo'}", a2);
assertObjectEquals("{f1:'foo',f2:123}", b2);
assertObjectEquals("{f1:'foo',f2:123,f3:true}", c2);
-
+
assertTrue(a == a2);
assertTrue(b == b2);
assertTrue(c != c2);
a = a2; b = b2; c = c2;
-
+
ps = psb.set("D.bad.o", "xxx").build();
-
+
a2 = ContextCache.INSTANCE.create(A.class, ps);
b2 = ContextCache.INSTANCE.create(B.class, ps);
c2 = ContextCache.INSTANCE.create(C.class, ps);
@@ -106,23 +106,23 @@ public class ContextCacheTest {
assertObjectEquals("{f1:'foo'}", a2);
assertObjectEquals("{f1:'foo',f2:123}", b2);
assertObjectEquals("{f1:'foo',f2:123,f3:true}", c2);
-
+
assertTrue(a == a2);
assertTrue(b == b2);
assertTrue(c == c2);
-
+
assertTrue(a.getPropertyStore() == a2.getPropertyStore());
assertTrue(b.getPropertyStore() == b2.getPropertyStore());
assertTrue(c.getPropertyStore() == c2.getPropertyStore());
-
+
a2 = ContextCache.INSTANCE.create(A.class, a.getPropertyStore().builder().set("A.f1", "foo").build());
assertTrue(a == a2);
-
+
a2 = ContextCache.INSTANCE.create(A.class, a.getPropertyStore().builder().set("A.f1", "bar").build());
assertTrue(a != a2);
}
-
+
public static class A extends Context {
public final String f1;
@@ -141,17 +141,17 @@ public class ContextCacheTest {
return null;
}
}
-
+
public static class B extends A {
public int f2;
public B(PropertyStore ps) {
super(ps);
f2 = getIntegerProperty("B.f2.i", -1);
-
+
}
}
-
+
public static class C extends B {
public boolean f3;
public C(PropertyStore ps) {
@@ -159,12 +159,12 @@ public class ContextCacheTest {
f3 = getBooleanProperty("C.f3.b", false);
}
}
-
+
@Test
public void testBadConstructor() {
PropertyStoreBuilder psb = PropertyStore.create();
- PropertyStore ps = psb.build();
-
+ PropertyStore ps = psb.build();
+
try {
ContextCache.INSTANCE.create(D1.class, ps);
fail("Exception expected");
@@ -178,7 +178,7 @@ public class ContextCacheTest {
assertEquals("Could not create instance of class 'org.apache.juneau.ContextCacheTest$D2'", e.getLocalizedMessage());
}
}
-
+
public static class D1 extends A {
protected D1(PropertyStore ps) {
super(ps);
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/DynaBeanComboTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/DynaBeanComboTest.java
index 906ab27..d574c9b 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/DynaBeanComboTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/DynaBeanComboTest.java
@@ -262,7 +262,7 @@ public class DynaBeanComboTest extends ComboRoundTripTest {
public static class BeanWithDynaField {
public int f1;
@BeanProperty(name="*")
- public Map<String,Object> f2 = new LinkedHashMap<String,Object>();
+ public Map<String,Object> f2 = new LinkedHashMap<>();
public int f3;
public BeanWithDynaField init() {
@@ -277,7 +277,7 @@ public class DynaBeanComboTest extends ComboRoundTripTest {
public static class BeanWithDynaMethods {
private int f1, f3;
- private Map<String,Object> f2 = new LinkedHashMap<String,Object>();
+ private Map<String,Object> f2 = new LinkedHashMap<>();
private boolean setterCalled = false;
public int getF1() {
@@ -316,7 +316,7 @@ public class DynaBeanComboTest extends ComboRoundTripTest {
public static class BeanWithDynaMethodsAndExtraKeys {
private int f1, f3;
- private Map<String,Object> f2 = new LinkedHashMap<String,Object>();
+ private Map<String,Object> f2 = new LinkedHashMap<>();
private boolean setterCalled = false;
public int getF1() {
@@ -347,7 +347,7 @@ public class DynaBeanComboTest extends ComboRoundTripTest {
public Collection<String> getExtraKeys() {
return f2.keySet();
}
-
+
public BeanWithDynaMethodsAndExtraKeys init() {
this.f1 = 1;
this.f2 = new ObjectMap().append("f2a", "a").append("f2b", "b");
@@ -360,7 +360,7 @@ public class DynaBeanComboTest extends ComboRoundTripTest {
public static class BeanWithDynaGetterOnly {
private int f1, f3;
- private Map<String,Object> f2 = new LinkedHashMap<String,Object>();
+ private Map<String,Object> f2 = new LinkedHashMap<>();
public int getF1() {
return f1;
@@ -398,7 +398,7 @@ public class DynaBeanComboTest extends ComboRoundTripTest {
public static class BeanWithDynaFieldSwapped {
@BeanProperty(name="*")
@Swap(CalendarSwap.ISO8601DTZ.class)
- public Map<String,Calendar> f1 = new LinkedHashMap<String,Calendar>();
+ public Map<String,Calendar> f1 = new LinkedHashMap<>();
public BeanWithDynaFieldSwapped init() {
this.f1.put("f1a", singleDate);
@@ -409,7 +409,7 @@ public class DynaBeanComboTest extends ComboRoundTripTest {
@Bean(sort=true)
public static class BeanWithDynaFieldStringList {
@BeanProperty(name="*")
- public Map<String,List<String>> f1 = new LinkedHashMap<String,List<String>>();
+ public Map<String,List<String>> f1 = new LinkedHashMap<>();
public BeanWithDynaFieldStringList init() {
this.f1.put("f1a", Arrays.asList(new String[]{"foo","bar"}));
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ObjectListTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ObjectListTest.java
index c5019d2..b460a39 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ObjectListTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ObjectListTest.java
@@ -105,7 +105,7 @@ public class ObjectListTest {
public void testFromReader() throws Exception {
assertObjectEquals("[1,2,3]", new ObjectList(new StringReader("[1,2,3]")));
}
-
+
//====================================================================================================
// testGetMap
//====================================================================================================
@@ -116,7 +116,7 @@ public class ObjectListTest {
assertObjectEquals("{'1':true,'2':false}", m2);
assertEquals(Integer.class, m2.keySet().iterator().next().getClass());
assertEquals(Boolean.class, m2.values().iterator().next().getClass());
-
+
m2 = l.get(0, Map.class, Integer.class, Boolean.class);
assertObjectEquals("{'1':true,'2':false}", m2);
assertEquals(Integer.class, m2.keySet().iterator().next().getClass());
@@ -132,7 +132,7 @@ public class ObjectListTest {
List<Integer> l2 = l.getList(0, Integer.class);
assertObjectEquals("[123,456]", l2);
assertEquals(Integer.class, l2.iterator().next().getClass());
-
+
l2 = l.get(0, List.class, Integer.class);
assertObjectEquals("[123,456]", l2);
assertEquals(Integer.class, l2.iterator().next().getClass());
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ObjectMapTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ObjectMapTest.java
index 745bf83..2da832f 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ObjectMapTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/ObjectMapTest.java
@@ -321,7 +321,7 @@ public class ObjectMapTest {
public void testFromReader() throws Exception {
assertObjectEquals("{foo:'bar'}", new ObjectMap(new StringReader("{foo:'bar'}")));
}
-
+
//====================================================================================================
// testGetMap
//====================================================================================================
@@ -332,15 +332,15 @@ public class ObjectMapTest {
assertObjectEquals("{'1':true,'2':false}", m2);
assertEquals(Integer.class, m2.keySet().iterator().next().getClass());
assertEquals(Boolean.class, m2.values().iterator().next().getClass());
-
+
m2 = m.getMap("b", Integer.class, Boolean.class, null);
assertNull(m2);
-
+
m2 = m.get("a", Map.class, Integer.class, Boolean.class);
assertObjectEquals("{'1':true,'2':false}", m2);
assertEquals(Integer.class, m2.keySet().iterator().next().getClass());
assertEquals(Boolean.class, m2.values().iterator().next().getClass());
-
+
m2 = m.get("b", Map.class, Integer.class, Boolean.class);
assertNull(m2);
}
@@ -354,14 +354,14 @@ public class ObjectMapTest {
List<Integer> l2 = m.getList("a", Integer.class, null);
assertObjectEquals("[123,456]", l2);
assertEquals(Integer.class, l2.iterator().next().getClass());
-
+
l2 = m.getList("b", Integer.class, null);
assertNull(l2);
-
+
l2 = m.get("a", List.class, Integer.class);
assertObjectEquals("[123,456]", l2);
assertEquals(Integer.class, l2.iterator().next().getClass());
-
+
l2 = m.get("b", List.class, Integer.class);
assertNull(l2);
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/PojoExamplesTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/PojoExamplesTest.java
index 38b0fe6..7877e2e 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/PojoExamplesTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/PojoExamplesTest.java
@@ -19,7 +19,7 @@ import org.apache.juneau.annotation.*;
import org.junit.*;
/*
- * Tests the BEAN_examples property and @Example annotation.
+ * Tests the BEAN_examples property and @Example annotation.
*/
public class PojoExamplesTest {
@@ -31,10 +31,10 @@ public class PojoExamplesTest {
BeanSession bs = BeanContext.create().example(A.class, new A().init()).build().createSession();
assertObjectEquals("{f1:'f1a'}", bs.getClassMeta(A.class).getExample(bs));
}
-
+
public static class A {
public String f1;
-
+
public A init() {
this.f1 = "f1a";
return this;
@@ -52,16 +52,16 @@ public class PojoExamplesTest {
public static class B1 {
public String f1;
-
+
@Example
public static B1 EXAMPLE = new B1().init();
-
+
public B1 init() {
this.f1 = "f1b";
return this;
}
}
-
+
//====================================================================================================
// test @Example on private field
//====================================================================================================
@@ -73,16 +73,16 @@ public class PojoExamplesTest {
public static class B2 {
public String f1;
-
+
@Example
private static B2 EXAMPLE = new B2().init();
-
+
public B2 init() {
this.f1 = "f1b";
return this;
}
}
-
+
//====================================================================================================
// test @Example on public no-arg method.
//====================================================================================================
@@ -94,12 +94,12 @@ public class PojoExamplesTest {
public static class C1 {
public String f1;
-
+
public C1 init() {
this.f1 = "f1c";
return this;
}
-
+
@Example
public static C1 x() {
return new C1().init();
@@ -117,12 +117,12 @@ public class PojoExamplesTest {
public static class C2 {
public String f1;
-
+
public C2 init() {
this.f1 = "f1c";
return this;
}
-
+
@Example
private static C2 x() {
return new C2().init();
@@ -140,18 +140,18 @@ public class PojoExamplesTest {
public static class D1 {
public String f1;
-
+
public D1 init() {
this.f1 = "f1d";
return this;
}
-
+
@Example
public static D1 x(BeanSession bs) {
return new D1().init();
}
}
-
+
//====================================================================================================
// test example() method, no annotation.
//====================================================================================================
@@ -163,12 +163,12 @@ public class PojoExamplesTest {
public static class E1 {
public String f1;
-
+
public E1 init() {
this.f1 = "f1e";
return this;
}
-
+
public static E1 example() {
return new E1().init();
}
@@ -185,12 +185,12 @@ public class PojoExamplesTest {
public static class E2 {
public String f1;
-
+
public E2 init() {
this.f1 = "f1e";
return this;
}
-
+
public static E2 example(BeanSession bs) {
return new E2().init();
}
@@ -237,11 +237,11 @@ public class PojoExamplesTest {
}
}
public static class F3 {
- @Example
+ @Example
public static String F3 = "foo";
}
public static class F4 {
- @Example
+ @Example
public F4 f4 = new F4();
}
}
\ No newline at end of file
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/PropertyStoreTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/PropertyStoreTest.java
index b82b926..fe3f2ab 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/PropertyStoreTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/PropertyStoreTest.java
@@ -29,7 +29,7 @@ public class PropertyStoreTest {
//====================================================================================================
// testBasic()
//====================================================================================================
-
+
@Test
public void testBasic() {
PropertyStoreBuilder b = PropertyStore.create();
@@ -41,11 +41,11 @@ public class PropertyStoreTest {
assertObjectEquals("{A:{'f1.s':'1','f2.s':'2'},B:{'f3.s':'3','f4.s':'4'}}", b.build());
}
-
+
//====================================================================================================
// testInvalidKeys()
//====================================================================================================
-
+
@Test
public void testInvalidKeys() {
PropertyStoreBuilder b = PropertyStore.create();
@@ -56,7 +56,7 @@ public class PropertyStoreTest {
testError(b, "A.f1.s/addx", "foo", "Invalid key specified: 'A.f1.s/addx'");
testError(b, "A.f1.s/removex", "foo", "Invalid key specified: 'A.f1.s/removex'");
}
-
+
//====================================================================================================
// Property type tests
//====================================================================================================
@@ -65,12 +65,12 @@ public class PropertyStoreTest {
public void testString() throws Exception {
PropertyStoreBuilder b = PropertyStore.create();
PropertyStore ps = null;
- b.set("A.f1.s", "1");
- b.set("A.f2.s", 2);
- b.set("A.f3.s", true);
- b.set("A.f4.s", new ObjectMap("{foo:'bar'}"));
- b.set("A.f5.s", new ObjectList("[1,2]"));
- b.set("A.f6.s", null);
+ b.set("A.f1.s", "1");
+ b.set("A.f2.s", 2);
+ b.set("A.f3.s", true);
+ b.set("A.f4.s", new ObjectMap("{foo:'bar'}"));
+ b.set("A.f5.s", new ObjectList("[1,2]"));
+ b.set("A.f6.s", null);
ps = b.build();
assertObjectEquals("{A:{'f1.s':'1','f2.s':'2','f3.s':'true','f4.s':'{foo:\\'bar\\'}','f5.s':'[1,2]'}}", ps);
assertInstanceOf(String.class, ps.getProperty("A.f1.s"));
@@ -79,13 +79,13 @@ public class PropertyStoreTest {
assertInstanceOf(String.class, ps.getProperty("A.f4.s"));
assertInstanceOf(String.class, ps.getProperty("A.f5.s"));
- b.clear();
- b.set("A.f1", "1");
- b.set("A.f2", 2);
- b.set("A.f3", true);
- b.set("A.f4", new ObjectMap("{foo:'bar'}"));
- b.set("A.f5", new ObjectList("[1,2]"));
- b.set("A.f6", null);
+ b.clear();
+ b.set("A.f1", "1");
+ b.set("A.f2", 2);
+ b.set("A.f3", true);
+ b.set("A.f4", new ObjectMap("{foo:'bar'}"));
+ b.set("A.f5", new ObjectList("[1,2]"));
+ b.set("A.f6", null);
ps = b.build();
assertObjectEquals("{A:{f1:'1',f2:'2',f3:'true',f4:'{foo:\\'bar\\'}',f5:'[1,2]'}}", ps);
assertInstanceOf(String.class, ps.getProperty("A.f1"));
@@ -94,28 +94,28 @@ public class PropertyStoreTest {
assertInstanceOf(String.class, ps.getProperty("A.f4"));
assertInstanceOf(String.class, ps.getProperty("A.f5"));
- b.set("A.f1", "x1");
- b.set("A.f2", null);
- b.set("A.f3", null);
- b.remove("A.f4");
- b.remove("A.f5");
-
+ b.set("A.f1", "x1");
+ b.set("A.f2", null);
+ b.set("A.f3", null);
+ b.remove("A.f4");
+ b.remove("A.f5");
+
assertObjectEquals("{A:{f1:'x1'}}", b.build());
-
+
testError(b, "A.f1/add", "foo", "Cannot add value 'foo' (String) to property 'f1' (String).");
testError(b, "A.f1/add.123", "foo", "Cannot add value 'foo' (String) to property 'f1' (String).");
testError(b, "A.f1/remove", "foo", "Cannot remove value 'foo' (String) from property 'f1' (String).");
}
-
+
@Test
public void testBoolean() throws Exception {
PropertyStoreBuilder b = PropertyStore.create();
PropertyStore ps = null;
- b.set("A.f1.b", "true");
+ b.set("A.f1.b", "true");
b.set("A.f2.b", "false");
b.set("A.f3.b", new StringBuilder("true"));
b.set("A.f4.b", new StringBuilder("foo"));
- b.set("A.f5.b", null);
+ b.set("A.f5.b", null);
ps = b.build();
assertObjectEquals("{A:{'f1.b':true,'f2.b':false,'f3.b':true,'f4.b':false}}", ps);
assertInstanceOf(Boolean.class, ps.getProperty("A.f1.b"));
@@ -139,11 +139,11 @@ public class PropertyStoreTest {
public void testInteger() throws Exception {
PropertyStoreBuilder b = PropertyStore.create();
PropertyStore ps = null;
- b.set("A.f1.i", 123);
+ b.set("A.f1.i", 123);
b.set("A.f2.i", "123");
b.set("A.f3.i", new StringBuilder("123"));
b.set("A.f4.i", new StringBuilder("-1"));
- b.set("A.f5.i", null);
+ b.set("A.f5.i", null);
ps = b.build();
assertObjectEquals("{A:{'f1.i':123,'f2.i':123,'f3.i':123,'f4.i':-1}}", ps);
assertInstanceOf(Integer.class, ps.getProperty("A.f1.i"));
@@ -168,8 +168,8 @@ public class PropertyStoreTest {
public void testClass() throws Exception {
PropertyStoreBuilder b = PropertyStore.create();
PropertyStore ps = null;
- b.set("A.f1.c", String.class);
- b.set("A.f2.c", Integer.class);
+ b.set("A.f1.c", String.class);
+ b.set("A.f2.c", Integer.class);
b.set("A.f3.c", null);
ps = b.build();
assertObjectEquals("{A:{'f1.c':'java.lang.String','f2.c':'java.lang.Integer'}}", ps);
@@ -182,7 +182,7 @@ public class PropertyStoreTest {
testError(b, "A.f1.c/add", "foo", "Cannot add value 'foo' (String) to property 'f1.c' (Class).");
testError(b, "A.f1.c/add.123", "foo", "Cannot add value 'foo' (String) to property 'f1.c' (Class).");
testError(b, "A.f1.c/remove", "foo", "Cannot remove value 'foo' (String) from property 'f1.c' (Class).");
-
+
// Do not allow this for security reasons.
testError(b, "A.f1.c", "java.lang.String", "Value 'java.lang.String' (String) cannot be converted to a Class.");
}
@@ -191,11 +191,11 @@ public class PropertyStoreTest {
public void testObject() throws Exception {
PropertyStoreBuilder b = PropertyStore.create();
PropertyStore ps = null;
- b.set("A.f1.o", 123);
+ b.set("A.f1.o", 123);
b.set("A.f2.o", true);
b.set("A.f3.o", new StringBuilder("123"));
b.set("A.f4.o", StringBuilder.class);
- b.set("A.f5.o", null);
+ b.set("A.f5.o", null);
ps = b.build();
assertObjectEquals("{A:{'f1.o':123,'f2.o':true,'f3.o':'123','f4.o':'java.lang.StringBuilder'}}", ps);
assertInstanceOf(Integer.class, ps.getProperty("A.f1.o"));
@@ -214,15 +214,15 @@ public class PropertyStoreTest {
testError(b, "A.f1.o/add.123", "foo", "Cannot add value 'foo' (String) to property 'f1.o' (Object).");
testError(b, "A.f1.o/remove", "foo", "Cannot remove value 'foo' (String) from property 'f1.o' (Object).");
}
-
+
@Test
public void testSetString() throws Exception {
PropertyStoreBuilder b = PropertyStore.create();
PropertyStore ps = null;
- b.set("A.f1.ss", new AList<String>().appendAll("foo", "bar", "bar", null));
- b.set("A.f2.ss", new AList<Object>().appendAll(123, true, TestEnum.ONE, TestEnum.ONE, null));
- b.set("A.f3.ss", new AList<StringBuilder>().appendAll(new StringBuilder("foo"), null));
- b.set("A.f4.ss", "['foo',123,true]");
+ b.set("A.f1.ss", new AList<String>().appendAll("foo", "bar", "bar", null));
+ b.set("A.f2.ss", new AList<>().appendAll(123, true, TestEnum.ONE, TestEnum.ONE, null));
+ b.set("A.f3.ss", new AList<StringBuilder>().appendAll(new StringBuilder("foo"), null));
+ b.set("A.f4.ss", "['foo',123,true]");
b.set("A.f5.ss", null);
ps = b.build();
assertObjectEquals("{A:{'f1.ss':['bar','foo'],'f2.ss':['123','ONE','true'],'f3.ss':['foo'],'f4.ss':['123','foo','true']}}", ps);
@@ -232,41 +232,41 @@ public class PropertyStoreTest {
assertInstanceOf(Set.class, ps.getProperty("A.f4.ss"));
b.clear();
- b.set("A.f1.ss/add", "foo");
+ b.set("A.f1.ss/add", "foo");
assertObjectEquals("{A:{'f1.ss':['foo']}}", b.build());
- b.set("A.f1.ss/remove", "foo");
+ b.set("A.f1.ss/remove", "foo");
assertObjectEquals("{}", b.build());
-
+
b.clear();
- b.set("A.f1.ss/add", "['foo','bar','baz']");
+ b.set("A.f1.ss/add", "['foo','bar','baz']");
b.set("A.f1.ss/add", "qux");
b.addTo("A.f1.ss","quux");
assertObjectEquals("{A:{'f1.ss':['bar','baz','foo','quux','qux']}}", b.build());
- b.set("A.f1.ss/remove", "['foo','bar']");
- b.set("A.f1.ss/remove", "qux");
- b.removeFrom("A.f1.ss", "quux");
+ b.set("A.f1.ss/remove", "['foo','bar']");
+ b.set("A.f1.ss/remove", "qux");
+ b.removeFrom("A.f1.ss", "quux");
assertObjectEquals("{A:{'f1.ss':['baz']}}", b.build());
b.clear();
- b.set("A.f1.ss/add", new AList<String>().appendAll("foo", "bar", "baz"));
+ b.set("A.f1.ss/add", new AList<String>().appendAll("foo", "bar", "baz"));
b.set("A.f1.ss/add", new AList<String>().appendAll("qux"));
b.addTo("A.f1.ss", new AList<String>().appendAll("quux"));
assertObjectEquals("{A:{'f1.ss':['bar','baz','foo','quux','qux']}}", b.build());
- b.set("A.f1.ss/remove", new AList<String>().appendAll("foo", "bar"));
- b.set("A.f1.ss/remove", new AList<String>().appendAll("qux"));
- b.removeFrom("A.f1.ss", new AList<String>().appendAll("quux"));
+ b.set("A.f1.ss/remove", new AList<String>().appendAll("foo", "bar"));
+ b.set("A.f1.ss/remove", new AList<String>().appendAll("qux"));
+ b.removeFrom("A.f1.ss", new AList<String>().appendAll("quux"));
assertObjectEquals("{A:{'f1.ss':['baz']}}", b.build());
b.clear();
- b.set("A.f1.ss/add", new String[]{"foo", "bar", "baz"});
+ b.set("A.f1.ss/add", new String[]{"foo", "bar", "baz"});
b.set("A.f1.ss/add", new String[]{"qux"});
b.addTo("A.f1.ss", new String[]{"quux"});
assertObjectEquals("{A:{'f1.ss':['bar','baz','foo','quux','qux']}}", b.build());
- b.set("A.f1.ss/remove", new String[]{"foo", "bar"});
- b.set("A.f1.ss/remove", new String[]{"qux"});
- b.removeFrom("A.f1.ss", new String[]{"quux"});
+ b.set("A.f1.ss/remove", new String[]{"foo", "bar"});
+ b.set("A.f1.ss/remove", new String[]{"qux"});
+ b.removeFrom("A.f1.ss", new String[]{"quux"});
assertObjectEquals("{A:{'f1.ss':['baz']}}", b.build());
-
+
b.set("A.f1.ss", null);
assertObjectEquals("{}", b.build());
@@ -278,15 +278,15 @@ public class PropertyStoreTest {
assertEquals("Cannot use argument 'foo' on add command for property 'f1.ss' (Set<String>)", e.getMessage());
}
}
-
+
@Test
public void testSetInteger() throws Exception {
PropertyStoreBuilder b = PropertyStore.create();
PropertyStore ps = null;
- b.set("A.f1.si", new AList<Integer>().appendAll(3, 2, 1, null));
- b.set("A.f2.si", new AList<Object>().appendAll(123, "456", null));
- b.set("A.f3.si", new AList<StringBuilder>().appendAll(new StringBuilder("123"), null));
- b.set("A.f4.si", "[1,2,3]");
+ b.set("A.f1.si", new AList<Integer>().appendAll(3, 2, 1, null));
+ b.set("A.f2.si", new AList<>().appendAll(123, "456", null));
+ b.set("A.f3.si", new AList<StringBuilder>().appendAll(new StringBuilder("123"), null));
+ b.set("A.f4.si", "[1,2,3]");
b.set("A.f5.si", null);
ps = b.build();
assertObjectEquals("{A:{'f1.si':[1,2,3],'f2.si':[123,456],'f3.si':[123],'f4.si':[1,2,3]}}", ps);
@@ -296,69 +296,69 @@ public class PropertyStoreTest {
assertInstanceOf(Set.class, ps.getProperty("A.f4.si"));
b.clear();
- b.set("A.f1.si/add", "123");
+ b.set("A.f1.si/add", "123");
assertObjectEquals("{A:{'f1.si':[123]}}", b.build());
- b.set("A.f1.si/remove", "123");
+ b.set("A.f1.si/remove", "123");
assertObjectEquals("{}", b.build());
-
+
b.clear();
- b.set("A.f1.si/add", "['3','2','1']");
+ b.set("A.f1.si/add", "['3','2','1']");
b.set("A.f1.si/add", "4");
b.addTo("A.f1.si", "5");
assertObjectEquals("{A:{'f1.si':[1,2,3,4,5]}}", b.build());
- b.set("A.f1.si/remove", "['1','2']");
- b.set("A.f1.si/remove", "3");
- b.removeFrom("A.f1.si", "4");
+ b.set("A.f1.si/remove", "['1','2']");
+ b.set("A.f1.si/remove", "3");
+ b.removeFrom("A.f1.si", "4");
assertObjectEquals("{A:{'f1.si':[5]}}", b.build());
b.clear();
- b.set("A.f1.si/add", new AList<String>().appendAll("3", "2", "1"));
+ b.set("A.f1.si/add", new AList<String>().appendAll("3", "2", "1"));
b.set("A.f1.si/add", new AList<String>().appendAll("4"));
b.addTo("A.f1.si", new AList<String>().appendAll("5"));
assertObjectEquals("{A:{'f1.si':[1,2,3,4,5]}}", b.build());
- b.set("A.f1.si/remove", new AList<String>().appendAll("1", "2"));
- b.set("A.f1.si/remove", new AList<String>().appendAll("3"));
- b.removeFrom("A.f1.si", new AList<String>().appendAll("4"));
+ b.set("A.f1.si/remove", new AList<String>().appendAll("1", "2"));
+ b.set("A.f1.si/remove", new AList<String>().appendAll("3"));
+ b.removeFrom("A.f1.si", new AList<String>().appendAll("4"));
assertObjectEquals("{A:{'f1.si':[5]}}", b.build());
b.clear();
- b.set("A.f1.si/add", new AList<Integer>().appendAll(1, 2, 3));
+ b.set("A.f1.si/add", new AList<Integer>().appendAll(1, 2, 3));
b.set("A.f1.si/add", new AList<Integer>().appendAll(4));
b.addTo("A.f1.si", new AList<Integer>().appendAll(5));
assertObjectEquals("{A:{'f1.si':[1,2,3,4,5]}}", b.build());
- b.set("A.f1.si/remove", new AList<Integer>().appendAll(1, 2));
- b.set("A.f1.si/remove", new AList<Integer>().appendAll(3));
- b.removeFrom("A.f1.si", new AList<Integer>().appendAll(4));
+ b.set("A.f1.si/remove", new AList<Integer>().appendAll(1, 2));
+ b.set("A.f1.si/remove", new AList<Integer>().appendAll(3));
+ b.removeFrom("A.f1.si", new AList<Integer>().appendAll(4));
assertObjectEquals("{A:{'f1.si':[5]}}", b.build());
b.clear();
- b.set("A.f1.si/add", new String[]{"3", "2", "1"});
+ b.set("A.f1.si/add", new String[]{"3", "2", "1"});
b.set("A.f1.si/add", new String[]{"4"});
b.addTo("A.f1.si", new String[]{"5"});
assertObjectEquals("{A:{'f1.si':[1,2,3,4,5]}}", b.build());
- b.set("A.f1.si/remove", new String[]{"1", "2"});
- b.set("A.f1.si/remove", new String[]{"3"});
- b.removeFrom("A.f1.si", new String[]{"4"});
+ b.set("A.f1.si/remove", new String[]{"1", "2"});
+ b.set("A.f1.si/remove", new String[]{"3"});
+ b.removeFrom("A.f1.si", new String[]{"4"});
assertObjectEquals("{A:{'f1.si':[5]}}", b.build());
-
+
b.clear();
- b.set("A.f1.si/add", new Integer[]{3, 2, 1});
+ b.set("A.f1.si/add", new Integer[]{3, 2, 1});
b.set("A.f1.si/add", new Integer[]{4});
b.addTo("A.f1.si", new Integer[]{5});
assertObjectEquals("{A:{'f1.si':[1,2,3,4,5]}}", b.build());
- b.set("A.f1.si/remove", new Integer[]{1, 2});
- b.set("A.f1.si/remove", new Integer[]{3});
- b.removeFrom("A.f1.si", new Integer[]{4});
+ b.set("A.f1.si/remove", new Integer[]{1, 2});
+ b.set("A.f1.si/remove", new Integer[]{3});
+ b.removeFrom("A.f1.si", new Integer[]{4});
assertObjectEquals("{A:{'f1.si':[5]}}", b.build());
b.clear();
- b.set("A.f1.si/add", new int[]{3, 2, 1});
+ b.set("A.f1.si/add", new int[]{3, 2, 1});
b.set("A.f1.si/add", new int[]{4});
b.addTo("A.f1.si", new int[]{5});
assertObjectEquals("{A:{'f1.si':[1,2,3,4,5]}}", b.build());
- b.set("A.f1.si/remove", new int[]{1, 2});
- b.set("A.f1.si/remove", new int[]{3});
- b.removeFrom("A.f1.si", new int[]{4});
+ b.set("A.f1.si/remove", new int[]{1, 2});
+ b.set("A.f1.si/remove", new int[]{3});
+ b.removeFrom("A.f1.si", new int[]{4});
assertObjectEquals("{A:{'f1.si':[5]}}", b.build());
b.set("A.f1.si", null);
@@ -372,13 +372,13 @@ public class PropertyStoreTest {
assertEquals("Cannot use argument 'foo' on add command for property 'f1.si' (Set<Integer>)", e.getMessage());
}
}
-
+
@Test
public void testSetClass() throws Exception {
PropertyStoreBuilder b = PropertyStore.create();
PropertyStore ps = null;
- b.set("A.f1.sc", new AList<Class<?>>().appendAll(String.class, Integer.class, null));
- b.set("A.f2.sc", new AList<Object>().appendAll(String.class, Integer.class, null));
+ b.set("A.f1.sc", new AList<Class<?>>().appendAll(String.class, Integer.class, null));
+ b.set("A.f2.sc", new AList<>().appendAll(String.class, Integer.class, null));
b.set("A.f3.sc", null);
ps = b.build();
assertObjectEquals("{A:{'f1.sc':['java.lang.Integer','java.lang.String'],'f2.sc':['java.lang.Integer','java.lang.String']}}", ps);
@@ -387,46 +387,46 @@ public class PropertyStoreTest {
assertInstanceOf(Class.class, ((Set<?>)ps.getProperty("A.f1.sc")).iterator().next());
b.clear();
- b.set("A.f1.sc/add", Integer.class);
+ b.set("A.f1.sc/add", Integer.class);
b.addTo("A.f1.sc", String.class);
assertObjectEquals("{A:{'f1.sc':['java.lang.Integer','java.lang.String']}}", b.build());
- b.set("A.f1.sc/remove", Integer.class);
+ b.set("A.f1.sc/remove", Integer.class);
assertObjectEquals("{A:{'f1.sc':['java.lang.String']}}", b.build());
-
+
b.clear();
- testError(b, "A.f1.sc/add", "['java.lang.Integer']", "Cannot add value '[\\'java.lang.Integer\\']' (String) to property 'f1.sc' (Set<Class>). Value 'java.lang.Integer' (String) cannot be converted to a Class.");
+ testError(b, "A.f1.sc/add", "['java.lang.Integer']", "Cannot add value '[\\'java.lang.Integer\\']' (String) to property 'f1.sc' (Set<Class>). Value 'java.lang.Integer' (String) cannot be converted to a Class.");
testError(b, "A.f1.sc/add", "java.lang.Integer", "Cannot add value 'java.lang.Integer' (String) to property 'f1.sc' (Set<Class>). Value 'java.lang.Integer' (String) cannot be converted to a Class.");
b.clear();
- b.set("A.f1.sc/add", new AList<Class<?>>().appendAll(Integer.class, String.class));
+ b.set("A.f1.sc/add", new AList<Class<?>>().appendAll(Integer.class, String.class));
b.set("A.f1.sc/add", new AList<Class<?>>().appendAll(Map.class));
b.addTo("A.f1.sc", new AList<Class<?>>().appendAll(List.class));
assertObjectEquals("{A:{'f1.sc':['java.lang.Integer','java.lang.String','java.util.List','java.util.Map']}}", b.build());
- b.set("A.f1.sc/remove", new AList<Class<?>>().appendAll(Integer.class, String.class));
- b.removeFrom("A.f1.sc", new AList<Class<?>>().appendAll());
- b.removeFrom("A.f1.sc", new AList<Class<?>>().appendAll(List.class));
+ b.set("A.f1.sc/remove", new AList<Class<?>>().appendAll(Integer.class, String.class));
+ b.removeFrom("A.f1.sc", new AList<Class<?>>().appendAll());
+ b.removeFrom("A.f1.sc", new AList<Class<?>>().appendAll(List.class));
assertObjectEquals("{A:{'f1.sc':['java.util.Map']}}", b.build());
b.clear();
- b.set("A.f1.sc/add", new AList<Object>().appendAll(Integer.class, String.class));
- b.set("A.f1.sc/add", new AList<Object>().appendAll(Map.class));
- b.addTo("A.f1.sc", new AList<Object>().appendAll(List.class));
+ b.set("A.f1.sc/add", new AList<>().appendAll(Integer.class, String.class));
+ b.set("A.f1.sc/add", new AList<>().appendAll(Map.class));
+ b.addTo("A.f1.sc", new AList<>().appendAll(List.class));
assertObjectEquals("{A:{'f1.sc':['java.lang.Integer','java.lang.String','java.util.List','java.util.Map']}}", b.build());
- b.set("A.f1.sc/remove", new AList<Object>().appendAll(Integer.class, String.class));
- b.set("A.f1.sc/remove", new AList<Object>().appendAll());
- b.removeFrom("A.f1.sc", new AList<Object>().appendAll(List.class));
+ b.set("A.f1.sc/remove", new AList<>().appendAll(Integer.class, String.class));
+ b.set("A.f1.sc/remove", new AList<>().appendAll());
+ b.removeFrom("A.f1.sc", new AList<>().appendAll(List.class));
assertObjectEquals("{A:{'f1.sc':['java.util.Map']}}", b.build());
b.clear();
- b.set("A.f1.sc/add", new Class<?>[]{Integer.class, String.class});
+ b.set("A.f1.sc/add", new Class<?>[]{Integer.class, String.class});
b.set("A.f1.sc/add", new Class<?>[]{Map.class});
b.addTo("A.f1.sc", new Class<?>[]{List.class});
assertObjectEquals("{A:{'f1.sc':['java.lang.Integer','java.lang.String','java.util.List','java.util.Map']}}", b.build());
- b.set("A.f1.sc/remove", new Class<?>[]{Integer.class, String.class});
- b.set("A.f1.sc/remove", new Class<?>[]{});
- b.removeFrom("A.f1.sc", new Class<?>[]{List.class});
+ b.set("A.f1.sc/remove", new Class<?>[]{Integer.class, String.class});
+ b.set("A.f1.sc/remove", new Class<?>[]{});
+ b.removeFrom("A.f1.sc", new Class<?>[]{List.class});
assertObjectEquals("{A:{'f1.sc':['java.util.Map']}}", b.build());
-
+
b.set("A.f1.sc", null);
assertObjectEquals("{}", b.build());
@@ -437,16 +437,16 @@ public class PropertyStoreTest {
} catch (Exception e) {
assertEquals("Cannot use argument 'foo' on add command for property 'f1.sc' (Set<Class>)", e.getMessage());
}
- }
-
+ }
+
@Test
public void testListString() throws Exception {
PropertyStoreBuilder b = PropertyStore.create();
PropertyStore ps = null;
- b.set("A.f1.ls", new AList<String>().appendAll("foo", "bar", "bar", null));
- b.set("A.f2.ls", new AList<Object>().appendAll(123, true, TestEnum.ONE, TestEnum.ONE, null));
- b.set("A.f3.ls", new AList<StringBuilder>().appendAll(new StringBuilder("foo"), null));
- b.set("A.f4.ls", "['foo',123,true]");
+ b.set("A.f1.ls", new AList<String>().appendAll("foo", "bar", "bar", null));
+ b.set("A.f2.ls", new AList<>().appendAll(123, true, TestEnum.ONE, TestEnum.ONE, null));
+ b.set("A.f3.ls", new AList<StringBuilder>().appendAll(new StringBuilder("foo"), null));
+ b.set("A.f4.ls", "['foo',123,true]");
b.set("A.f5.ls", null);
ps = b.build();
assertObjectEquals("{A:{'f1.ls':['foo','bar'],'f2.ls':['123','true','ONE'],'f3.ls':['foo'],'f4.ls':['foo','123','true']}}", ps);
@@ -456,54 +456,54 @@ public class PropertyStoreTest {
assertInstanceOf(List.class, ps.getProperty("A.f4.ls"));
b.clear();
- b.set("A.f1.ls/add", "foo");
+ b.set("A.f1.ls/add", "foo");
assertObjectEquals("{A:{'f1.ls':['foo']}}", b.build());
- b.set("A.f1.ls/remove", "foo");
+ b.set("A.f1.ls/remove", "foo");
assertObjectEquals("{}", b.build());
-
+
b.clear();
- b.set("A.f1.ls/add", "['foo','bar','baz']");
+ b.set("A.f1.ls/add", "['foo','bar','baz']");
b.set("A.f1.ls/add", "qux");
b.addTo("A.f1.ls","quux");
assertObjectEquals("{A:{'f1.ls':['quux','qux','foo','bar','baz']}}", b.build());
- b.set("A.f1.ls/remove", "['foo','bar']");
- b.set("A.f1.ls/remove", "qux");
- b.removeFrom("A.f1.ls", "quux");
+ b.set("A.f1.ls/remove", "['foo','bar']");
+ b.set("A.f1.ls/remove", "qux");
+ b.removeFrom("A.f1.ls", "quux");
assertObjectEquals("{A:{'f1.ls':['baz']}}", b.build());
b.clear();
- b.set("A.f1.ls/add", new AList<String>().appendAll("foo", "bar", "baz"));
+ b.set("A.f1.ls/add", new AList<String>().appendAll("foo", "bar", "baz"));
b.set("A.f1.ls/add", new AList<String>().appendAll("qux"));
b.addTo("A.f1.ls", new AList<String>().appendAll("quux"));
assertObjectEquals("{A:{'f1.ls':['quux','qux','foo','bar','baz']}}", b.build());
- b.set("A.f1.ls/remove", new AList<String>().appendAll("foo", "bar"));
- b.set("A.f1.ls/remove", new AList<String>().appendAll("qux"));
- b.removeFrom("A.f1.ls", new AList<String>().appendAll("quux"));
+ b.set("A.f1.ls/remove", new AList<String>().appendAll("foo", "bar"));
+ b.set("A.f1.ls/remove", new AList<String>().appendAll("qux"));
+ b.removeFrom("A.f1.ls", new AList<String>().appendAll("quux"));
assertObjectEquals("{A:{'f1.ls':['baz']}}", b.build());
b.clear();
- b.set("A.f1.ls/add", new String[]{"foo", "bar", "baz"});
+ b.set("A.f1.ls/add", new String[]{"foo", "bar", "baz"});
b.set("A.f1.ls/add", new String[]{"qux"});
b.addTo("A.f1.ls", new String[]{"quux"});
assertObjectEquals("{A:{'f1.ls':['quux','qux','foo','bar','baz']}}", b.build());
- b.set("A.f1.ls/remove", new String[]{"foo", "bar"});
- b.set("A.f1.ls/remove", new String[]{"qux"});
- b.removeFrom("A.f1.ls", new String[]{"quux"});
+ b.set("A.f1.ls/remove", new String[]{"foo", "bar"});
+ b.set("A.f1.ls/remove", new String[]{"qux"});
+ b.removeFrom("A.f1.ls", new String[]{"quux"});
assertObjectEquals("{A:{'f1.ls':['baz']}}", b.build());
-
+
b.set("A.f1.ls", null);
assertObjectEquals("{}", b.build());
b.clear();
- b.set("A.f1.ls/add", "['foo','bar','baz']");
+ b.set("A.f1.ls/add", "['foo','bar','baz']");
b.set("A.f1.ls/add.10", "qux");
b.set("A.f1.ls/add.1", "quux");
b.set("A.f1.ls/add.0", "quuux");
b.set("A.f1.ls/add.-10", "quuuux");
assertObjectEquals("{A:{'f1.ls':['quuuux','quuux','foo','quux','bar','baz','qux']}}", b.build());
- b.set("A.f1.ls/add.1", "['1','2']");
+ b.set("A.f1.ls/add.1", "['1','2']");
assertObjectEquals("{A:{'f1.ls':['quuuux','1','2','quuux','foo','quux','bar','baz','qux']}}", b.build());
-
+
testError(b, "A.f1.ls/add.foo", "foo", "Invalid argument 'foo' on add command for property 'f1.ls' (List<String>)");
try {
b.addTo("A.f1.ls", "foo", "bar");
@@ -512,15 +512,15 @@ public class PropertyStoreTest {
assertEquals("Invalid argument 'foo' on add command for property 'f1.ls' (List<String>)", e.getMessage());
}
}
-
+
@Test
public void testListInteger() throws Exception {
PropertyStoreBuilder b = PropertyStore.create();
PropertyStore ps = null;
- b.set("A.f1.li", new AList<Integer>().appendAll(1, 2, 3, null));
- b.set("A.f2.li", new AList<Object>().appendAll(123, "456", null));
- b.set("A.f3.li", new AList<StringBuilder>().appendAll(new StringBuilder("123"), null));
- b.set("A.f4.li", "[1,2,3]");
+ b.set("A.f1.li", new AList<Integer>().appendAll(1, 2, 3, null));
+ b.set("A.f2.li", new AList<>().appendAll(123, "456", null));
+ b.set("A.f3.li", new AList<StringBuilder>().appendAll(new StringBuilder("123"), null));
+ b.set("A.f4.li", "[1,2,3]");
b.set("A.f5.li", null);
ps = b.build();
assertObjectEquals("{A:{'f1.li':[1,2,3],'f2.li':[123,456],'f3.li':[123],'f4.li':[1,2,3]}}", ps);
@@ -530,82 +530,82 @@ public class PropertyStoreTest {
assertInstanceOf(List.class, ps.getProperty("A.f4.li"));
b.clear();
- b.set("A.f1.li/add", "123");
+ b.set("A.f1.li/add", "123");
assertObjectEquals("{A:{'f1.li':[123]}}", b.build());
- b.set("A.f1.li/remove", "123");
+ b.set("A.f1.li/remove", "123");
assertObjectEquals("{}", b.build());
-
+
b.clear();
- b.set("A.f1.li/add", "['1','2','3']");
+ b.set("A.f1.li/add", "['1','2','3']");
b.set("A.f1.li/add", "4");
b.addTo("A.f1.li", "5");
assertObjectEquals("{A:{'f1.li':[5,4,1,2,3]}}", b.build());
- b.set("A.f1.li/remove", "['1','2']");
- b.set("A.f1.li/remove", "3");
- b.removeFrom("A.f1.li", "4");
+ b.set("A.f1.li/remove", "['1','2']");
+ b.set("A.f1.li/remove", "3");
+ b.removeFrom("A.f1.li", "4");
assertObjectEquals("{A:{'f1.li':[5]}}", b.build());
b.clear();
- b.set("A.f1.li/add", new AList<String>().appendAll("1", "2", "3"));
+ b.set("A.f1.li/add", new AList<String>().appendAll("1", "2", "3"));
b.set("A.f1.li/add", new AList<String>().appendAll("4"));
b.addTo("A.f1.li", new AList<String>().appendAll("5"));
assertObjectEquals("{A:{'f1.li':[5,4,1,2,3]}}", b.build());
- b.set("A.f1.li/remove", new AList<String>().appendAll("1", "2"));
- b.set("A.f1.li/remove", new AList<String>().appendAll("3"));
- b.removeFrom("A.f1.li", new AList<String>().appendAll("4"));
+ b.set("A.f1.li/remove", new AList<String>().appendAll("1", "2"));
+ b.set("A.f1.li/remove", new AList<String>().appendAll("3"));
+ b.removeFrom("A.f1.li", new AList<String>().appendAll("4"));
assertObjectEquals("{A:{'f1.li':[5]}}", b.build());
b.clear();
- b.set("A.f1.li/add", new AList<Integer>().appendAll(1, 2, 3));
+ b.set("A.f1.li/add", new AList<Integer>().appendAll(1, 2, 3));
b.set("A.f1.li/add", new AList<Integer>().appendAll(4));
b.addTo("A.f1.li", new AList<Integer>().appendAll(5));
assertObjectEquals("{A:{'f1.li':[5,4,1,2,3]}}", b.build());
- b.set("A.f1.li/remove", new AList<Integer>().appendAll(1, 2));
- b.set("A.f1.li/remove", new AList<Integer>().appendAll(3));
- b.removeFrom("A.f1.li", new AList<Integer>().appendAll(4));
+ b.set("A.f1.li/remove", new AList<Integer>().appendAll(1, 2));
+ b.set("A.f1.li/remove", new AList<Integer>().appendAll(3));
+ b.removeFrom("A.f1.li", new AList<Integer>().appendAll(4));
assertObjectEquals("{A:{'f1.li':[5]}}", b.build());
b.clear();
- b.set("A.f1.li/add", new String[]{"1", "2", "3"});
+ b.set("A.f1.li/add", new String[]{"1", "2", "3"});
b.set("A.f1.li/add", new String[]{"4"});
b.addTo("A.f1.li", new String[]{"5"});
assertObjectEquals("{A:{'f1.li':[5,4,1,2,3]}}", b.build());
- b.set("A.f1.li/remove", new String[]{"1", "2"});
- b.set("A.f1.li/remove", new String[]{"3"});
- b.removeFrom("A.f1.li", new String[]{"4"});
+ b.set("A.f1.li/remove", new String[]{"1", "2"});
+ b.set("A.f1.li/remove", new String[]{"3"});
+ b.removeFrom("A.f1.li", new String[]{"4"});
assertObjectEquals("{A:{'f1.li':[5]}}", b.build());
-
+
b.clear();
- b.set("A.f1.li/add", new Integer[]{1, 2, 3});
+ b.set("A.f1.li/add", new Integer[]{1, 2, 3});
b.set("A.f1.li/add", new Integer[]{4});
b.addTo("A.f1.li", new Integer[]{5});
assertObjectEquals("{A:{'f1.li':[5,4,1,2,3]}}", b.build());
- b.set("A.f1.li/remove", new Integer[]{1, 2});
- b.set("A.f1.li/remove", new Integer[]{3});
- b.removeFrom("A.f1.li", new Integer[]{4});
+ b.set("A.f1.li/remove", new Integer[]{1, 2});
+ b.set("A.f1.li/remove", new Integer[]{3});
+ b.removeFrom("A.f1.li", new Integer[]{4});
assertObjectEquals("{A:{'f1.li':[5]}}", b.build());
b.clear();
- b.set("A.f1.li/add", new int[]{1, 2, 3});
+ b.set("A.f1.li/add", new int[]{1, 2, 3});
b.set("A.f1.li/add", new int[]{4});
b.addTo("A.f1.li", new int[]{5});
assertObjectEquals("{A:{'f1.li':[5,4,1,2,3]}}", b.build());
- b.set("A.f1.li/remove", new int[]{1, 2});
- b.set("A.f1.li/remove", new int[]{3});
- b.removeFrom("A.f1.li", new int[]{4});
+ b.set("A.f1.li/remove", new int[]{1, 2});
+ b.set("A.f1.li/remove", new int[]{3});
+ b.removeFrom("A.f1.li", new int[]{4});
assertObjectEquals("{A:{'f1.li':[5]}}", b.build());
b.set("A.f1.li", null);
assertObjectEquals("{}", b.build());
b.clear();
- b.set("A.f1.ls/add", "['1','2','3']");
+ b.set("A.f1.ls/add", "['1','2','3']");
b.set("A.f1.ls/add.10", "4");
b.set("A.f1.ls/add.1", "5");
b.set("A.f1.ls/add.0", "6");
b.set("A.f1.ls/add.-10", "7");
assertObjectEquals("{A:{'f1.ls':['7','6','1','5','2','3','4']}}", b.build());
- b.set("A.f1.ls/add.1", "['8','9']");
+ b.set("A.f1.ls/add.1", "['8','9']");
assertObjectEquals("{A:{'f1.ls':['7','8','9','6','1','5','2','3','4']}}", b.build());
testError(b, "A.f1.li/add.123", "foo", "Cannot add value 'foo' (String) to property 'f1.li' (List<Integer>). Value 'foo' (String) cannot be converted to an Integer.");
@@ -616,13 +616,13 @@ public class PropertyStoreTest {
assertEquals("Invalid argument 'foo' on add command for property 'f1.li' (List<Integer>)", e.getMessage());
}
}
-
+
@Test
public void testListClass() throws Exception {
PropertyStoreBuilder b = PropertyStore.create();
PropertyStore ps = null;
- b.set("A.f1.lc", new AList<Class<?>>().appendAll(String.class, Integer.class, null));
- b.set("A.f2.lc", new AList<Object>().appendAll(String.class, Integer.class, null));
+ b.set("A.f1.lc", new AList<Class<?>>().appendAll(String.class, Integer.class, null));
+ b.set("A.f2.lc", new AList<>().appendAll(String.class, Integer.class, null));
b.set("A.f3.lc", null);
ps = b.build();
assertObjectEquals("{A:{'f1.lc':['java.lang.String','java.lang.Integer'],'f2.lc':['java.lang.String','java.lang.Integer']}}", ps);
@@ -630,51 +630,51 @@ public class PropertyStoreTest {
assertInstanceOf(List.class, ps.getProperty("A.f2.lc"));
b.clear();
- b.set("A.f1.lc/add", Integer.class);
+ b.set("A.f1.lc/add", Integer.class);
b.addTo("A.f1.lc", String.class);
assertObjectEquals("{A:{'f1.lc':['java.lang.String','java.lang.Integer']}}", b.build());
- b.set("A.f1.lc/remove", Integer.class);
+ b.set("A.f1.lc/remove", Integer.class);
assertObjectEquals("{A:{'f1.lc':['java.lang.String']}}", b.build());
-
+
b.clear();
- testError(b, "A.f1.lc/add", "['java.lang.Integer']", "Cannot add value '[\\'java.lang.Integer\\']' (String) to property 'f1.lc' (List<Class>). Value 'java.lang.Integer' (String) cannot be converted to a Class.");
+ testError(b, "A.f1.lc/add", "['java.lang.Integer']", "Cannot add value '[\\'java.lang.Integer\\']' (String) to property 'f1.lc' (List<Class>). Value 'java.lang.Integer' (String) cannot be converted to a Class.");
testError(b, "A.f1.lc/add", "java.lang.Integer", "Cannot add value 'java.lang.Integer' (String) to property 'f1.lc' (List<Class>). Value 'java.lang.Integer' (String) cannot be converted to a Class.");
b.clear();
- b.set("A.f1.lc/add", AList.<Class<?>>create(Integer.class, String.class));
+ b.set("A.f1.lc/add", AList.<Class<?>>create(Integer.class, String.class));
b.set("A.f1.lc/add", new AList<Class<?>>().appendAll(Map.class));
b.addTo("A.f1.lc", new AList<Class<?>>().appendAll(List.class));
assertObjectEquals("{A:{'f1.lc':['java.util.List','java.util.Map','java.lang.Integer','java.lang.String']}}", b.build());
- b.set("A.f1.lc/remove", new AList<Class<?>>().appendAll(Integer.class, String.class));
- b.removeFrom("A.f1.lc", new AList<Class<?>>().appendAll());
- b.removeFrom("A.f1.lc", new AList<Class<?>>().appendAll(List.class));
+ b.set("A.f1.lc/remove", new AList<Class<?>>().appendAll(Integer.class, String.class));
+ b.removeFrom("A.f1.lc", new AList<Class<?>>().appendAll());
+ b.removeFrom("A.f1.lc", new AList<Class<?>>().appendAll(List.class));
assertObjectEquals("{A:{'f1.lc':['java.util.Map']}}", b.build());
b.clear();
- b.set("A.f1.lc/add", new AList<Object>().appendAll(Integer.class, String.class));
- b.set("A.f1.lc/add", new AList<Object>().appendAll(Map.class));
- b.addTo("A.f1.lc", new AList<Object>().appendAll(List.class));
+ b.set("A.f1.lc/add", new AList<>().appendAll(Integer.class, String.class));
+ b.set("A.f1.lc/add", new AList<>().appendAll(Map.class));
+ b.addTo("A.f1.lc", new AList<>().appendAll(List.class));
assertObjectEquals("{A:{'f1.lc':['java.util.List','java.util.Map','java.lang.Integer','java.lang.String']}}", b.build());
- b.set("A.f1.lc/remove", new AList<Object>().appendAll(Integer.class, String.class));
- b.set("A.f1.lc/remove", new AList<Object>().appendAll());
- b.removeFrom("A.f1.lc", new AList<Object>().appendAll(List.class));
+ b.set("A.f1.lc/remove", new AList<>().appendAll(Integer.class, String.class));
+ b.set("A.f1.lc/remove", new AList<>().appendAll());
+ b.removeFrom("A.f1.lc", new AList<>().appendAll(List.class));
assertObjectEquals("{A:{'f1.lc':['java.util.Map']}}", b.build());
b.clear();
- b.set("A.f1.lc/add", new Class<?>[]{Integer.class, String.class});
+ b.set("A.f1.lc/add", new Class<?>[]{Integer.class, String.class});
b.set("A.f1.lc/add", new Class<?>[]{Map.class});
b.addTo("A.f1.lc", new Class<?>[]{List.class});
assertObjectEquals("{A:{'f1.lc':['java.util.List','java.util.Map','java.lang.Integer','java.lang.String']}}", b.build());
- b.set("A.f1.lc/remove", new Class<?>[]{Integer.class, String.class});
- b.set("A.f1.lc/remove", new Class<?>[]{});
- b.removeFrom("A.f1.lc", new Class<?>[]{List.class});
+ b.set("A.f1.lc/remove", new Class<?>[]{Integer.class, String.class});
+ b.set("A.f1.lc/remove", new Class<?>[]{});
+ b.removeFrom("A.f1.lc", new Class<?>[]{List.class});
assertObjectEquals("{A:{'f1.lc':['java.util.Map']}}", b.build());
-
+
b.set("A.f1.lc", null);
assertObjectEquals("{}", b.build());
b.clear();
- b.set("A.f1.lc/add", String.class);
+ b.set("A.f1.lc/add", String.class);
b.set("A.f1.lc/add.10", Integer.class);
b.set("A.f1.lc/add.1", Map.class);
b.set("A.f1.lc/add.0", List.class);
@@ -689,13 +689,13 @@ public class PropertyStoreTest {
assertEquals("Invalid argument 'foo' on add command for property 'f1.lc' (List<Class>)", e.getMessage());
}
}
-
+
@Test
public void testListObject() throws Exception {
PropertyStoreBuilder b = PropertyStore.create();
PropertyStore ps = null;
- b.set("A.f1.lo", new AList<Class<?>>().appendAll(StringBuilder.class, null));
- b.set("A.f2.lo", new AList<Object>().appendAll(123, true, new StringBuilder(123), StringBuilder.class, null));
+ b.set("A.f1.lo", new AList<Class<?>>().appendAll(StringBuilder.class, null));
+ b.set("A.f2.lo", new AList<>().appendAll(123, true, new StringBuilder(123), StringBuilder.class, null));
b.set("A.f3.lo", null);
ps = b.build();
assertObjectEquals("{A:{'f1.lo':['java.lang.StringBuilder'],'f2.lo':[123,true,'','java.lang.StringBuilder']}}", ps);
@@ -706,49 +706,49 @@ public class PropertyStoreTest {
assertInstanceOf(Boolean.class, ((List<?>)ps.getProperty("A.f2.lo")).get(1));
assertInstanceOf(StringBuilder.class, ((List<?>)ps.getProperty("A.f2.lo")).get(2));
assertInstanceOf(Class.class, ((List<?>)ps.getProperty("A.f2.lo")).get(3));
-
+
b.clear();
- b.set("A.f1.lo/add", 1);
+ b.set("A.f1.lo/add", 1);
b.addTo("A.f1.lo", 2);
assertObjectEquals("{A:{'f1.lo':[2,1]}}", b.build());
- b.set("A.f1.lo/remove", 1);
+ b.set("A.f1.lo/remove", 1);
assertObjectEquals("{A:{'f1.lo':[2]}}", b.build());
-
+
b.clear();
- b.set("A.f1.lo/add", new AList<Class<?>>().appendAll(StringBuilder.class));
+ b.set("A.f1.lo/add", new AList<Class<?>>().appendAll(StringBuilder.class));
b.set("A.f1.lo/add", new AList<Class<?>>().appendAll(HashMap.class));
b.addTo("A.f1.lo", new AList<Class<?>>().appendAll(LinkedList.class));
assertObjectEquals("{A:{'f1.lo':['java.util.LinkedList','java.util.HashMap','java.lang.StringBuilder']}}", b.build());
- b.set("A.f1.lo/remove", new AList<Class<?>>().appendAll(HashMap.class));
- b.removeFrom("A.f1.lo", new AList<Class<?>>().appendAll());
- b.removeFrom("A.f1.lo", new AList<Class<?>>().appendAll(LinkedList.class));
+ b.set("A.f1.lo/remove", new AList<Class<?>>().appendAll(HashMap.class));
+ b.removeFrom("A.f1.lo", new AList<Class<?>>().appendAll());
+ b.removeFrom("A.f1.lo", new AList<Class<?>>().appendAll(LinkedList.class));
assertObjectEquals("{A:{'f1.lo':['java.lang.StringBuilder']}}", b.build());
b.clear();
- b.set("A.f1.lo/add", new AList<Object>().appendAll(StringBuilder.class));
- b.set("A.f1.lo/add", new AList<Object>().appendAll(HashMap.class));
- b.addTo("A.f1.lo", new AList<Object>().appendAll(LinkedList.class));
+ b.set("A.f1.lo/add", new AList<>().appendAll(StringBuilder.class));
+ b.set("A.f1.lo/add", new AList<>().appendAll(HashMap.class));
+ b.addTo("A.f1.lo", new AList<>().appendAll(LinkedList.class));
assertObjectEquals("{A:{'f1.lo':['java.util.LinkedList','java.util.HashMap','java.lang.StringBuilder']}}", b.build());
- b.set("A.f1.lo/remove", new AList<Object>().appendAll(HashMap.class));
- b.set("A.f1.lo/remove", new AList<Object>().appendAll());
- b.removeFrom("A.f1.lo", new AList<Object>().appendAll(LinkedList.class));
+ b.set("A.f1.lo/remove", new AList<>().appendAll(HashMap.class));
+ b.set("A.f1.lo/remove", new AList<>().appendAll());
+ b.removeFrom("A.f1.lo", new AList<>().appendAll(LinkedList.class));
assertObjectEquals("{A:{'f1.lo':['java.lang.StringBuilder']}}", b.build());
b.clear();
- b.set("A.f1.lo/add", new Class<?>[]{StringBuilder.class});
+ b.set("A.f1.lo/add", new Class<?>[]{StringBuilder.class});
b.set("A.f1.lo/add", new Class<?>[]{HashMap.class});
b.addTo("A.f1.lo", new Class<?>[]{LinkedList.class});
assertObjectEquals("{A:{'f1.lo':['java.util.LinkedList','java.util.HashMap','java.lang.StringBuilder']}}", b.build());
- b.set("A.f1.lo/remove", new Class<?>[]{HashMap.class});
- b.set("A.f1.lo/remove", new Class<?>[]{});
- b.removeFrom("A.f1.lo", new Class<?>[]{LinkedList.class});
+ b.set("A.f1.lo/remove", new Class<?>[]{HashMap.class});
+ b.set("A.f1.lo/remove", new Class<?>[]{});
+ b.removeFrom("A.f1.lo", new Class<?>[]{LinkedList.class});
assertObjectEquals("{A:{'f1.lo':['java.lang.StringBuilder']}}", b.build());
-
+
b.set("A.f1.lo", null);
assertObjectEquals("{}", b.build());
b.clear();
- b.set("A.f1.lo/add", StringBuilder.class);
+ b.set("A.f1.lo/add", StringBuilder.class);
b.set("A.f1.lo/add.10", HashMap.class);
b.set("A.f1.lo/add.1", LinkedList.class);
b.set("A.f1.lo/add.0", TestEnum.ONE);
@@ -762,15 +762,15 @@ public class PropertyStoreTest {
assertEquals("Invalid argument 'foo' on add command for property 'f1.lo' (List<Object>)", e.getMessage());
}
}
-
+
@Test
public void testMapString() throws Exception {
PropertyStoreBuilder b = PropertyStore.create();
PropertyStore ps = null;
- b.set("A.f1.sms", new AMap<String,String>().append("foo", "bar").append("baz", "qux").append("quux", null).append(null, null));
- b.set("A.f2.sms", new AMap<String,Object>().append("foo", 123).append("bar", true).append("baz", TestEnum.ONE).append("qux", null));
- b.set("A.f3.sms", new AMap<String,StringBuilder>().append("foo", new StringBuilder("bar")).append("baz", null));
- b.set("A.f4.sms", "{foo:'bar',baz:123,qux:true}");
+ b.set("A.f1.sms", new AMap<String,String>().append("foo", "bar").append("baz", "qux").append("quux", null).append(null, null));
+ b.set("A.f2.sms", new AMap<String,Object>().append("foo", 123).append("bar", true).append("baz", TestEnum.ONE).append("qux", null));
+ b.set("A.f3.sms", new AMap<String,StringBuilder>().append("foo", new StringBuilder("bar")).append("baz", null));
+ b.set("A.f4.sms", "{foo:'bar',baz:123,qux:true}");
b.set("A.f5.sms", null);
ps = b.build();
assertObjectEquals("{A:{'f1.sms':{baz:'qux',foo:'bar'},'f2.sms':{bar:'true',baz:'ONE',foo:'123'},'f3.sms':{foo:'bar'},'f4.sms':{baz:'123',foo:'bar',qux:'true'}}}", ps);
@@ -780,19 +780,19 @@ public class PropertyStoreTest {
assertInstanceOf(Map.class, ps.getProperty("A.f4.sms"));
b.clear();
- b.set("A.f1.sms/add", "{foo:'bar'}");
+ b.set("A.f1.sms/add", "{foo:'bar'}");
assertObjectEquals("{A:{'f1.sms':{foo:'bar'}}}", b.build());
-
+
b.clear();
- b.set("A.f1.sms/add.foo", "bar");
+ b.set("A.f1.sms/add.foo", "bar");
assertObjectEquals("{A:{'f1.sms':{foo:'bar'}}}", b.build());
- b.set("A.f1.sms/add.foo", null);
+ b.set("A.f1.sms/add.foo", null);
assertObjectEquals("{}", b.build());
b.clear();
b.set("A.f1.sms", null);
assertObjectEquals("{}", b.build());
-
+
b.clear();
b.set("A.f1.sms", "{foo:'bar'}");
testError(b, "A.f1.sms/remove", "foo", "Cannot remove value 'foo' (String) from property 'f1.sms' (Map<String,String>).");
@@ -803,15 +803,15 @@ public class PropertyStoreTest {
assertEquals("Cannot remove value 'foo' (String) from property 'f1.sms' (Map<String,String>).", e.getMessage());
}
}
-
+
@Test
public void testMapInteger() throws Exception {
PropertyStoreBuilder b = PropertyStore.create();
PropertyStore ps = null;
- b.set("A.f1.smi", new AMap<String,String>().append("foo", "1").append("baz", "2").append("quux", null).append(null, null));
- b.set("A.f2.smi", new AMap<String,Object>().append("foo", 123).append("bar", "456").append("baz", null));
- b.set("A.f3.smi", new AMap<String,StringBuilder>().append("foo", new StringBuilder("123")).append("baz", null));
- b.set("A.f4.smi", "{foo:'123',baz:456,qux:null}");
+ b.set("A.f1.smi", new AMap<String,String>().append("foo", "1").append("baz", "2").append("quux", null).append(null, null));
+ b.set("A.f2.smi", new AMap<String,Object>().append("foo", 123).append("bar", "456").append("baz", null));
+ b.set("A.f3.smi", new AMap<String,StringBuilder>().append("foo", new StringBuilder("123")).append("baz", null));
+ b.set("A.f4.smi", "{foo:'123',baz:456,qux:null}");
b.set("A.f5.smi", null);
ps = b.build();
assertObjectEquals("{A:{'f1.smi':{baz:2,foo:1},'f2.smi':{bar:456,foo:123},'f3.smi':{foo:123},'f4.smi':{baz:456,foo:123}}}", ps);
@@ -821,19 +821,19 @@ public class PropertyStoreTest {
assertInstanceOf(Map.class, ps.getProperty("A.f4.smi"));
b.clear();
- b.set("A.f1.smi/add", "{foo:'123'}");
+ b.set("A.f1.smi/add", "{foo:'123'}");
assertObjectEquals("{A:{'f1.smi':{foo:123}}}", b.build());
-
+
b.clear();
- b.set("A.f1.smi/add.foo", "123");
+ b.set("A.f1.smi/add.foo", "123");
assertObjectEquals("{A:{'f1.smi':{foo:123}}}", b.build());
- b.set("A.f1.smi/add.foo", null);
+ b.set("A.f1.smi/add.foo", null);
assertObjectEquals("{}", b.build());
b.clear();
b.set("A.f1.smi", null);
assertObjectEquals("{}", b.build());
-
+
b.clear();
b.set("A.f1.smi", "{foo:'123'}");
testError(b, "A.f1.smi/remove", "foo", "Cannot remove value 'foo' (String) from property 'f1.smi' (Map<String,Integer>).");
@@ -844,13 +844,13 @@ public class PropertyStoreTest {
assertEquals("Cannot remove value 'foo' (String) from property 'f1.smi' (Map<String,Integer>).", e.getMessage());
}
}
-
+
@Test
public void testMapClass() throws Exception {
PropertyStoreBuilder b = PropertyStore.create();
PropertyStore ps = null;
- b.set("A.f1.smc", new AMap<String,Class<?>>().append("foo", String.class).append("baz", Integer.class).append("quux", null).append(null, null));
- b.set("A.f2.smc", new AMap<String,Object>().append("foo", String.class).append("bar", Integer.class).append("baz", null));
+ b.set("A.f1.smc", new AMap<String,Class<?>>().append("foo", String.class).append("baz", Integer.class).append("quux", null).append(null, null));
+ b.set("A.f2.smc", new AMap<String,Object>().append("foo", String.class).append("bar", Integer.class).append("baz", null));
b.set("A.f3.smc", null);
ps = b.build();
assertObjectEquals("{A:{'f1.smc':{baz:'java.lang.Integer',foo:'java.lang.String'},'f2.smc':{bar:'java.lang.Integer',foo:'java.lang.String'}}}", ps);
@@ -860,17 +860,17 @@ public class PropertyStoreTest {
assertInstanceOf(Class.class, ((Map<?,?>)ps.getProperty("A.f2.smc")).values().iterator().next());
b.clear();
- b.set("A.f1.smc/add.foo", String.class);
+ b.set("A.f1.smc/add.foo", String.class);
assertObjectEquals("{A:{'f1.smc':{foo:'java.lang.String'}}}", b.build());
- b.set("A.f1.smc/add.foo", null);
+ b.set("A.f1.smc/add.foo", null);
assertObjectEquals("{}", b.build());
b.clear();
b.set("A.f1.smc", null);
assertObjectEquals("{}", b.build());
-
+
b.clear();
- b.set("A.f1.smc/add.foo", String.class);
+ b.set("A.f1.smc/add.foo", String.class);
testError(b, "A.f1.smc/remove", "foo", "Cannot remove value 'foo' (String) from property 'f1.smc' (Map<String,Class>).");
try {
b.removeFrom("A.f1.smc", "foo");
@@ -879,16 +879,16 @@ public class PropertyStoreTest {
assertEquals("Cannot remove value 'foo' (String) from property 'f1.smc' (Map<String,Class>).", e.getMessage());
}
}
-
+
@Test
public void testMapObject() throws Exception {
PropertyStoreBuilder b = PropertyStore.create();
-
+
PropertyStore ps = null;
- b.set("A.f1.smo", new AMap<String,String>().append("foo", "1").append("baz", "2").append("quux", null).append(null, null));
- b.set("A.f2.smo", new AMap<String,Object>().append("foo", 123).append("bar", StringBuilder.class).append("qux", null));
- b.set("A.f3.smo", new AMap<String,StringBuilder>().append("foo", new StringBuilder("123")).append("baz", null));
- b.set("A.f4.smo", "{foo:'123',baz:456,qux:null}");
+ b.set("A.f1.smo", new AMap<String,String>().append("foo", "1").append("baz", "2").append("quux", null).append(null, null));
+ b.set("A.f2.smo", new AMap<String,Object>().append("foo", 123).append("bar", StringBuilder.class).append("qux", null));
+ b.set("A.f3.smo", new AMap<String,StringBuilder>().append("foo", new StringBuilder("123")).append("baz", null));
+ b.set("A.f4.smo", "{foo:'123',baz:456,qux:null}");
b.set("A.f5.smo", null);
ps = b.build();
assertObjectEquals("{A:{'f1.smo':{baz:'2',foo:'1'},'f2.smo':{bar:'java.lang.StringBuilder',foo:123},'f3.smo':{foo:'123'},'f4.smo':{baz:456,foo:'123'}}}", ps);
@@ -898,19 +898,19 @@ public class PropertyStoreTest {
assertInstanceOf(Map.class, ps.getProperty("A.f4.smo"));
b.clear();
- b.set("A.f1.smo/add", "{foo:'123'}");
+ b.set("A.f1.smo/add", "{foo:'123'}");
assertObjectEquals("{A:{'f1.smo':{foo:'123'}}}", b.build());
-
+
b.clear();
- b.set("A.f1.smo/add.foo", "123");
+ b.set("A.f1.smo/add.foo", "123");
assertObjectEquals("{A:{'f1.smo':{foo:'123'}}}", b.build());
- b.set("A.f1.smo/add.foo", null);
+ b.set("A.f1.smo/add.foo", null);
assertObjectEquals("{}", b.build());
b.clear();
b.set("A.f1.smo", null);
assertObjectEquals("{}", b.build());
-
+
b.clear();
b.set("A.f1.smo", "{foo:'123'}");
testError(b, "A.f1.smo/remove", "foo", "Cannot remove value 'foo' (String) from property 'f1.smo' (Map<String,Object>).");
@@ -921,22 +921,22 @@ public class PropertyStoreTest {
assertEquals("Cannot remove value 'foo' (String) from property 'f1.smo' (Map<String,Object>).", e.getMessage());
}
}
-
+
//-------------------------------------------------------------------------------------------------------------------
// Hash tests
//-------------------------------------------------------------------------------------------------------------------
-
+
@Test
public void testPropertyTypeStringHash() throws Exception {
PropertyStoreBuilder b1 = PropertyStore.create(), b2 = PropertyStore.create();
PropertyStore ps = null;
-
+
b1.set("A.f1", "foo");
b2.set("A.f1", new StringBuilder("foo"));
testEquals(b1, b2);
-
+
testEquals(b1, b1);
-
+
b1.set("A.f1", "foo");
b2.set("A.f1", new StringBuilder("foox"));
testNotEquals(b1, b2);
@@ -947,23 +947,23 @@ public class PropertyStoreTest {
b1.set("A.f1", "bar");
assertTrue(ps != b1.build());
-
+
b1.clear();
b2.clear();
testEquals(b1, b2);
- }
-
+ }
+
@Test
public void testPropertyTypeBooleanHash() throws Exception {
PropertyStoreBuilder b1 = PropertyStore.create(), b2 = PropertyStore.create();
PropertyStore ps = null;
-
+
b1.set("A.f1.b", true);
b2.set("A.f1.b", new StringBuilder("true"));
testEquals(b1, b2);
-
+
testEquals(b1, b1);
-
+
b1.set("A.f1.b", true);
b2.set("A.f1.b", new StringBuilder("false"));
testNotEquals(b1, b2);
@@ -974,26 +974,26 @@ public class PropertyStoreTest {
b1.set("A.f1.b", false);
assertTrue(ps != b1.build());
-
+
b1.clear();
b2.clear();
testEquals(b1, b2);
- }
+ }
@Test
public void testPropertyTypeIntegerHash() throws Exception {
PropertyStoreBuilder b1 = PropertyStore.create(), b2 = PropertyStore.create();
PropertyStore ps = null;
-
+
b1.set("A.f1.i", 1);
b2.set("A.f1.i", new StringBuilder("1"));
testEquals(b1, b2);
-
+
testEquals(b1, b1);
-
+
b1.set("A.f1.i", 1);
b2.set("A.f1.i", new StringBuilder("2"));
-
+
testNotEquals(b1, b2);
assertTrue(b1.build() != b2.build());
@@ -1003,26 +1003,26 @@ public class PropertyStoreTest {
b1.set("A.f1.i", 2);
assertTrue(ps != b1.build());
-
+
b1.clear();
b2.clear();
testEquals(b1, b2);
- }
+ }
@Test
public void testClassHash() throws Exception {
PropertyStoreBuilder b1 = PropertyStore.create(), b2 = PropertyStore.create();
PropertyStore ps = null;
-
+
b1.set("A.f1.c", String.class);
b2.set("A.f1.c", String.class);
testEquals(b1, b2);
-
+
testEquals(b1, b1);
-
+
b1.set("A.f1.c", String.class);
b2.set("A.f1.c", Integer.class);
-
+
testNotEquals(b1, b2);
ps = b1.build();
@@ -1031,23 +1031,23 @@ public class PropertyStoreTest {
b1.set("A.f1.c", Integer.class);
assertTrue(ps != b1.build());
-
+
b1.clear();
b2.clear();
testEquals(b1, b2);
- }
+ }
@Test
public void testObjectHash() throws Exception {
PropertyStoreBuilder b1 = PropertyStore.create(), b2 = PropertyStore.create();
PropertyStore ps = null;
-
+
b1.set("A.f1.o", "foo");
b2.set("A.f1.o", "foo");
testEquals(b1, b2);
-
+
testEquals(b1, b1);
-
+
b1.set("A.f1.o", TestEnum.ONE);
b2.set("A.f1.o", TestEnum.TWO);
testNotEquals(b1, b2);
@@ -1058,22 +1058,22 @@ public class PropertyStoreTest {
b1.set("A.f1.o", TestEnum.TWO);
assertTrue(ps != b1.build());
-
+
b1.clear();
b2.clear();
testEquals(b1, b2);
- }
+ }
@Test
public void testSetStringHash() throws Exception {
PropertyStoreBuilder b1 = PropertyStore.create(), b2 = PropertyStore.create();
PropertyStore ps = null;
-
+
b1.set("A.f1.ss", new AList<String>().appendAll("foo", "bar"));
b2.set("A.f1.ss", new String[]{"foo","bar"});
testEquals(b1, b2);
- b2.set("A.f1.ss", new AList<Object>().appendAll(new StringBuilder("bar"), new StringBuilder("foo")));
+ b2.set("A.f1.ss", new AList<>().appendAll(new StringBuilder("bar"), new StringBuilder("foo")));
testEquals(b1, b2);
b2.set("A.f1.ss", new Object[]{new StringBuilder("bar"), new StringBuilder("foo")});
@@ -1089,27 +1089,27 @@ public class PropertyStoreTest {
b1.set("A.f1.ss", "['bar']");
assertTrue(ps != b1.build());
-
+
b1.clear();
b2.clear();
testEquals(b1, b2);
- }
+ }
@Test
public void testSetIntegerHash() throws Exception {
PropertyStoreBuilder b1 = PropertyStore.create(), b2 = PropertyStore.create();
PropertyStore ps = null;
-
+
b1.set("A.f1.si", new AList<String>().appendAll("1", "2"));
b2.set("A.f1.si", new String[]{"1","2"});
testEquals(b1, b2);
-
- b2.set("A.f1.si", new AList<Object>().appendAll(new StringBuilder("2"), 1));
+
+ b2.set("A.f1.si", new AList<>().appendAll(new StringBuilder("2"), 1));
testEquals(b1, b2);
-
+
b2.set("A.f1.si", new Object[]{new StringBuilder("2"), 1});
testEquals(b1, b2);
-
+
b1.set("A.f1.si", new String[]{"1"});
b2.set("A.f1.si", new String[]{"2"});
testNotEquals(b1, b2);
@@ -1120,27 +1120,27 @@ public class PropertyStoreTest {
b1.set("A.f1.si", "['2']");
assertTrue(ps != b1.build());
-
+
b1.clear();
b2.clear();
testEquals(b1, b2);
- }
+ }
@Test
public void testSetClassHash() throws Exception {
PropertyStoreBuilder b1 = PropertyStore.create(), b2 = PropertyStore.create();
PropertyStore ps = null;
-
+
b1.set("A.f1.sc", new AList<Class<?>>().appendAll(String.class, Integer.class));
b2.set("A.f1.sc", new Class<?>[]{Integer.class,String.class});
testEquals(b1, b2);
-
- b2.set("A.f1.sc", new AList<Object>().appendAll(Integer.class, String.class));
+
+ b2.set("A.f1.sc", new AList<>().appendAll(Integer.class, String.class));
testEquals(b1, b2);
b2.set("A.f1.sc", new Object[]{String.class, Integer.class});
testEquals(b1, b2);
-
+
b1.set("A.f1.sc", new Class[]{String.class});
b2.set("A.f1.sc", new Class[]{Integer.class});
testNotEquals(b1, b2);
@@ -1151,27 +1151,27 @@ public class PropertyStoreTest {
b1.set("A.f1.sc", Map.class);
assertTrue(ps != b1.build());
-
+
b1.clear();
b2.clear();
testEquals(b1, b2);
- }
+ }
@Test
public void testListStringHash() throws Exception {
PropertyStoreBuilder b1 = PropertyStore.create(), b2 = PropertyStore.create();
PropertyStore ps = null;
-
+
b1.set("A.f1.ls", new AList<String>().appendAll("foo", "bar"));
b2.set("A.f1.ls", new String[]{"foo","bar"});
testEquals(b1, b2);
- b2.set("A.f1.ls", new AList<Object>().appendAll(new StringBuilder("foo"), new StringBuilder("bar")));
+ b2.set("A.f1.ls", new AList<>().appendAll(new StringBuilder("foo"), new StringBuilder("bar")));
testEquals(b1, b2);
- b2.set("A.f1.ls", new AList<Object>().appendAll(new StringBuilder("bar"), new StringBuilder("foo")));
+ b2.set("A.f1.ls", new AList<>().appendAll(new StringBuilder("bar"), new StringBuilder("foo")));
testNotEquals(b1, b2);
-
+
b2.set("A.f1.ls", new Object[]{new StringBuilder("foo"), new StringBuilder("bar")});
testEquals(b1, b2);
@@ -1188,33 +1188,33 @@ public class PropertyStoreTest {
b1.set("A.f1.ls", "['bar']");
assertTrue(ps != b1.build());
-
+
b1.clear();
b2.clear();
testEquals(b1, b2);
- }
+ }
@Test
public void testListIntegerHash() throws Exception {
PropertyStoreBuilder b1 = PropertyStore.create(), b2 = PropertyStore.create();
PropertyStore ps = null;
-
+
b1.set("A.f1.li", new AList<String>().appendAll("1", "2"));
b2.set("A.f1.li", new String[]{"1","2"});
testEquals(b1, b2);
-
+
b2.set("A.f1.li", new String[]{"2","1"});
testNotEquals(b1, b2);
b2.set("A.f1.li", new int[]{1,2});
testEquals(b1, b2);
-
- b2.set("A.f1.li", new AList<Object>().appendAll(new StringBuilder("2"), 1));
+
+ b2.set("A.f1.li", new AList<>().appendAll(new StringBuilder("2"), 1));
testNotEquals(b1, b2);
-
+
b2.set("A.f1.li", new Object[]{new StringBuilder("1"), 2});
testEquals(b1, b2);
-
+
b1.set("A.f1.li", new String[]{"1"});
b2.set("A.f1.li", new String[]{"2"});
testNotEquals(b1, b2);
@@ -1225,31 +1225,31 @@ public class PropertyStoreTest {
b1.set("A.f1.li", "['2']");
assertTrue(ps != b1.build());
-
+
b1.clear();
b2.clear();
testEquals(b1, b2);
- }
+ }
@Test
public void testListClassHash() throws Exception {
PropertyStoreBuilder b1 = PropertyStore.create(), b2 = PropertyStore.create();
PropertyStore ps = null;
-
+
b1.set("A.f1.lc", new AList<Class<?>>().appendAll(String.class, Integer.class));
-
+
b2.set("A.f1.lc", new Class<?>[]{String.class,Integer.class});
testEquals(b1, b2);
b2.set("A.f1.lc", new Class<?>[]{Integer.class,String.class});
testNotEquals(b1, b2);
-
- b2.set("A.f1.lc", new AList<Object>().appendAll(String.class, Integer.class));
+
+ b2.set("A.f1.lc", new AList<>().appendAll(String.class, Integer.class));
testEquals(b1, b2);
b2.set("A.f1.lc", new Object[]{String.class, Integer.class});
testEquals(b1, b2);
-
+
b1.set("A.f1.lc", new Class[]{String.class});
b2.set("A.f1.lc", new Class[]{Integer.class});
testNotEquals(b1, b2);
@@ -1260,28 +1260,28 @@ public class PropertyStoreTest {
b1.set("A.f1.lc", Map.class);
assertTrue(ps != b1.build());
-
+
b1.clear();
b2.clear();
testEquals(b1, b2);
- }
+ }
@Test
public void testListObjectHash() throws Exception {
PropertyStoreBuilder b1 = PropertyStore.create(), b2 = PropertyStore.create();
PropertyStore ps = null;
-
- b1.set("A.f1.lo", new AList<Object>().appendAll("foo", 123, true, TestEnum.ONE));
-
- b2.set("A.f1.lo", new AList<Object>().appendAll("foo", 123, true, TestEnum.ONE));
+
+ b1.set("A.f1.lo", new AList<>().appendAll("foo", 123, true, TestEnum.ONE));
+
+ b2.set("A.f1.lo", new AList<>().appendAll("foo", 123, true, TestEnum.ONE));
testEquals(b1, b2);
- b2.set("A.f1.lo", new AList<Object>().appendAll(123, true, TestEnum.ONE, "foo"));
+ b2.set("A.f1.lo", new AList<>().appendAll(123, true, TestEnum.ONE, "foo"));
testNotEquals(b1, b2);
b2.set("A.f1.lo", new Object[]{"foo", 123, true, TestEnum.ONE});
testEquals(b1, b2);
-
+
b1.set("A.f1.lo", new Object[]{StringBuilder.class});
b2.set("A.f1.lo", new Object[]{StringBuffer.class});
testNotEquals(b1, b2);
@@ -1293,17 +1293,17 @@ public class PropertyStoreTest {
b1.set("A.f1.lo", "bar");
assertTrue(ps != b1.build());
-
+
b1.clear();
b2.clear();
testEquals(b1, b2);
- }
-
+ }
+
@Test
public void testMapStringHash() throws Exception {
PropertyStoreBuilder b1 = PropertyStore.create(), b2 = PropertyStore.create();
PropertyStore ps = null;
-
+
b1.set("A.f1.sms", new AMap<String,String>().append("foo", "123").append("bar", "true").append("baz", null).append(null, null));
b2.set("A.f1.sms", new AMap<String,Object>().append("foo", 123).append("bar", true).append("baz", null).append(null, null));
testEquals(b1, b2);
@@ -1313,7 +1313,7 @@ public class PropertyStoreTest {
b2.set("A.f1.sms", new AMap<String,Object>().append("bar", new StringBuilder("true")).append("foo", new StringBuilder("123")));
testEquals(b1, b2);
-
+
b2.set("A.f1.sms", new AMap<String,Object>().append("bar", false).append("foo", new StringBuilder("123")));
testNotEquals(b1, b2);
@@ -1324,17 +1324,17 @@ public class PropertyStoreTest {
b1.set("A.f1.sms", "{foo:'baz'}");
assertTrue(ps != b1.build());
-
+
b1.clear();
b2.clear();
testEquals(b1, b2);
- }
-
+ }
+
@Test
public void testMapIntegerHash() throws Exception {
PropertyStoreBuilder b1 = PropertyStore.create(), b2 = PropertyStore.create();
PropertyStore ps = null;
-
+
b1.set("A.f1.smi", new AMap<String,Integer>().append("foo", 123).append("bar", 456).append("baz", null).append(null, null));
b2.set("A.f1.smi", new AMap<String,Object>().append("foo", 123).append("bar", "456").append("baz", null).append(null, null));
testEquals(b1, b2);
@@ -1344,7 +1344,7 @@ public class PropertyStoreTest {
b2.set("A.f1.smi", new AMap<String,Object>().append("bar", new StringBuilder("456")).append("foo", new StringBuilder("123")));
testEquals(b1, b2);
-
+
b2.set("A.f1.smi", new AMap<String,Object>().append("bar", "457").append("foo", new StringBuilder("123")));
testNotEquals(b1, b2);
@@ -1355,17 +1355,17 @@ public class PropertyStoreTest {
b1.set("A.f1.smi", "{foo:'456'}");
assertTrue(ps != b1.build());
-
+
b1.clear();
b2.clear();
testEquals(b1, b2);
- }
-
+ }
+
@Test
public void testMapClassHash() throws Exception {
PropertyStoreBuilder b1 = PropertyStore.create(), b2 = PropertyStore.create();
PropertyStore ps = null;
-
+
b1.set("A.f1.smc", new AMap<String,Class<?>>().append("foo", String.class).append("bar", Integer.class).append("baz", null).append(null, null));
b2.set("A.f1.smc", new AMap<String,Object>().append("foo", String.class).append("bar", Integer.class).append("baz", null).append(null, null));
testEquals(b1, b2);
@@ -1375,7 +1375,7 @@ public class PropertyStoreTest {
b2.set("A.f1.smc", new AMap<String,Object>().append("bar", Integer.class).append("foo", String.class));
testEquals(b1, b2);
-
+
b2.set("A.f1.smc", new AMap<String,Object>().append("bar", Integer.class).append("foo", StringBuilder.class));
testNotEquals(b1, b2);
@@ -1387,17 +1387,17 @@ public class PropertyStoreTest {
b1.set("A.f1.smc/add.foo", String.class);
assertTrue(ps != b1.build());
-
+
b1.clear();
b2.clear();
testEquals(b1, b2);
- }
+ }
@Test
public void testMapObjectHash() throws Exception {
PropertyStoreBuilder b1 = PropertyStore.create(), b2 = PropertyStore.create();
PropertyStore ps = null;
-
+
b1.set("A.f1.smo", new AMap<String,TestEnum>().append("foo", TestEnum.ONE).append("bar", TestEnum.TWO).append("baz", null).append(null, null));
b2.set("A.f1.smo", new AMap<String,Object>().append("foo", TestEnum.ONE).append("bar", TestEnum.TWO).append("baz", null).append(null, null));
testEquals(b1, b2);
@@ -1407,7 +1407,7 @@ public class PropertyStoreTest {
b2.set("A.f1.smo", new AMap<String,Object>().append("bar", TestEnum.TWO).append("foo", TestEnum.ONE));
testEquals(b1, b2);
-
+
b2.set("A.f1.smo", new AMap<String,Object>().append("bar", TestEnum.ONE).append("foo", TestEnum.TWO));
testNotEquals(b1, b2);
@@ -1419,30 +1419,30 @@ public class PropertyStoreTest {
b1.set("A.f1.smo/add.foo", TestEnum.TWO);
assertTrue(ps != b1.build());
-
+
b1.clear();
b2.clear();
testEquals(b1, b2);
- }
+ }
//-------------------------------------------------------------------------------------------------------------------
// Test system property defaults
//-------------------------------------------------------------------------------------------------------------------
-
+
@Test
public void testStringDefault() {
PropertyStore ps = PropertyStore.create().build();
-
- System.setProperty("A.f1", "foo");
+
+ System.setProperty("A.f1", "foo");
assertEquals("foo", ps.getProperty("A.f1"));
System.clearProperty("A.f1");
}
-
+
@Test
public void testIntegerDefault() {
PropertyStore ps = PropertyStore.create().build();
-
- System.setProperty("A.f1.i", "1");
+
+ System.setProperty("A.f1.i", "1");
assertEquals(1, ps.getProperty("A.f1.i"));
assertInstanceOf(Integer.class, ps.getProperty("A.f1.i"));
System.clearProperty("A.f1.i");
@@ -1451,27 +1451,27 @@ public class PropertyStoreTest {
@Test
public void testObjectDefault() {
PropertyStore ps = PropertyStore.create().build();
-
- System.setProperty("A.f1.o", "123");
+
+ System.setProperty("A.f1.o", "123");
assertEquals("123", ps.getProperty("A.f1.o"));
assertInstanceOf(String.class, ps.getProperty("A.f1.o"));
System.clearProperty("A.f1.o");
}
-
+
@Test
public void testSetStringDefault() {
PropertyStore ps = PropertyStore.create().build();
-
- System.setProperty("A.f1.ss", "['foo','bar']");
+
+ System.setProperty("A.f1.ss", "['foo','bar']");
assertObjectEquals("['bar','foo']", ps.getProperty("A.f1.ss"));
System.clearProperty("A.f1.ss");
}
-
+
@Test
public void testSetIntegerDefault() {
PropertyStore ps = PropertyStore.create().build();
-
- System.setProperty("A.f1.si", "['2','1']");
+
+ System.setProperty("A.f1.si", "['2','1']");
assertObjectEquals("[1,2]", ps.getProperty("A.f1.si"));
System.clearProperty("A.f1.si");
}
@@ -1479,17 +1479,17 @@ public class PropertyStoreTest {
@Test
public void testListStringDefault() {
PropertyStore ps = PropertyStore.create().build();
-
- System.setProperty("A.f1.ls", "['foo','bar']");
+
+ System.setProperty("A.f1.ls", "['foo','bar']");
assertObjectEquals("['foo','bar']", ps.getProperty("A.f1.ls"));
System.clearProperty("A.f1.ls");
}
-
+
@Test
public void testListIntegerDefault() {
PropertyStore ps = PropertyStore.create().build();
-
- System.setProperty("A.f1.li", "['2','1']");
+
+ System.setProperty("A.f1.li", "['2','1']");
assertObjectEquals("[2,1]", ps.getProperty("A.f1.li"));
System.clearProperty("A.f1.li");
}
@@ -1497,17 +1497,17 @@ public class PropertyStoreTest {
@Test
public void testMapStringDefault() {
PropertyStore ps = PropertyStore.create().build();
-
- System.setProperty("A.f1.sms", "{foo:'bar',baz:null}");
+
+ System.setProperty("A.f1.sms", "{foo:'bar',baz:null}");
assertObjectEquals("{foo:'bar'}", ps.getProperty("A.f1.sms"));
System.clearProperty("A.f1.sms");
}
-
+
@Test
public void testMapIntegerDefault() {
PropertyStore ps = PropertyStore.create().build();
-
- System.setProperty("A.f1.smi", "{foo:'123',baz:null}");
+
+ System.setProperty("A.f1.smi", "{foo:'123',baz:null}");
assertObjectEquals("{foo:123}", ps.getProperty("A.f1.smi"));
System.clearProperty("A.f1.smi");
}
@@ -1515,8 +1515,8 @@ public class PropertyStoreTest {
@Test
public void testMapObjectDefault() {
PropertyStore ps = PropertyStore.create().build();
-
- System.setProperty("A.f1.smo", "{foo:123,bar:'baz',qux:true,quux:null}");
+
+ System.setProperty("A.f1.smo", "{foo:123,bar:'baz',qux:true,quux:null}");
assertObjectEquals("{bar:'baz',foo:123,qux:true}", ps.getProperty("A.f1.smo"));
System.clearProperty("A.f1.smo");
}
@@ -1528,13 +1528,13 @@ public class PropertyStoreTest {
@Test
public void testBuilderFromStore() {
PropertyStoreBuilder b = PropertyStore.create();
-
+
b.set("A.foo", "bar");
PropertyStore ps1 = b.build();
b = ps1.builder();
assertObjectEquals("{A:{foo:'bar'}}", b.build());
}
-
+
@Test
public void testSet() {
PropertyStoreBuilder b = PropertyStore.create();
@@ -1543,7 +1543,7 @@ public class PropertyStoreTest {
b.add(null);
assertObjectEquals("{A:{baz:'qux'}}", b.build());
}
-
+
@Test
public void testAdd() {
PropertyStoreBuilder b = PropertyStore.create();
@@ -1553,14 +1553,14 @@ public class PropertyStoreTest {
b.add(null);
assertObjectEquals("{A:{baz:'qux',foo:'bar'}}", b.build());
}
-
+
@Test
public void testRemoveNotExisting() {
PropertyStoreBuilder b = PropertyStore.create();
b.removeFrom("A.foo.ls", "bar");
assertObjectEquals("{}", b.build());
}
-
+
@Test
public void testAddToNull() {
PropertyStoreBuilder b = PropertyStore.create();
@@ -1623,13 +1623,13 @@ public class PropertyStoreTest {
assertNull(b.getProperty("A.baz"));
assertNull(b.getProperty("B.foo"));
}
-
+
@Test
public void testHashCodes() {
PropertyStoreBuilder b = PropertyStore.create();
b.set("A.foo", "bar").set("B.foo", "bar");
PropertyStore ps = b.build();
-
+
assertEquals(ps.hashCode("A","B","C",null),ps.hashCode("A","B","C",null));
assertNotEquals(ps.hashCode("A"),ps.hashCode("B"));
assertNotEquals(ps.hashCode("A","B"),ps.hashCode("B","A"));
@@ -1650,7 +1650,7 @@ public class PropertyStoreTest {
PropertyStore ps1 = b.build();
b.remove("A.foo").set("C.foo", "bar").set("D.foo", "baz");
PropertyStore ps2 = b.build();
-
+
assertTrue(ps1.equals(ps1, null, null));
assertTrue(ps1.equals(ps2, null, null));
@@ -1667,7 +1667,7 @@ public class PropertyStoreTest {
PropertyStoreBuilder b = PropertyStore.create();
b.set("A.foo", "bar").set("B.foo", "bar").set("D.foo", "bar");
PropertyStore ps = b.build();
-
+
assertObjectEquals("[]", ps.getPropertyKeys(null));
assertObjectEquals("['foo']", ps.getPropertyKeys("A"));
assertObjectEquals("[]", ps.getPropertyKeys("C"));
@@ -1693,10 +1693,10 @@ public class PropertyStoreTest {
b.set("A.foo.smc/add.foo", String.class);
b.set("A.foo.smo/add.foo", StringBuilder.class);
PropertyStore ps = b.build();
-
+
b = ps.builder();
ps = b.build();
-
+
assertObjectEquals("{A:{'foo.b':true,'foo.c':'java.lang.String','foo.i':123,'foo.lc':['java.lang.String'],'foo.li':[123],'foo.lo':['java.lang.StringBuilder'],'foo.ls':['bar'],'foo.o':'bar','foo.s':'bar','foo.sc':['java.lang.String'],'foo.si':[123],'foo.smc':{foo:'java.lang.String'},'foo.smi':{foo:123},'foo.smo':{foo:'java.lang.StringBuilder'},'foo.sms':{foo:'bar'},'foo.ss':['bar']}}", ps);
}
@@ -1709,7 +1709,7 @@ public class PropertyStoreTest {
@Test
public void testNoneOnList() {
PropertyStoreBuilder psb = PropertyStore.create();
-
+
psb.set("A.foo.ls", "['foo','bar']");
psb.set("A.foo.ls", "NONE");
assertEquals("{}", psb.build().toString());
@@ -1718,16 +1718,16 @@ public class PropertyStoreTest {
@Test
public void testNoneOnSet() {
PropertyStoreBuilder psb = PropertyStore.create();
-
+
psb.set("A.foo.ss", "['foo','bar']");
psb.set("A.foo.ss", "NONE");
assertEquals("{}", psb.build().toString());
}
-
+
@Test
public void testInheritOnList() {
PropertyStoreBuilder psb = PropertyStore.create();
-
+
psb.set("A.foo.ls", "['foo','bar']");
psb.set("A.foo.ls", "['baz','INHERIT','qux']");
assertEquals("{A:{'foo.ls':['baz','foo','bar','qux']}}", psb.build().toString());
@@ -1736,7 +1736,7 @@ public class PropertyStoreTest {
@Test
public void testInheritOnSet() {
PropertyStoreBuilder psb = PropertyStore.create();
-
+
psb.set("A.foo.ls", "['foo','bar']");
psb.set("A.foo.ls", "['baz','INHERIT','qux']");
assertEquals("{A:{'foo.ls':['baz','foo','bar','qux']}}", psb.build().toString());
@@ -1745,7 +1745,7 @@ public class PropertyStoreTest {
@Test
public void testIndexedValuesOnList() {
PropertyStoreBuilder psb = PropertyStore.create();
-
+
psb.set("A.foo.ls", "['foo','bar']");
psb.set("A.foo.ls", new String[]{"INHERIT", "[0]:baz"});
assertEquals("{A:{'foo.ls':['baz','foo','bar']}}", psb.build().toString());
@@ -1758,7 +1758,7 @@ public class PropertyStoreTest {
//-------------------------------------------------------------------------------------------------------------------
// Utility methods
//-------------------------------------------------------------------------------------------------------------------
-
+
private void testError(PropertyStoreBuilder b, String key, Object val, String msg) {
try {
b.set(key, val);
@@ -1769,11 +1769,11 @@ public class PropertyStoreTest {
assertEquals(msg, e.getMessage());
}
}
-
+
private void testEquals(PropertyStoreBuilder b1, PropertyStoreBuilder b2) {
assertTrue(b1.build() == b2.build());
}
-
+
private void testNotEquals(PropertyStoreBuilder b1, PropertyStoreBuilder b2) {
PropertyStore p1 = b1.build(), p2 = b2.build();
assertTrue(p1 != p2);
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/XmlValidatorParser.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/XmlValidatorParser.java
index 80644ab..88f2983 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/XmlValidatorParser.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/XmlValidatorParser.java
@@ -41,7 +41,7 @@ public class XmlValidatorParser extends XmlParser {
protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws Exception {
return (T)validate(pipe.getReader());
}
-
+
@Override /* ReaderParser */
protected <K,V> Map<K,V> doParseIntoMap(ParserPipe pipe, Map<K,V> m, Type keyType, Type valueType) throws Exception {
return (Map<K,V>)validate(pipe.getReader());
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripAddClassAttrsTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripAddClassAttrsTest.java
index 383683a..8d2e4ea 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripAddClassAttrsTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripAddClassAttrsTest.java
@@ -231,10 +231,10 @@ public class RoundTripAddClassAttrsTest extends RoundTripTest {
@Bean(typeName="C")
public static class C {
- public Map<String,A> f3a = new HashMap<String,A>();
- public Map<String,A> f3b = new HashMap<String,A>();
- public Map<String,A> f3c = new HashMap<String,A>();
- public Map<String,A> f3d = new HashMap<String,A>();
+ public Map<String,A> f3a = new HashMap<>();
+ public Map<String,A> f3b = new HashMap<>();
+ public Map<String,A> f3c = new HashMap<>();
+ public Map<String,A> f3d = new HashMap<>();
public C(){}
public C(String f1) {
@@ -303,10 +303,10 @@ public class RoundTripAddClassAttrsTest extends RoundTripTest {
@Bean(typeName="E")
public static class E {
- public List<A> f5a = new LinkedList<A>();
- public List<AA> f5b = new LinkedList<AA>();
- public List<IA> f5c = new LinkedList<IA>();
- public List<Object> f5d = new LinkedList<Object>();
+ public List<A> f5a = new LinkedList<>();
+ public List<AA> f5b = new LinkedList<>();
+ public List<IA> f5c = new LinkedList<>();
+ public List<Object> f5d = new LinkedList<>();
public E(){}
public E(String f1) {
@@ -339,10 +339,10 @@ public class RoundTripAddClassAttrsTest extends RoundTripTest {
@Bean(typeName="F")
public static class F {
- public List<A[]> f6a = new LinkedList<A[]>();
- public List<AA[]> f6b = new LinkedList<AA[]>();
- public List<IA[]> f6c = new LinkedList<IA[]>();
- public List<Object[]> f6d = new LinkedList<Object[]>();
+ public List<A[]> f6a = new LinkedList<>();
+ public List<AA[]> f6b = new LinkedList<>();
+ public List<IA[]> f6c = new LinkedList<>();
+ public List<Object[]> f6d = new LinkedList<>();
public F(){}
public F(String f1) {
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java
index 5ab98ca..cbf1007 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java
@@ -43,7 +43,7 @@ public class RoundTripBeanMapsTest extends RoundTripTest {
@Override /* RoundTripTest */
public Map<Class<?>,Class<?>> getImplClasses() {
- Map<Class<?>,Class<?>> m = new HashMap<Class<?>,Class<?>>();
+ Map<Class<?>,Class<?>> m = new HashMap<>();
m.put(IBean.class, CBean.class);
return m;
}
@@ -910,7 +910,7 @@ public class RoundTripBeanMapsTest extends RoundTripTest {
L t = L.create();
t = roundTrip(t, L.class);
- Map<String,L> m = new LinkedHashMap<String,L>();
+ Map<String,L> m = new LinkedHashMap<>();
m.put("bar", L.create());
roundTrip(m, LinkedHashMap.class, String.class, L.class);
}
@@ -934,7 +934,7 @@ public class RoundTripBeanMapsTest extends RoundTripTest {
M t = M.create();
t = roundTrip(t, M.class);
- Map<String,M> m = new LinkedHashMap<String,M>();
+ Map<String,M> m = new LinkedHashMap<>();
m.put("bar", M.create());
roundTrip(m, LinkedHashMap.class, String.class, M.class);
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripEnumTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripEnumTest.java
index bf7f92d..df1600f 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripEnumTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripEnumTest.java
@@ -173,20 +173,20 @@ public class RoundTripEnumTest extends RoundTripTest {
public AEnum[][] f4;
// Should not have 'uniqueSet' attribute.
- public List<AEnum> f5 = new LinkedList<AEnum>();
+ public List<AEnum> f5 = new LinkedList<>();
- private List<AEnum> f6 = new LinkedList<AEnum>();
+ private List<AEnum> f6 = new LinkedList<>();
public List<AEnum> getF6() {return f6;}
public void setF6(List<AEnum> f6) {this.f6 = f6;}
// Should have 'uniqueSet' attribute.
- public Set<AEnum> f7 = new HashSet<AEnum>();
+ public Set<AEnum> f7 = new HashSet<>();
- private Set<AEnum> f8 = new HashSet<AEnum>();
+ private Set<AEnum> f8 = new HashSet<>();
public Set<AEnum> getF8() {return f8;}
public void setF8(Set<AEnum> f8) {this.f8 = f8;}
- public Map<AEnum,AEnum> f9 = new LinkedHashMap<AEnum,AEnum>();
+ public Map<AEnum,AEnum> f9 = new LinkedHashMap<>();
public A init() {
f1 = AEnum.FOO;
@@ -215,20 +215,20 @@ public class RoundTripEnumTest extends RoundTripTest {
public BEnum[][] f4;
// Should not have 'uniqueSet' attribute.
- public List<BEnum> f5 = new LinkedList<BEnum>();
+ public List<BEnum> f5 = new LinkedList<>();
- private List<BEnum> f6 = new LinkedList<BEnum>();
+ private List<BEnum> f6 = new LinkedList<>();
public List<BEnum> getF6() {return f6;}
public void setF6(List<BEnum> f6) {this.f6 = f6;}
// Should have 'uniqueSet' attribute.
- public Set<BEnum> f7 = new HashSet<BEnum>();
+ public Set<BEnum> f7 = new HashSet<>();
- private Set<BEnum> f8 = new HashSet<BEnum>();
+ private Set<BEnum> f8 = new HashSet<>();
public Set<BEnum> getF8() {return f8;}
public void setF8(Set<BEnum> f8) {this.f8 = f8;}
- public Map<BEnum,BEnum> f9 = new LinkedHashMap<BEnum,BEnum>();
+ public Map<BEnum,BEnum> f9 = new LinkedHashMap<>();
public B init() {
f1 = BEnum.FOO;
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripGenericsTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripGenericsTest.java
index 84d0b38..2840104 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripGenericsTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripGenericsTest.java
@@ -42,7 +42,7 @@ public class RoundTripGenericsTest extends RoundTripTest {
// Unbound type variables should be interpreted as Object.
// During parsing, these become ObjectMaps.
- Pair pair = new Pair<Source,Target>(new Source().init(), new Target().init());
+ Pair pair = new Pair<>(new Source().init(), new Target().init());
pair = roundTrip(pair);
assertSortedObjectEquals("{s:{s1:'a1'},t:{t1:'b1'}}", pair);
assertEquals("ObjectMap", pair.getS().getClass().getSimpleName());
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripMapsTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripMapsTest.java
index c3a4c41..d447881 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripMapsTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripMapsTest.java
@@ -51,14 +51,14 @@ public class RoundTripMapsTest extends RoundTripTest {
//====================================================================================================
@Test
public void testMapIntegerString() throws Exception {
- Map<Integer,String> t = new TreeMap<Integer,String>();
+ Map<Integer,String> t = new TreeMap<>();
t.put(1, "a");
t.put(2, null);
t = roundTrip(t, TreeMap.class, Integer.class, String.class);
assertEquals("a", t.get(1));
assertNull(null, t.get(2));
- t = new HashMap<Integer,String>();
+ t = new HashMap<>();
t.put(1, "a");
t.put(2, null);
t.put(null, "b");
@@ -73,14 +73,14 @@ public class RoundTripMapsTest extends RoundTripTest {
//====================================================================================================
@Test
public void testMapBooleanString() throws Exception {
- Map<Boolean,String> t = new TreeMap<Boolean,String>();
+ Map<Boolean,String> t = new TreeMap<>();
t.put(true, "a");
t.put(false, null);
t = roundTrip(t, TreeMap.class, Boolean.class, String.class);
assertEquals("a", t.get(true));
assertNull(null, t.get(false));
- t = new HashMap<Boolean,String>();
+ t = new HashMap<>();
t.put(true, "a");
t.put(false, null);
t.put(null, "b");
@@ -101,7 +101,7 @@ public class RoundTripMapsTest extends RoundTripTest {
String e;
Object r;
- Map<byte[],String> t = new LinkedHashMap<byte[],String>();
+ Map<byte[],String> t = new LinkedHashMap<>();
t.put(new byte[]{1,2,3}, "a");
t.put(new byte[]{4,5,6}, null);
t.put(null, "b");
@@ -140,14 +140,14 @@ public class RoundTripMapsTest extends RoundTripTest {
Date td1 = new Date(1,2,3,4,5,6);
Date td2 = new Date(2,3,4,5,6,7);
- Map<Date,String> t = new TreeMap<Date,String>();
+ Map<Date,String> t = new TreeMap<>();
t.put(td1, "a");
t.put(td2, null);
t = roundTrip(t, TreeMap.class, Date.class, String.class);
assertEquals("a", t.get(td1));
assertNull(null, t.get(td2));
- t = new HashMap<Date,String>();
+ t = new HashMap<>();
t.put(td1, "a");
t.put(td2, null);
t.put(null, "b");
@@ -167,14 +167,14 @@ public class RoundTripMapsTest extends RoundTripTest {
Calendar td2 = new GregorianCalendar();
td2.setTime(new Date(2,3,4,5,6,7));
- Map<Calendar,String> t = new TreeMap<Calendar,String>();
+ Map<Calendar,String> t = new TreeMap<>();
t.put(td1, "a");
t.put(td2, null);
t = roundTrip(t, TreeMap.class, GregorianCalendar.class, String.class);
assertEquals("a", t.get(td1));
assertNull(null, t.get(td2));
- t = new HashMap<Calendar,String>();
+ t = new HashMap<>();
t.put(td1, "a");
t.put(td2, null);
t.put(null, "b");
@@ -190,14 +190,14 @@ public class RoundTripMapsTest extends RoundTripTest {
@Test
public void testMapEnumString() throws Exception {
- Map<TestEnum,String> t = new TreeMap<TestEnum,String>();
+ Map<TestEnum,String> t = new TreeMap<>();
t.put(TestEnum.FOO, "a");
t.put(TestEnum.BAR, null);
t = roundTrip(t, TreeMap.class, TestEnum.class, String.class);
assertEquals("a", t.get(TestEnum.FOO));
assertNull(null, t.get(TestEnum.BAR));
- t = new HashMap<TestEnum,String>();
+ t = new HashMap<>();
t.put(TestEnum.FOO, "a");
t.put(TestEnum.BAR, null);
t.put(null, "b");
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripObjectsWithSpecialMethodsTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripObjectsWithSpecialMethodsTest.java
index a577b1c..4084d2f 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripObjectsWithSpecialMethodsTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripObjectsWithSpecialMethodsTest.java
@@ -52,7 +52,7 @@ public class RoundTripObjectsWithSpecialMethodsTest extends RoundTripTest {
A init() {
a2 = new A2().init();
- m = new LinkedHashMap<String,A2>();
+ m = new LinkedHashMap<>();
m.put("k1", new A2().init());
return this;
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripPrimitivesBeansTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripPrimitivesBeansTest.java
index caf4690..1f4e5b6 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripPrimitivesBeansTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripPrimitivesBeansTest.java
@@ -219,28 +219,28 @@ public class RoundTripPrimitivesBeansTest extends RoundTripTest {
plDouble = new AList<double[]>().append(new double[]{1}).append(null);
// Anonymous list of primitives
- palBoolean = new ArrayList<boolean[]>();
+ palBoolean = new ArrayList<>();
palBoolean.add(new boolean[]{true});
palBoolean.add(null);
- palByte = new ArrayList<byte[]>();
+ palByte = new ArrayList<>();
palByte.add(new byte[]{1});
palByte.add(null);
- palChar = new ArrayList<char[]>();
+ palChar = new ArrayList<>();
palChar.add(new char[]{'a'});
palChar.add(null);
- palShort = new ArrayList<short[]>();
+ palShort = new ArrayList<>();
palShort.add(new short[]{1});
palShort.add(null);
- palInt = new ArrayList<int[]>();
+ palInt = new ArrayList<>();
palInt.add(new int[]{1});
palInt.add(null);
- palLong = new ArrayList<long[]>();
+ palLong = new ArrayList<>();
palLong.add(new long[]{1});
palLong.add(null);
- palFloat = new ArrayList<float[]>();
+ palFloat = new ArrayList<>();
palFloat.add(new float[]{1});
palFloat.add(null);
- palDouble = new ArrayList<double[]>();
+ palDouble = new ArrayList<>();
palDouble.add(new double[]{1});
palDouble.add(null);
return this;
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripSimpleObjectsTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripSimpleObjectsTest.java
index d82ac91..7c472b2 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripSimpleObjectsTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripSimpleObjectsTest.java
@@ -730,7 +730,7 @@ public class RoundTripSimpleObjectsTest extends RoundTripTest {
//====================================================================================================
@Test
public void testVector() throws Exception {
- Vector<Integer> t = new Vector<Integer>();
+ Vector<Integer> t = new Vector<>();
t.add(1);
t.add(2);
t.add(3);
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java
index 7e251d3..1e06b5b 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java
@@ -300,7 +300,7 @@ public class RoundTripTransformBeansTest extends RoundTripTest {
public static class C3<T> extends C2<T> {
public static C3 create() {
- C3 c3 = new C3<Object>();
+ C3 c3 = new C3<>();
CDTO cdto = new CDTO();
cdto.f2 = "f2";
cdto.f3 = 3;
@@ -370,7 +370,7 @@ public class RoundTripTransformBeansTest extends RoundTripTest {
return x;
}
}
-
+
@Test
public void testSurrogatesThroughAnnotation() throws Exception {
JsonSerializer s = JsonSerializer.DEFAULT_LAX;
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/ConfigBuilderTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/ConfigBuilderTest.java
index c6252e0..a8ba17e 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/ConfigBuilderTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/ConfigBuilderTest.java
@@ -43,7 +43,7 @@ public class ConfigBuilderTest {
File f;
ConfigFileStore cfs = ConfigFileStore.create().directory(TEMP_DIR).useWatcher().watcherSensitivity(WatcherSensitivity.HIGH).build();
ConfigBuilder cb = Config.create().store(cfs).name("TestGet.cfg");
-
+
Config cf = cb.build();
cf.set("Test/A", "a");
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/ConfigMapListenerTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/ConfigMapListenerTest.java
index f10b5d3..76927f9 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/ConfigMapListenerTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/ConfigMapListenerTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -25,26 +25,26 @@ import org.apache.juneau.config.store.*;
import org.junit.*;
public class ConfigMapListenerTest {
-
+
//-----------------------------------------------------------------------------------------------------------------
// Sanity tests.
//-----------------------------------------------------------------------------------------------------------------
-
+
@Test
public void testBasicDefaultSection() throws Exception {
- ConfigStore s = initStore("Foo.cfg",
+ ConfigStore s = initStore("Foo.cfg",
"foo=bar"
- );
-
+ );
+
final CountDownLatch latch = new CountDownLatch(1);
-
+
LatchedListener l = new LatchedListener(latch) {
@Override
public void check(List<ConfigEvent> events) throws Exception {
assertObjectEquals("['SET(foo = baz)']", events);
}
};
-
+
ConfigMap cm = s.getMap("Foo.cfg");
cm.register(l);
cm.setEntry("", "foo", "baz", null, null, null);
@@ -52,26 +52,26 @@ public class ConfigMapListenerTest {
wait(latch);
assertNull(l.error);
cm.unregister(l);
-
+
assertTextEquals("foo = baz|", cm.toString());
}
-
+
@Test
public void testBasicNormalSection() throws Exception {
- ConfigStore s = initStore("Foo.cfg",
+ ConfigStore s = initStore("Foo.cfg",
"[S1]",
"foo=bar"
- );
-
+ );
+
final CountDownLatch latch = new CountDownLatch(1);
-
+
LatchedListener l = new LatchedListener(latch) {
@Override
public void check(List<ConfigEvent> events) throws Exception {
assertObjectEquals("['SET(foo = baz)']", events);
}
};
-
+
ConfigMap cm = s.getMap("Foo.cfg");
cm.register(l);
cm.setEntry("S1", "foo", "baz", null, null, null);
@@ -79,19 +79,19 @@ public class ConfigMapListenerTest {
wait(latch);
assertNull(l.error);
cm.unregister(l);
-
+
assertTextEquals("[S1]|foo = baz|", cm.toString());
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// Add new entries.
//-----------------------------------------------------------------------------------------------------------------
-
+
@Test
public void testAddNewEntries() throws Exception {
ConfigStore s = initStore("Foo.cfg"
- );
-
+ );
+
final CountDownLatch latch = new CountDownLatch(2);
LatchedListener l = new LatchedListener(latch) {
@@ -109,15 +109,15 @@ public class ConfigMapListenerTest {
wait(latch);
assertNull(l.error);
cm.unregister(l);
-
+
assertTextEquals("k = vb|[S1]|k1 = v1b|", cm.toString());
}
-
+
@Test
public void testAddNewEntriesWithAttributes() throws Exception {
ConfigStore s = initStore("Foo.cfg"
- );
-
+ );
+
final CountDownLatch latch = new CountDownLatch(2);
LatchedListener l = new LatchedListener(latch) {
@@ -135,7 +135,7 @@ public class ConfigMapListenerTest {
wait(latch);
assertNull(l.error);
cm.unregister(l);
-
+
assertTextEquals("#k|k^* = kb # C|[S1]|#k1|k1^* = k1b # C1|", cm.toString());
}
@@ -148,8 +148,8 @@ public class ConfigMapListenerTest {
"[S1]",
"#k1a",
"k1=v1a # Cb"
- );
-
+ );
+
final CountDownLatch latch = new CountDownLatch(2);
LatchedListener l = new LatchedListener(latch) {
@@ -167,7 +167,7 @@ public class ConfigMapListenerTest {
wait(latch);
assertNull(l.error);
cm.unregister(l);
-
+
assertTextEquals("#kb|k^* = kb # Cb|#S1|[S1]|#k1b|k1^* = k1b # Cb1|", cm.toString());
}
@@ -181,8 +181,8 @@ public class ConfigMapListenerTest {
"k=v",
"[S1]",
"k1=v1"
- );
-
+ );
+
final CountDownLatch latch = new CountDownLatch(2);
LatchedListener l = new LatchedListener(latch) {
@@ -200,10 +200,10 @@ public class ConfigMapListenerTest {
wait(latch);
assertNull(l.error);
cm.unregister(l);
-
+
assertTextEquals("[S1]|", cm.toString());
}
-
+
@Test
public void testRemoveExistingEntriesWithAttributes() throws Exception {
ConfigStore s = initStore("Foo.cfg",
@@ -213,8 +213,8 @@ public class ConfigMapListenerTest {
"[S1]",
"#k1a",
"k1=v1a # Cb"
- );
-
+ );
+
final CountDownLatch latch = new CountDownLatch(2);
LatchedListener l = new LatchedListener(latch) {
@@ -232,19 +232,19 @@ public class ConfigMapListenerTest {
wait(latch);
assertNull(l.error);
cm.unregister(l);
-
+
assertTextEquals("#S1|[S1]|", cm.toString());
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// Add new sections.
//-----------------------------------------------------------------------------------------------------------------
-
+
@Test
public void testAddNewSections() throws Exception {
ConfigStore s = initStore("Foo.cfg"
- );
-
+ );
+
final CountDownLatch latch = new CountDownLatch(1);
LatchedListener l = new LatchedListener(latch) {
@@ -265,7 +265,7 @@ public class ConfigMapListenerTest {
wait(latch);
assertNull(l.error);
cm.unregister(l);
-
+
assertTextEquals("#D1||#S1|[S1]|[S2]|[S3]|k3 = v3|", cm.toString());
}
@@ -278,8 +278,8 @@ public class ConfigMapListenerTest {
"[S1]",
"[S2]",
"[S3]"
- );
-
+ );
+
final CountDownLatch latch = new CountDownLatch(1);
LatchedListener l = new LatchedListener(latch) {
@@ -300,14 +300,14 @@ public class ConfigMapListenerTest {
wait(latch);
assertNull(l.error);
cm.unregister(l);
-
+
assertTextEquals("#Db||#S1b|[S1]|[S2]|[S3]|k3 = v3|", cm.toString());
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// Remove sections.
//-----------------------------------------------------------------------------------------------------------------
-
+
@Test
public void testRemoveSections() throws Exception {
ConfigStore s = initStore("Foo.cfg",
@@ -323,8 +323,8 @@ public class ConfigMapListenerTest {
"#k2",
"k2 = v2",
"[S3]"
- );
-
+ );
+
final CountDownLatch latch = new CountDownLatch(3);
LatchedListener l = new LatchedListener(latch) {
@@ -344,14 +344,14 @@ public class ConfigMapListenerTest {
wait(latch);
assertNull(l.error);
cm.unregister(l);
-
+
assertTextEquals("", cm.toString());
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// Update from store.
//-----------------------------------------------------------------------------------------------------------------
-
+
@Test
public void testUpdateFromStore() throws Exception {
ConfigStore s = initStore("Foo.cfg");
@@ -364,7 +364,7 @@ public class ConfigMapListenerTest {
assertObjectEquals("['SET(k = v # cv)','SET(k1 = v1 # cv1)','SET(k2 = v2 # cv2)']", events);
}
};
-
+
ConfigMap cm = s.getMap("Foo.cfg");
cm.register(l);
s.update("Foo.cfg",
@@ -384,10 +384,10 @@ public class ConfigMapListenerTest {
wait(latch);
assertNull(l.error);
cm.unregister(l);
-
+
assertTextEquals("#Da||k = v # cv||#S1|[S1]|#k1|k1 = v1 # cv1|[S2]|#k2|k2 = v2 # cv2|[S3]|", cm.toString());
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// Merges.
//-----------------------------------------------------------------------------------------------------------------
@@ -400,17 +400,17 @@ public class ConfigMapListenerTest {
);
final CountDownLatch latch = new CountDownLatch(2);
- final Queue<String> eventList = new ConcurrentLinkedQueue<String>();
+ final Queue<String> eventList = new ConcurrentLinkedQueue<>();
eventList.add("['SET(k1 = v1b)']");
eventList.add("['SET(k2 = v2b)']");
-
+
LatchedListener l = new LatchedListener(latch) {
@Override
public void check(List<ConfigEvent> events) throws Exception {
assertObjectEquals(eventList.poll(), events);
}
};
-
+
ConfigMap cm = s.getMap("Foo.cfg");
cm.register(l);
cm.setEntry("S2", "k2", "v2b", null, null, null);
@@ -422,10 +422,10 @@ public class ConfigMapListenerTest {
wait(latch);
assertNull(l.error);
cm.unregister(l);
-
+
assertTextEquals("[S1]|k1 = v1b|[S2]|k2 = v2b|", cm.toString());
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// If we're modifying an entry and it changes on the file system, we should overwrite the change on save().
//-----------------------------------------------------------------------------------------------------------------
@@ -438,17 +438,17 @@ public class ConfigMapListenerTest {
);
final CountDownLatch latch = new CountDownLatch(2);
- final Queue<String> eventList = new ConcurrentLinkedQueue<String>();
+ final Queue<String> eventList = new ConcurrentLinkedQueue<>();
eventList.add("['SET(k1 = v1b)']");
eventList.add("['SET(k1 = v1c)']");
-
+
LatchedListener l = new LatchedListener(latch) {
@Override
public void check(List<ConfigEvent> events) throws Exception {
assertObjectEquals(eventList.poll(), events);
}
};
-
+
ConfigMap cm = s.getMap("Foo.cfg");
cm.register(l);
cm.setEntry("S1", "k1", "v1c", null, null, null);
@@ -460,41 +460,42 @@ public class ConfigMapListenerTest {
wait(latch);
assertNull(l.error);
cm.unregister(l);
-
+
assertTextEquals("[S1]|k1 = v1c|", cm.toString());
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// If the contents of a file have been modified on the file system before a signal has been received.
//-----------------------------------------------------------------------------------------------------------------
@Test
public void testMergeWithOverwriteNoSignal() throws Exception {
-
- final Queue<String> contents = new ConcurrentLinkedQueue<String>();
+
+ final Queue<String> contents = new ConcurrentLinkedQueue<>();
contents.add("[S1]\nk1 = v1a");
contents.add("[S1]\nk1 = v1b");
contents.add("[S1]\nk1 = v1c");
contents.add("[S1]\nk1 = v1c");
-
+
ConfigMemoryStore s = new ConfigMemoryStore(null) {
+ @Override
public synchronized String read(String name) {
return contents.poll();
}
};
try {
final CountDownLatch latch = new CountDownLatch(2);
- final Queue<String> eventList = new ConcurrentLinkedQueue<String>();
+ final Queue<String> eventList = new ConcurrentLinkedQueue<>();
eventList.add("['SET(k1 = v1b)']");
eventList.add("['SET(k1 = v1c)']");
-
+
LatchedListener l = new LatchedListener(latch) {
@Override
public void check(List<ConfigEvent> events) throws Exception {
assertObjectEquals(eventList.poll(), events);
}
};
-
+
ConfigMap cm = s.getMap("Foo.cfg");
cm.register(l);
cm.setEntry("S1", "k1", "v1c", null, null, null);
@@ -502,26 +503,27 @@ public class ConfigMapListenerTest {
wait(latch);
assertNull(l.error);
cm.unregister(l);
-
+
assertTextEquals("[S1]|k1 = v1c|", cm.toString());
-
+
} finally {
s.close();
}
}
-
+
@Test
public void testMergeWithConstantlyUpdatingFile() throws Exception {
-
+
ConfigMemoryStore s = new ConfigMemoryStore(null) {
char c = 'a';
+ @Override
public synchronized String read(String name) {
return "[S1]\nk1 = v1" + (c++);
}
};
try {
final CountDownLatch latch = new CountDownLatch(10);
- final Queue<String> eventList = new ConcurrentLinkedQueue<String>();
+ final Queue<String> eventList = new ConcurrentLinkedQueue<>();
eventList.add("['SET(k1 = v1b)']");
eventList.add("['SET(k1 = v1c)']");
eventList.add("['SET(k1 = v1d)']");
@@ -532,14 +534,14 @@ public class ConfigMapListenerTest {
eventList.add("['SET(k1 = v1i)']");
eventList.add("['SET(k1 = v1j)']");
eventList.add("['SET(k1 = v1k)']");
-
+
LatchedListener l = new LatchedListener(latch) {
@Override
public void check(List<ConfigEvent> events) throws Exception {
assertObjectEquals(eventList.poll(), events);
}
};
-
+
ConfigMap cm = s.getMap("Foo.cfg");
cm.register(l);
cm.setEntry("S1", "k1", "v1c", null, null, null);
@@ -552,14 +554,14 @@ public class ConfigMapListenerTest {
wait(latch);
assertNull(l.error);
cm.unregister(l);
-
+
assertTextEquals("[S1]|k1 = v1c|", cm.toString());
-
+
} finally {
s.close();
}
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// Utilities.
//-----------------------------------------------------------------------------------------------------------------
@@ -567,14 +569,14 @@ public class ConfigMapListenerTest {
private static ConfigStore initStore(String name, String...contents) {
return ConfigMemoryStore.create().build().update(name, contents);
}
-
+
public static class LatchedListener implements ConfigEventListener {
private final CountDownLatch latch;
private volatile String error = null;
public LatchedListener(CountDownLatch latch) {
this.latch = latch;
}
-
+
@Override
public void onConfigChange(List<ConfigEvent> events) {
try {
@@ -585,11 +587,11 @@ public class ConfigMapListenerTest {
for (int i = 0; i < events.size(); i++)
latch.countDown();
}
-
+
public void check(List<ConfigEvent> events) throws Exception {
}
}
-
+
private static void wait(CountDownLatch latch) throws InterruptedException {
if (! latch.await(10, TimeUnit.SECONDS))
throw new RuntimeException("Latch failed.");
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/ConfigMapTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/ConfigMapTest.java
index 9fce357..fe273ea 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/ConfigMapTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/ConfigMapTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -24,16 +24,16 @@ import org.apache.juneau.config.store.*;
import org.junit.*;
public class ConfigMapTest {
-
+
final static String ENCODED = "*";
final static String BASE64 = "^";
-
+
//-----------------------------------------------------------------------------------------------------------------
// Should be able to read non-existent files without errors.
//-----------------------------------------------------------------------------------------------------------------
@Test
public void testNonExistentConfig() throws Exception {
- ConfigStore s = ConfigMemoryStore.create().build();
+ ConfigStore s = ConfigMemoryStore.create().build();
ConfigMap cm = s.getMap("Foo.cfg");
assertEquals("", cm.toString());
}
@@ -43,11 +43,11 @@ public class ConfigMapTest {
//-----------------------------------------------------------------------------------------------------------------
@Test
public void testBlankConfig() throws Exception {
-
- ConfigStore s = initStore("Foo.cfg", "");
+
+ ConfigStore s = initStore("Foo.cfg", "");
ConfigMap cm = s.getMap("Foo.cfg");
assertEquals("", cm.toString());
-
+
s.update("Foo.cfg", " \n \n ");
cm = s.getMap("Foo.cfg");
}
@@ -57,18 +57,18 @@ public class ConfigMapTest {
//-----------------------------------------------------------------------------------------------------------------
@Test
public void testSimpleOneLine() throws Exception {
- ConfigStore s = initStore("Foo.cfg",
+ ConfigStore s = initStore("Foo.cfg",
"foo=bar"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
assertTextEquals("foo=bar|", cm);
-
+
assertEquals("", join(cm.getPreLines(""), '|'));
assertEquals("", join(cm.getEntry("", "foo").getPreLines(), '|'));
-
+
assertEquals("bar", cm.getEntry("", "foo").getValue());
-
+
// Round trip.
s.update("Foo.cfg", cm.toString());
cm = s.getMap("Foo.cfg");
@@ -80,65 +80,65 @@ public class ConfigMapTest {
//-----------------------------------------------------------------------------------------------------------------
@Test
public void testSimpleOneLineWithComments() throws Exception {
- ConfigStore s = initStore("Foo.cfg",
+ ConfigStore s = initStore("Foo.cfg",
"#comment",
"foo=bar"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
assertTextEquals("#comment|foo=bar|", cm);
assertEquals("", join(cm.getPreLines(""), '|'));
assertEquals("#comment", join(cm.getEntry("", "foo").getPreLines(), '|'));
assertEquals("bar", cm.getEntry("", "foo").getValue());
-
+
// Round trip.
s.update("Foo.cfg", cm.toString());
cm = s.getMap("Foo.cfg");
assertTextEquals("#comment|foo=bar|", cm);
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// Simple section.
//-----------------------------------------------------------------------------------------------------------------
@Test
public void testSimpleSection() throws Exception {
- ConfigStore s = initStore("Foo.cfg",
+ ConfigStore s = initStore("Foo.cfg",
"[MySection]",
"foo=bar"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
assertTextEquals("[MySection]|foo=bar|", cm);
-
+
assertEquals("", join(cm.getPreLines(""), '|'));
assertEquals("", join(cm.getPreLines("MySection"), '|'));
assertEquals("", join(cm.getEntry("MySection", "foo").getPreLines(), '|'));
-
+
assertEquals("bar", cm.getEntry("MySection", "foo").getValue());
-
+
// Round trip.
s.update("Foo.cfg", cm.toString());
cm = s.getMap("Foo.cfg");
assertTextEquals("[MySection]|foo=bar|", cm);
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// Non-existent values should not throw exceptions.
//-----------------------------------------------------------------------------------------------------------------
@Test
public void testNonExistentValues() throws Exception {
- ConfigStore s = initStore("Foo.cfg",
+ ConfigStore s = initStore("Foo.cfg",
"[MySection]",
"foo=bar"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
assertTextEquals("[MySection]|foo=bar|", cm);
-
+
assertEquals("", join(cm.getPreLines(""), '|'));
-
+
assertNull(cm.getPreLines("XXX"));
assertNull(cm.getEntry("XXX", "yyy"));
@@ -150,7 +150,7 @@ public class ConfigMapTest {
//-----------------------------------------------------------------------------------------------------------------
@Test
public void testSimpleSectionWithComments() throws Exception {
- ConfigStore s = initStore("Foo.cfg",
+ ConfigStore s = initStore("Foo.cfg",
"#S1",
"[S1]",
"#k1",
@@ -159,16 +159,16 @@ public class ConfigMapTest {
"[S2]",
"#k2",
"k2=v2"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
assertTextEquals("#S1|[S1]|#k1|k1=v1|#S2|[S2]|#k2|k2=v2|", cm);
-
+
assertEquals("", join(cm.getPreLines(""), '|'));
assertEquals("#S1", join(cm.getPreLines("S1"), '|'));
assertEquals("#k1", join(cm.getEntry("S1", "k1").getPreLines(), '|'));
assertEquals("#S2", join(cm.getPreLines("S2"), '|'));
assertEquals("#k2", join(cm.getEntry("S2", "k2").getPreLines(), '|'));
-
+
assertEquals("v1", cm.getEntry("S1", "k1").getValue());
assertEquals("v2", cm.getEntry("S2", "k2").getValue());
@@ -177,13 +177,13 @@ public class ConfigMapTest {
cm = s.getMap("Foo.cfg");
assertTextEquals("#S1|[S1]|#k1|k1=v1|#S2|[S2]|#k2|k2=v2|", cm);
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// testSimpleAndDefaultSectionsWithComments
//-----------------------------------------------------------------------------------------------------------------
@Test
public void testSimpleAndDefaultSectionsWithComments() throws Exception {
- ConfigStore s = initStore("Foo.cfg",
+ ConfigStore s = initStore("Foo.cfg",
"#D",
"",
"#k",
@@ -192,7 +192,7 @@ public class ConfigMapTest {
"[S1]",
"#k1",
"k1=v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
assertTextEquals("#D||#k|k=v|#S1|[S1]|#k1|k1=v1|", cm);
@@ -200,22 +200,22 @@ public class ConfigMapTest {
assertEquals("#k", join(cm.getEntry("", "k").getPreLines(), '|'));
assertEquals("#S1", join(cm.getPreLines("S1"), '|'));
assertEquals("#k1", join(cm.getEntry("S1", "k1").getPreLines(), '|'));
-
+
assertEquals("v", cm.getEntry("", "k").getValue());
assertEquals("v1", cm.getEntry("S1", "k1").getValue());
-
+
// Round trip.
s.update("Foo.cfg", cm.toString());
cm = s.getMap("Foo.cfg");
assertTextEquals("#D||#k|k=v|#S1|[S1]|#k1|k1=v1|", cm);
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// testSimpleAndDefaultSectionsWithCommentsAndExtraSpaces
//-----------------------------------------------------------------------------------------------------------------
@Test
public void testSimpleAndDefaultSectionsWithCommentsAndExtraSpaces() throws Exception {
- ConfigStore s = initStore("Foo.cfg",
+ ConfigStore s = initStore("Foo.cfg",
"#Da",
"#Db",
"",
@@ -236,7 +236,7 @@ public class ConfigMapTest {
"#k1b",
"",
"k1=v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
assertTextEquals("#Da|#Db||#ka||#kb||k=v||#S1a||#S1b||[S1]||#k1a||#k1b||k1=v1|", cm);
@@ -244,10 +244,10 @@ public class ConfigMapTest {
assertEquals("#ka||#kb|", join(cm.getEntry("", "k").getPreLines(), '|'));
assertEquals("|#S1a||#S1b|", join(cm.getPreLines("S1"), '|'));
assertEquals("|#k1a||#k1b|", join(cm.getEntry("S1", "k1").getPreLines(), '|'));
-
+
assertEquals("v", cm.getEntry("", "k").getValue());
assertEquals("v1", cm.getEntry("S1", "k1").getValue());
-
+
// Round trip.
s.update("Foo.cfg", cm.toString());
cm = s.getMap("Foo.cfg");
@@ -259,16 +259,16 @@ public class ConfigMapTest {
//-----------------------------------------------------------------------------------------------------------------
@Test
public void testMalformedSectionHeaders() throws Exception {
-
+
String[] test = {
"[]", "[ ]",
- "[/]", "[[]", "[]]", "[\\]",
- "[foo/bar]", "[foo[bar]", "[foo]bar]", "[foo\\bar]",
+ "[/]", "[[]", "[]]", "[\\]",
+ "[foo/bar]", "[foo[bar]", "[foo]bar]", "[foo\\bar]",
"[]", "[ ]", "[\t]",
};
-
+
for (String t : test) {
- ConfigStore s = initStore("Foo.cfg", t);
+ ConfigStore s = initStore("Foo.cfg", t);
try {
s.getMap("Foo.cfg");
fail("Exception expected on t=["+t+"].");
@@ -277,44 +277,44 @@ public class ConfigMapTest {
}
}
}
-
+
@Test
public void testDuplicateSectionNames() throws Exception {
- ConfigStore s = initStore("Foo.cfg", "[S1]", "[S1]");
+ ConfigStore s = initStore("Foo.cfg", "[S1]", "[S1]");
try {
s.getMap("Foo.cfg");
fail("Exception expected.");
} catch (ConfigException e) {
assertEquals("Duplicate section found in configuration: [S1]", e.getLocalizedMessage());
}
- }
+ }
@Test
public void testDuplicateEntryNames() throws Exception {
- ConfigStore s = initStore("Foo.cfg", "[S1]", "foo=v1", "foo=v2");
+ ConfigStore s = initStore("Foo.cfg", "[S1]", "foo=v1", "foo=v2");
try {
s.getMap("Foo.cfg");
fail("Exception expected.");
} catch (ConfigException e) {
assertEquals("Duplicate entry found in section [S1] of configuration: foo", e.getLocalizedMessage());
}
- }
-
+ }
+
//-----------------------------------------------------------------------------------------------------------------
// Lines can be split up.
//-----------------------------------------------------------------------------------------------------------------
@Test
public void testMultipleLines() throws Exception {
- ConfigStore s = initStore("Foo.cfg",
+ ConfigStore s = initStore("Foo.cfg",
"k1 = v1a,",
"\tv1b,",
"\tv1c",
"k2 = v2a,",
"\tv2b,",
"\tv2c"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
assertEquals("", join(cm.getEntry("", "k1").getPreLines(), '|'));
assertEquals("", join(cm.getEntry("", "k2").getPreLines(), '|'));
@@ -322,7 +322,7 @@ public class ConfigMapTest {
assertEquals("v1a,\nv1b,\nv1c", cm.getEntry("", "k1").getValue());
assertEquals("v2a,\nv2b,\nv2c", cm.getEntry("", "k2").getValue());
-
+
// Round trip.
s.update("Foo.cfg", cm.toString());
cm = s.getMap("Foo.cfg");
@@ -331,7 +331,7 @@ public class ConfigMapTest {
@Test
public void testMultipleLinesWithSpacesAndComments() throws Exception {
- ConfigStore s = initStore("Foo.cfg",
+ ConfigStore s = initStore("Foo.cfg",
"",
"#k1",
"",
@@ -344,9 +344,9 @@ public class ConfigMapTest {
"k2 = v2a,",
"\tv2b,",
"\tv2c"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
assertEquals("|#k1|", join(cm.getEntry("", "k1").getPreLines(), '|'));
assertEquals("|#k2|", join(cm.getEntry("", "k2").getPreLines(), '|'));
@@ -354,7 +354,7 @@ public class ConfigMapTest {
assertEquals("v1a,\nv1b,\nv1c", cm.getEntry("", "k1").getValue());
assertEquals("v2a,\nv2b,\nv2c", cm.getEntry("", "k2").getValue());
-
+
// Round trip.
s.update("Foo.cfg", cm.toString());
cm = s.getMap("Foo.cfg");
@@ -363,7 +363,7 @@ public class ConfigMapTest {
@Test
public void testMultipleLinesInSection() throws Exception {
- ConfigStore s = initStore("Foo.cfg",
+ ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1a,",
"\tv1b,",
@@ -371,9 +371,9 @@ public class ConfigMapTest {
"k2 = v2a,",
"\tv2b,",
"\tv2c"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
assertEquals("", join(cm.getEntry("S1", "k1").getPreLines(), '|'));
assertEquals("", join(cm.getEntry("S1", "k2").getPreLines(), '|'));
@@ -381,7 +381,7 @@ public class ConfigMapTest {
assertEquals("v1a,\nv1b,\nv1c", cm.getEntry("S1", "k1").getValue());
assertEquals("v2a,\nv2b,\nv2c", cm.getEntry("S1", "k2").getValue());
-
+
// Round trip.
s.update("Foo.cfg", cm.toString());
cm = s.getMap("Foo.cfg");
@@ -407,9 +407,9 @@ public class ConfigMapTest {
"k2 = v2a,",
"\tv2b,",
"\tv2c"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
assertEquals("|#S1|", join(cm.getPreLines("S1"), '|'));
assertEquals("|#k1|", join(cm.getEntry("S1", "k1").getPreLines(), '|'));
assertEquals("|#k2|", join(cm.getEntry("S1", "k2").getPreLines(), '|'));
@@ -418,13 +418,13 @@ public class ConfigMapTest {
assertEquals("v1a,\nv1b,\nv1c", cm.getEntry("S1", "k1").getValue());
assertEquals("v2a,\nv2b,\nv2c", cm.getEntry("S1", "k2").getValue());
-
+
// Round trip.
s.update("Foo.cfg", cm.toString());
cm = s.getMap("Foo.cfg");
assertTextEquals("|#S1||[S1]||#k1||k1 = v1a,| v1b,| v1c||#k2||k2 = v2a,| v2b,| v2c|", cm);
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// Entry lines can have trailing comments.
//-----------------------------------------------------------------------------------------------------------------
@@ -433,42 +433,42 @@ public class ConfigMapTest {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = foo # comment"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
assertTextEquals("[S1]|k1 = foo # comment|", cm);
assertEquals("foo", cm.getEntry("S1", "k1").getValue());
assertEquals("comment", cm.getEntry("S1", "k1").getComment());
-
+
cm.setEntry("S1", "k1", null, null, "newcomment", null);
assertTextEquals("[S1]|k1 = foo # newcomment|", cm);
assertEquals("foo", cm.getEntry("S1", "k1").getValue());
assertEquals("newcomment", cm.getEntry("S1", "k1").getComment());
-
+
cm.setEntry("S1", "k1", null, null, "", null);
assertTextEquals("[S1]|k1 = foo|", cm);
assertEquals("foo", cm.getEntry("S1", "k1").getValue());
assertEquals("", cm.getEntry("S1", "k1").getComment());
-
+
cm.setEntry("S1", "k1", null, null, null, null);
assertTextEquals("[S1]|k1 = foo|", cm);
assertEquals("foo", cm.getEntry("S1", "k1").getValue());
assertEquals("", cm.getEntry("S1", "k1").getComment());
}
-
+
@Test
public void testEntriesWithOddComments() throws Exception {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = foo#",
"k2 = foo # "
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
assertTextEquals("[S1]|k1 = foo#|k2 = foo # |", cm);
assertEquals("", cm.getEntry("S1", "k1").getComment());
assertEquals("", cm.getEntry("S1", "k2").getComment());
}
-
+
@Test
public void testEntriesWithEscapedComments() throws Exception {
ConfigStore s = initStore("Foo.cfg",
@@ -476,10 +476,10 @@ public class ConfigMapTest {
"k1 = foo\\#bar",
"k2 = foo \\# bar",
"k3 = foo \\# bar # real-comment"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
assertTextEquals("[S1]|k1 = foo\\#bar|k2 = foo \\# bar|k3 = foo \\# bar # real-comment|", cm);
-
+
assertEquals(null, cm.getEntry("S1", "k1").getComment());
assertEquals(null, cm.getEntry("S1", "k2").getComment());
assertEquals("real-comment", cm.getEntry("S1", "k3").getComment());
@@ -494,23 +494,23 @@ public class ConfigMapTest {
"[S1]",
"k1 = v1a",
"k2 = v2a"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S1", "k1", "v1b", null, null, null);
cm.setEntry("S1", "k2", null, null, null, null);
cm.setEntry("S1", "k3", "v3b", null, null, null);
-
+
assertTextEquals("[S1]|k1 = v1b|k2 = v2a|k3 = v3b|", cm);
-
+
cm.commit();
assertTextEquals("[S1]|k1 = v1b|k2 = v2a|k3 = v3b|", s.read("Foo.cfg"));
-
+
// Round trip.
cm = s.getMap("Foo.cfg");
assertTextEquals("[S1]|k1 = v1b|k2 = v2a|k3 = v3b|", cm);
}
-
+
@Test
public void testSettingEntriesWithPreLines() throws Exception {
ConfigStore s = initStore("Foo.cfg",
@@ -526,59 +526,59 @@ public class ConfigMapTest {
"#k2",
"",
"k2 = v2a"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S1", "k1", "v1b", null, null, null);
cm.setEntry("S1", "k2", null, null, null, null);
cm.setEntry("S1", "k3", "v3b", null, null, null);
cm.setEntry("S1", "k4", "v4b", null, null, Arrays.asList("","#k4",""));
-
+
assertTextEquals("|#S1||[S1]||#k1||k1 = v1b||#k2||k2 = v2a|k3 = v3b||#k4||k4 = v4b|", cm);
-
+
cm.commit();
assertTextEquals("|#S1||[S1]||#k1||k1 = v1b||#k2||k2 = v2a|k3 = v3b||#k4||k4 = v4b|", s.read("Foo.cfg"));
-
+
// Round trip.
cm = s.getMap("Foo.cfg");
assertTextEquals("|#S1||[S1]||#k1||k1 = v1b||#k2||k2 = v2a|k3 = v3b||#k4||k4 = v4b|", cm);
}
-
+
@Test
public void testSettingEntriesWithNewlines() throws Exception {
- ConfigStore s = initStore("Foo.cfg");
+ ConfigStore s = initStore("Foo.cfg");
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("", "k", "v1\nv2\nv3", null, null, null);
cm.setEntry("S1", "k1", "v1\nv2\nv3", null, null, null);
-
+
assertTextEquals("k = v1| v2| v3|[S1]|k1 = v1| v2| v3|", cm);
-
+
assertEquals("v1\nv2\nv3", cm.getEntry("", "k").getValue());
assertEquals("v1\nv2\nv3", cm.getEntry("S1", "k1").getValue());
cm.commit();
assertTextEquals("k = v1| v2| v3|[S1]|k1 = v1| v2| v3|", cm);
-
+
// Round trip.
cm = s.getMap("Foo.cfg");
assertTextEquals("k = v1| v2| v3|[S1]|k1 = v1| v2| v3|", cm);
}
-
+
@Test
public void testSettingEntriesWithNewlinesAndSpaces() throws Exception {
- ConfigStore s = initStore("Foo.cfg");
+ ConfigStore s = initStore("Foo.cfg");
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("", "k", "v1 \n v2 \n v3", null, null, null);
cm.setEntry("S1", "k1", "v1\t\n\tv2\t\n\tv3", null, null, null);
-
+
assertTextEquals("k = v1 | v2 | v3|[S1]|k1 = v1 | v2 | v3|", cm);
-
+
assertEquals("v1 \n v2 \n v3", cm.getEntry("", "k").getValue());
assertEquals("v1\t\n\tv2\t\n\tv3", cm.getEntry("S1", "k1").getValue());
cm.commit();
assertTextEquals("k = v1 | v2 | v3|[S1]|k1 = v1 | v2 | v3|", cm);
-
+
// Round trip.
cm = s.getMap("Foo.cfg");
assertTextEquals("k = v1 | v2 | v3|[S1]|k1 = v1 | v2 | v3|", cm);
@@ -592,9 +592,9 @@ public class ConfigMapTest {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setSection("S1", Arrays.asList("#S1"));
assertTextEquals("#S1|[S1]|k1 = v1|", cm);
cm.setSection("S1", Collections.<String>emptyList());
@@ -602,15 +602,15 @@ public class ConfigMapTest {
cm.setSection("S1", null);
assertTextEquals("[S1]|k1 = v1|", cm);
}
-
+
@Test
public void testSetSectionOnDefaultSection() throws Exception {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setSection("", Arrays.asList("#D"));
assertTextEquals("#D||[S1]|k1 = v1|", cm);
cm.setSection("", Collections.<String>emptyList());
@@ -624,9 +624,9 @@ public class ConfigMapTest {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setSection("S2", Arrays.asList("#S2"));
assertTextEquals("[S1]|k1 = v1|#S2|[S2]|", cm);
cm.setSection("S3", Collections.<String>emptyList());
@@ -637,16 +637,16 @@ public class ConfigMapTest {
@Test
public void testSetSectionBadNames() throws Exception {
- ConfigStore s = initStore("Foo.cfg");
+ ConfigStore s = initStore("Foo.cfg");
ConfigMap cm = s.getMap("Foo.cfg");
-
+
String[] test = {
"/", "[", "]",
- "foo/bar", "foo[bar", "foo]bar",
+ "foo/bar", "foo[bar", "foo]bar",
" ",
null
};
-
+
for (String t : test) {
try {
cm.setSection(t, null);
@@ -656,21 +656,21 @@ public class ConfigMapTest {
}
}
}
-
+
@Test
public void testSetSectionOkNames() throws Exception {
- ConfigStore s = initStore("Foo.cfg");
+ ConfigStore s = initStore("Foo.cfg");
ConfigMap cm = s.getMap("Foo.cfg");
// These are all okay characters to use in section names.
String validChars = "~`!@#$%^&*()_-+={}|:;\"\'<,>.?";
-
+
for (char c : validChars.toCharArray()) {
String test = ""+c;
cm.setSection(test, Arrays.asList("test"));
cm.commit();
assertEquals("test", cm.getPreLines(test).get(0));
-
+
test = "foo"+c+"bar";
cm.setSection(test, Arrays.asList("test"));
cm.commit();
@@ -688,14 +688,14 @@ public class ConfigMapTest {
"k1 = v1",
"[S2]",
"k2 = v2"
-
- );
+
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.removeSection("S1");
assertTextEquals("[S2]|k2 = v2|", cm);
}
-
+
@Test
public void testRemoveSectionOnNonExistingSection() throws Exception {
ConfigStore s = initStore("Foo.cfg",
@@ -703,13 +703,13 @@ public class ConfigMapTest {
"k1 = v1",
"[S2]",
"k2 = v2"
-
- );
+
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.removeSection("S3");
assertTextEquals("[S1]|k1 = v1|[S2]|k2 = v2|", cm);
-
+
try {
cm.removeSection(null);
fail();
@@ -726,14 +726,14 @@ public class ConfigMapTest {
"k1 = v1",
"[S2]",
"k2 = v2"
-
- );
+
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.removeSection("");
assertTextEquals("[S1]|k1 = v1|[S2]|k2 = v2|", cm);
}
-
+
@Test
public void testRemoveDefaultSectionWithComments() throws Exception {
ConfigStore s = initStore("Foo.cfg",
@@ -745,14 +745,14 @@ public class ConfigMapTest {
"k1 = v1",
"[S2]",
"k2 = v2"
-
- );
+
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.removeSection("");
assertTextEquals("[S1]|k1 = v1|[S2]|k2 = v2|", cm);
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// setPreLines()
//-----------------------------------------------------------------------------------------------------------------
@@ -761,9 +761,9 @@ public class ConfigMapTest {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S1", "k1", null, null, null, Arrays.asList("#k1"));
assertTextEquals("[S1]|#k1|k1 = v1|", cm);
cm.setEntry("S1", "k1", null, null, null, Collections.<String>emptyList());
@@ -771,16 +771,16 @@ public class ConfigMapTest {
cm.setEntry("S1", "k1", null, null, null, null);
assertTextEquals("[S1]|k1 = v1|", cm);
}
-
+
@Test
public void testSetPrelinesOnExistingEntryWithAtrributes() throws Exception {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"#k1a",
"k1 = v1 # comment"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S1", "k1", null, null, null, Arrays.asList("#k1b"));
assertTextEquals("[S1]|#k1b|k1 = v1 # comment|", cm);
}
@@ -790,16 +790,16 @@ public class ConfigMapTest {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S1", "k2", null, null, null, Arrays.asList("#k2"));
assertTextEquals("[S1]|k1 = v1|", cm);
cm.setEntry("S1", "k2", null, null, null, Collections.<String>emptyList());
assertTextEquals("[S1]|k1 = v1|", cm);
cm.setEntry("S1", "k2", null, null, null, null);
assertTextEquals("[S1]|k1 = v1|", cm);
-
+
cm.setEntry("S2", "k2", null, null, null, Arrays.asList("#k2"));
assertTextEquals("[S1]|k1 = v1|[S2]|", cm);
cm.setEntry("S2", "k2", null, null, null, Collections.<String>emptyList());
@@ -816,22 +816,22 @@ public class ConfigMapTest {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S1", "k1", "v2", null, null, null);
assertTextEquals("[S1]|k1 = v2|", cm);
}
-
+
@Test
public void testSetValueOnExistingEntryWithAttributes() throws Exception {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"#k1",
"k1 = v1 # comment"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S1", "k1", "v2", null, null, null);
assertTextEquals("[S1]|#k1|k1 = v2 # comment|", cm);
}
@@ -841,9 +841,9 @@ public class ConfigMapTest {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S1", "k1", null, null, null, null);
assertTextEquals("[S1]|k1 = v1|", cm);
}
@@ -853,9 +853,9 @@ public class ConfigMapTest {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S1", "k2", "v2", null, null, null);
assertTextEquals("[S1]|k1 = v1|k2 = v2|", cm);
cm.setEntry("S1", "k2", null, null, null, null);
@@ -863,31 +863,31 @@ public class ConfigMapTest {
cm.setEntry("S1", "k2", null, null, null, null);
assertTextEquals("[S1]|k1 = v1|k2 = v2|", cm);
}
-
+
@Test
public void testSetValueOnNonExistingEntryOnNonExistentSection() throws Exception {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S2", "k2", "v2", null, null, null);
assertTextEquals("[S1]|k1 = v1|[S2]|k2 = v2|", cm);
}
@Test
public void testSetValueInvalidSectionNames() throws Exception {
- ConfigStore s = initStore("Foo.cfg");
+ ConfigStore s = initStore("Foo.cfg");
ConfigMap cm = s.getMap("Foo.cfg");
-
+
String[] test = {
"/", "[", "]",
- "foo/bar", "foo[bar", "foo]bar",
+ "foo/bar", "foo[bar", "foo]bar",
" ",
null
};
-
+
for (String t : test) {
try {
cm.setEntry(t, "k1", "foo", null, null, null);
@@ -900,9 +900,9 @@ public class ConfigMapTest {
@Test
public void testSetValueInvalidKeyNames() throws Exception {
- ConfigStore s = initStore("Foo.cfg");
+ ConfigStore s = initStore("Foo.cfg");
ConfigMap cm = s.getMap("Foo.cfg");
-
+
String[] test = {
"", " ", "\t",
"foo=bar", "=",
@@ -913,7 +913,7 @@ public class ConfigMapTest {
"foo#bar", "#",
null
};
-
+
for (String t : test) {
try {
cm.setEntry("S1", t, "foo", null, null, null);
@@ -923,20 +923,20 @@ public class ConfigMapTest {
}
}
}
-
+
@Test
public void testSetValueWithCommentChars() throws Exception {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
// If value has # in it, it should get escaped.
cm.setEntry("S1", "k1", "v1 # foo", null, null, null);
assertTextEquals("[S1]|k1 = v1 \\u0023 foo|", cm);
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// setComment()
//-----------------------------------------------------------------------------------------------------------------
@@ -945,9 +945,9 @@ public class ConfigMapTest {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S1", "k1", null, null, "c1", null);
assertTextEquals("[S1]|k1 = v1 # c1|", cm);
@@ -955,20 +955,20 @@ public class ConfigMapTest {
assertTextEquals("[S1]|k1 = v1|", cm);
cm.commit();
assertTextEquals("[S1]|k1 = v1|", cm);
-
+
cm.setEntry("S1", "k1", null, null, null, null);
assertTextEquals("[S1]|k1 = v1|", cm);
}
-
+
@Test
public void testSetCommentOnExistingEntryWithAttributes() throws Exception {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"#k1a",
"k1 = v1 # c1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S1", "k1", null, null, "c2", null);
assertTextEquals("[S1]|#k1a|k1 = v1 # c2|", cm);
}
@@ -978,20 +978,20 @@ public class ConfigMapTest {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S1", "k2", null, null, "foo", null);
assertTextEquals("[S1]|k1 = v1|", cm);
cm.setEntry("S1", "k2", null, null, null, null);
assertTextEquals("[S1]|k1 = v1|", cm);
-
+
cm.setEntry("S2", "k2", null, null, "foo", null);
assertTextEquals("[S1]|k1 = v1|[S2]|", cm);
cm.setEntry("S2", "k2", null, null, null, null);
assertTextEquals("[S1]|k1 = v1|[S2]|", cm);
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// setValue()
//-----------------------------------------------------------------------------------------------------------------
@@ -1000,9 +1000,9 @@ public class ConfigMapTest {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S1", "k1", "v2", null, null, null);
assertTextEquals("[S1]|k1 = v2|", cm);
@@ -1012,16 +1012,16 @@ public class ConfigMapTest {
cm.setEntry("S1", "k1", "v4", BASE64, "c4", Arrays.asList("#k1b"));
assertTextEquals("[S1]|#k1b|k1^ = v4 # c4|", cm);
}
-
+
@Test
public void testSetEntryOnExistingEntryWithAttributes() throws Exception {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"#k1",
"k1 = v1 # comment"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S1", "k1", "v2", null, null, null);
assertTextEquals("[S1]|#k1|k1 = v2 # comment|", cm);
@@ -1037,21 +1037,21 @@ public class ConfigMapTest {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S1", "k1", null, null, null, null);
assertTextEquals("[S1]|k1 = v1|", cm);
}
-
+
@Test
public void testSetEntryOnNonExistingEntry() throws Exception {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S1", "k2", "v2", null, null, null);
assertTextEquals("[S1]|k1 = v1|k2 = v2|", cm);
cm.setEntry("S1", "k2", null, null, null, null);
@@ -1059,31 +1059,31 @@ public class ConfigMapTest {
cm.setEntry("S1", "k2", "", null, null, null);
assertTextEquals("[S1]|k1 = v1|k2 = |", cm);
}
-
+
@Test
public void testSetEntryOnNonExistingEntryOnNonExistentSection() throws Exception {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
cm.setEntry("S2", "k2", "v2", null, null, null);
assertTextEquals("[S1]|k1 = v1|[S2]|k2 = v2|", cm);
}
@Test
public void testSetEntryInvalidSectionNames() throws Exception {
- ConfigStore s = initStore("Foo.cfg");
+ ConfigStore s = initStore("Foo.cfg");
ConfigMap cm = s.getMap("Foo.cfg");
-
+
String[] test = {
"/", "[", "]",
- "foo/bar", "foo[bar", "foo]bar",
+ "foo/bar", "foo[bar", "foo]bar",
" ",
null
};
-
+
for (String t : test) {
try {
cm.setEntry(t, "k1", "foo", null, null, null);
@@ -1096,9 +1096,9 @@ public class ConfigMapTest {
@Test
public void testSetEntryInvalidKeyNames() throws Exception {
- ConfigStore s = initStore("Foo.cfg");
+ ConfigStore s = initStore("Foo.cfg");
ConfigMap cm = s.getMap("Foo.cfg");
-
+
String[] test = {
"", " ", "\t",
"foo=bar", "=",
@@ -1109,7 +1109,7 @@ public class ConfigMapTest {
"foo#bar", "#",
null
};
-
+
for (String t : test) {
try {
cm.setEntry("S1", t, "foo", null, null, null);
@@ -1119,20 +1119,20 @@ public class ConfigMapTest {
}
}
}
-
+
@Test
public void testSetEntryWithCommentChars() throws Exception {
ConfigStore s = initStore("Foo.cfg",
"[S1]",
"k1 = v1"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
// If value has # in it, it should get escaped.
cm.setEntry("S1", "k1", "v1 # foo", null, null, null);
assertTextEquals("[S1]|k1 = v1 \\u0023 foo|", cm);
}
-
+
//-----------------------------------------------------------------------------------------------------------------
// Modifiers
//-----------------------------------------------------------------------------------------------------------------
@@ -1143,9 +1143,9 @@ public class ConfigMapTest {
"k1^ = v1",
"k2* = v2",
"k3*^ = v3"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
assertTextEquals("[S1]|k1^ = v1|k2* = v2|k3*^ = v3|", cm);
assertTrue(cm.getEntry("S1", "k1").hasModifier('^'));
assertFalse(cm.getEntry("S1", "k1").hasModifier('*'));
@@ -1153,11 +1153,11 @@ public class ConfigMapTest {
assertTrue(cm.getEntry("S1", "k2").hasModifier('*'));
assertTrue(cm.getEntry("S1", "k3").hasModifier('^'));
assertTrue(cm.getEntry("S1", "k3").hasModifier('*'));
-
+
cm.setEntry("S1", "k1", "v1", "#$%&*+^@~", null, null);
assertTextEquals("[S1]|k1#$%&*+^@~ = v1|k2* = v2|k3*^ = v3|", cm);
}
-
+
@Test
public void testInvalidModifier() throws Exception {
ConfigStore s = initStore("Foo.cfg",
@@ -1165,9 +1165,9 @@ public class ConfigMapTest {
"k1^ = v1",
"k2* = v2",
"k3*^ = v3"
- );
+ );
ConfigMap cm = s.getMap("Foo.cfg");
-
+
// This is okay.
cm.setEntry("S1", "k1", "v1", "", null, null);
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/ConfigTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/ConfigTest.java
index 701107f..6e22f56 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/ConfigTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/ConfigTest.java
@@ -34,7 +34,7 @@ import org.junit.*;
public class ConfigTest {
private ConfigBuilder cb = new ConfigBuilder().store(ConfigMemoryStore.DEFAULT).name("Test.cfg");
-
+
private Config init(String...lines) {
ConfigMemoryStore.DEFAULT.update("Test.cfg", lines);
return cb.build().rollback();
@@ -46,14 +46,14 @@ public class ConfigTest {
@Test
public void get() throws Exception {
Config c = init("a=1", "[S]", "b=2");
-
+
assertEquals("1", c.get("a"));
assertEquals("1", c.get("a"));
assertEquals("2", c.get("S/b"));
assertNull(c.get("b"));
assertNull(c.get("S/c"));
assertNull(c.get("T/d"));
-
+
try {
assertNull(c.get(null));
fail();
@@ -69,23 +69,23 @@ public class ConfigTest {
@Test
public void set1() throws Exception {
Config c = init("a1=1", "[S]", "b1=1");
-
+
c.set("a1", "2");
c.set("a2", "3");
c.set("a3", "4");
c.set("S/b1", "5");
c.set("S/b2", "6");
c.set("T/c1", "7");
-
+
assertEquals("2", c.get("a1"));
assertEquals("3", c.get("a2"));
assertEquals("4", c.get("a3"));
assertEquals("5", c.get("S/b1"));
assertEquals("6", c.get("S/b2"));
assertEquals("7", c.get("T/c1"));
-
+
c.commit();
-
+
assertEquals("2", c.get("a1"));
assertEquals("3", c.get("a2"));
assertEquals("4", c.get("a3"));
@@ -94,14 +94,14 @@ public class ConfigTest {
assertEquals("7", c.get("T/c1"));
c = cb.build();
-
+
assertEquals("2", c.get("a1"));
assertEquals("3", c.get("a2"));
assertEquals("4", c.get("a3"));
assertEquals("5", c.get("S/b1"));
assertEquals("6", c.get("S/b2"));
assertEquals("7", c.get("T/c1"));
-
+
assertTextEquals("a1 = 2|a2 = 3|a3 = 4|[S]|b1 = 5|b2 = 6|[T]|c1 = 7|", c.toString());
}
@@ -111,23 +111,23 @@ public class ConfigTest {
@Test
public void set2() throws Exception {
Config c = init("a1=1", "[S]", "b1=1");
-
+
c.set("a1", 2);
c.set("a2", 3);
c.set("a3", 4);
c.set("S/b1", 5);
c.set("S/b2", 6);
c.set("T/c1", 7);
-
+
assertEquals("2", c.get("a1"));
assertEquals("3", c.get("a2"));
assertEquals("4", c.get("a3"));
assertEquals("5", c.get("S/b1"));
assertEquals("6", c.get("S/b2"));
assertEquals("7", c.get("T/c1"));
-
+
c.commit();
-
+
assertEquals("2", c.get("a1"));
assertEquals("3", c.get("a2"));
assertEquals("4", c.get("a3"));
@@ -136,24 +136,24 @@ public class ConfigTest {
assertEquals("7", c.get("T/c1"));
c = cb.build();
-
+
assertEquals("2", c.get("a1"));
assertEquals("3", c.get("a2"));
assertEquals("4", c.get("a3"));
assertEquals("5", c.get("S/b1"));
assertEquals("6", c.get("S/b2"));
assertEquals("7", c.get("T/c1"));
-
+
assertTextEquals("a1 = 2|a2 = 3|a3 = 4|[S]|b1 = 5|b2 = 6|[T]|c1 = 7|", c.toString());
}
-
+
//====================================================================================================
// public Config set(String key, Object value, Serializer serializer) throws SerializeException {
//====================================================================================================
@Test
public void set3() throws Exception {
Config c = init("a1=1", "[S]", "b1=1");
-
+
ABean b = new ABean().init();
c.set("a1", b, UonSerializer.DEFAULT);
c.set("a2", b, UonSerializer.DEFAULT);
@@ -161,7 +161,7 @@ public class ConfigTest {
c.set("S/b1", b, UonSerializer.DEFAULT);
c.set("S/b2", b, UonSerializer.DEFAULT);
c.set("T/c1", b, UonSerializer.DEFAULT);
-
+
assertEquals("(foo=bar)", c.get("a1"));
assertEquals("(foo=bar)", c.get("a2"));
assertEquals("(foo=bar)", c.get("a3"));
@@ -169,14 +169,14 @@ public class ConfigTest {
assertEquals("(foo=bar)", c.get("S/b2"));
assertEquals("(foo=bar)", c.get("T/c1"));
}
-
+
//====================================================================================================
// public Config set(String key, Object value, Serializer serializer, ConfigMod[] modifiers, String comment, List<String> preLines) throws SerializeException {
//====================================================================================================
@Test
public void set4() throws Exception {
Config c = init("a1=1", "[S]", "b1=1");
-
+
ABean b = new ABean().init();
c.set("a1", b, UonSerializer.DEFAULT, ENCODED, "comment", Arrays.asList("#c1","#c2"));
c.set("a2", b, UonSerializer.DEFAULT, ENCODED, "comment", Arrays.asList("#c1","#c2"));
@@ -184,7 +184,7 @@ public class ConfigTest {
c.set("S/b1", b, UonSerializer.DEFAULT, ENCODED, "comment", Arrays.asList("#c1","#c2"));
c.set("S/b2", b, UonSerializer.DEFAULT, ENCODED, "comment", Arrays.asList("#c1","#c2"));
c.set("T/c1", b, UonSerializer.DEFAULT, ENCODED, "comment", Arrays.asList("#c1","#c2"));
-
+
assertTextEquals("#c1|#c2|a1* = {RhMWWFIFVksf} # comment|#c1|#c2|a2* = {RhMWWFIFVksf} # comment|#c1|#c2|a3* = {RhMWWFIFVksf} # comment|[S]|#c1|#c2|b1* = {RhMWWFIFVksf} # comment|#c1|#c2|b2* = {RhMWWFIFVksf} # comment|[T]|#c1|#c2|c1* = {RhMWWFIFVksf} # comment|", c.toString());
c.commit();
assertTextEquals("#c1|#c2|a1* = {RhMWWFIFVksf} # comment|#c1|#c2|a2* = {RhMWWFIFVksf} # comment|#c1|#c2|a3* = {RhMWWFIFVksf} # comment|[S]|#c1|#c2|b1* = {RhMWWFIFVksf} # comment|#c1|#c2|b2* = {RhMWWFIFVksf} # comment|[T]|#c1|#c2|c1* = {RhMWWFIFVksf} # comment|", c.toString());
@@ -198,20 +198,20 @@ public class ConfigTest {
assertEquals("(foo=bar)", c.get("S/b2"));
assertEquals("(foo=bar)", c.get("T/c1"));
}
-
+
//====================================================================================================
// public Config remove(String key) {
//====================================================================================================
@Test
public void remove() throws Exception {
Config c = init("a1=1", "a2=2", "[S]", "b1=1");
-
+
c.remove("a1");
c.remove("a2");
c.remove("a3");
c.remove("S/b1");
c.remove("T/c1");
-
+
assertTextEquals("[S]|", c.toString());
c.commit();
assertTextEquals("[S]|", c.toString());
@@ -225,7 +225,7 @@ public class ConfigTest {
@Test
public void xgetString1() throws Exception {
Config c = init("a1=1", "a2=2", "[S]", "b1=1", "b2=");
-
+
assertEquals("1", c.getString("a1"));
assertEquals("2", c.getString("a2"));
assertEquals(null, c.getString("a3"));
@@ -241,7 +241,7 @@ public class ConfigTest {
@Test
public void getString2() throws Exception {
Config c = init("a1=1", "a2=2", "[S]", "b1=1", "b2=");
-
+
assertEquals("1", c.getString("a1", "foo"));
assertEquals("2", c.getString("a2", "foo"));
assertEquals("foo", c.getString("a3", "foo"));
@@ -257,7 +257,7 @@ public class ConfigTest {
@Test
public void getStringArray1() throws Exception {
Config c = init("a1=1,2", "a2= 2 , 3 ", "[S]", "b1=1", "b2=");
-
+
assertObjectEquals("['1','2']", c.getStringArray("a1"));
assertObjectEquals("['2','3']", c.getStringArray("a2"));
assertObjectEquals("[]", c.getStringArray("a3"));
@@ -273,7 +273,7 @@ public class ConfigTest {
@Test
public void getStringArray2() throws Exception {
Config c = init("a1=1,2", "a2= 2 , 3 ", "[S]", "b1=1", "b2=");
-
+
assertObjectEquals("['1','2']", c.getStringArray("a1", new String[] {"foo"}));
assertObjectEquals("['2','3']", c.getStringArray("a2", new String[] {"foo"}));
assertObjectEquals("['foo']", c.getStringArray("a3", new String[] {"foo"}));
@@ -289,7 +289,7 @@ public class ConfigTest {
@Test
public void getInt1() throws Exception {
Config c = init("a1=1", "a2=2", "[S]", "b1=1", "b2=");
-
+
assertEquals(1, c.getInt("a1"));
assertEquals(2, c.getInt("a2"));
assertEquals(0, c.getInt("a3"));
@@ -302,7 +302,7 @@ public class ConfigTest {
@Test
public void getInt1BadValues() throws Exception {
Config c = init("a1=foo", "a2=2.3", "a3=[1]", "a4=false");
-
+
try {
c.getInt("a1");
fail();
@@ -327,7 +327,7 @@ public class ConfigTest {
@Test
public void getInt2() throws Exception {
Config c = init("a1=1", "a2=2", "[S]", "b1=1", "b2=");
-
+
assertEquals(1, c.getInt("a1", -1));
assertEquals(2, c.getInt("a2", -1));
assertEquals(-1, c.getInt("a3", -1));
@@ -340,7 +340,7 @@ public class ConfigTest {
@Test
public void getInt2BadValues() throws Exception {
Config c = init("a1=foo", "a2=2.3", "a3=[1]", "a4=false");
-
+
try {
c.getInt("a1", -1);
fail();
@@ -365,7 +365,7 @@ public class ConfigTest {
@Test
public void getBoolean1() throws Exception {
Config c = init("a1=true", "a2=false", "[S]", "b1=TRUE", "b2=");
-
+
assertEquals(true, c.getBoolean("a1"));
assertEquals(false, c.getBoolean("a2"));
assertEquals(false, c.getBoolean("a3"));
@@ -378,7 +378,7 @@ public class ConfigTest {
@Test
public void getBoolean1BadValues() throws Exception {
Config c = init("a1=foo", "a2=2.3", "a3=[1]", "a4=T");
-
+
assertEquals(false, c.getBoolean("a1"));
assertEquals(false, c.getBoolean("a2"));
assertEquals(false, c.getBoolean("a3"));
@@ -391,7 +391,7 @@ public class ConfigTest {
@Test
public void getBoolean2() throws Exception {
Config c = init("a1=true", "a2=false", "[S]", "b1=TRUE", "b2=");
-
+
assertEquals(true, c.getBoolean("a1", true));
assertEquals(false, c.getBoolean("a2", true));
assertEquals(true, c.getBoolean("a3", true));
@@ -404,7 +404,7 @@ public class ConfigTest {
@Test
public void getBoolean2BadValues() throws Exception {
Config c = init("a1=foo", "a2=2.3", "a3=[1]", "a4=T");
-
+
assertEquals(false, c.getBoolean("a1", true));
assertEquals(false, c.getBoolean("a2", true));
assertEquals(false, c.getBoolean("a3", true));
@@ -417,7 +417,7 @@ public class ConfigTest {
@Test
public void getLong1() throws Exception {
Config c = init("a1=1", "a2=2", "[S]", "b1=1", "b2=");
-
+
assertEquals(1l, c.getLong("a1"));
assertEquals(2l, c.getLong("a2"));
assertEquals(0l, c.getLong("a3"));
@@ -430,7 +430,7 @@ public class ConfigTest {
@Test
public void getLong1BadValues() throws Exception {
Config c = init("a1=foo", "a2=2.3", "a3=[1]", "a4=false");
-
+
try {
c.getLong("a1");
fail();
@@ -455,7 +455,7 @@ public class ConfigTest {
@Test
public void getLong2() throws Exception {
Config c = init("a1=1", "a2=2", "[S]", "b1=1", "b2=");
-
+
assertEquals(1l, c.getLong("a1", Long.MAX_VALUE));
assertEquals(2l, c.getLong("a2", Long.MAX_VALUE));
assertEquals(Long.MAX_VALUE, c.getLong("a3", Long.MAX_VALUE));
@@ -468,7 +468,7 @@ public class ConfigTest {
@Test
public void getLong2BadValues() throws Exception {
Config c = init("a1=foo", "a2=2.3", "a3=[1]", "a4=false");
-
+
try {
c.getLong("a1", -1l);
fail();
@@ -493,7 +493,7 @@ public class ConfigTest {
@Test
public void getBytes1() throws Exception {
Config c = init("a1=Zm9v", "a2=Zm", "\t9v", "a3=");
-
+
assertObjectEquals("[102,111,111]", c.getBytes("a1"));
assertObjectEquals("[102,111,111]", c.getBytes("a2"));
assertObjectEquals("[]", c.getBytes("a3"));
@@ -506,7 +506,7 @@ public class ConfigTest {
@Test
public void getBytes2() throws Exception {
Config c = init("a1=Zm9v", "a2=Zm", "\t9v", "a3=");
-
+
assertObjectEquals("[102,111,111]", c.getBytes("a1", new byte[] {1}));
assertObjectEquals("[102,111,111]", c.getBytes("a2", new byte[] {1}));
assertObjectEquals("[1]", c.getBytes("a3", new byte[] {1}));
@@ -519,19 +519,19 @@ public class ConfigTest {
@Test
public void getObject1() throws Exception {
Config c = init(
- "a1={foo:123}",
- "a2=[{foo:123}]",
+ "a1={foo:123}",
+ "a2=[{foo:123}]",
"a3=",
"a4=\t{",
"\t foo : 123 /* comment */",
"\t}"
);
-
+
Map<String,Integer> a1 = c.getObject("a1", Map.class, String.class, Integer.class);
assertObjectEquals("{foo:123}", a1);
assertInstanceOf(String.class, a1.keySet().iterator().next());
assertInstanceOf(Integer.class, a1.values().iterator().next());
-
+
List<Map<String,Integer>> a2a = c.getObject("a2", List.class, Map.class, String.class, Integer.class);
assertObjectEquals("[{foo:123}]", a2a);
assertInstanceOf(String.class, a2a.get(0).keySet().iterator().next());
@@ -540,15 +540,15 @@ public class ConfigTest {
List<ABean> a2b = c.getObject("a2", List.class, ABean.class);
assertObjectEquals("[{foo:'123'}]", a2b);
assertInstanceOf(ABean.class, a2b.get(0));
-
+
Map<String,Integer> a3 = c.getObject("a3", Map.class, String.class, Integer.class);
assertNull(a3);
-
+
Map<String,Integer> a4a = c.getObject("a4", Map.class, String.class, Integer.class);
assertObjectEquals("{foo:123}", a4a);
assertInstanceOf(String.class, a4a.keySet().iterator().next());
assertInstanceOf(Integer.class, a4a.values().iterator().next());
-
+
ABean a4b = c.getObject("a4", ABean.class);
assertObjectEquals("{foo:'123'}", a4b);
assertInstanceOf(ABean.class, a4b);
@@ -560,19 +560,19 @@ public class ConfigTest {
@Test
public void getObject2() throws Exception {
Config c = init(
- "a1=(foo=123)",
- "a2=@((foo=123))",
+ "a1=(foo=123)",
+ "a2=@((foo=123))",
"a3=",
"a4=\t(",
"\t foo = 123",
"\t)"
);
-
+
Map<String,Integer> a1 = c.getObject("a1", UonParser.DEFAULT, Map.class, String.class, Integer.class);
assertObjectEquals("{foo:123}", a1);
assertInstanceOf(String.class, a1.keySet().iterator().next());
assertInstanceOf(Integer.class, a1.values().iterator().next());
-
+
List<Map<String,Integer>> a2a = c.getObject("a2", UonParser.DEFAULT, List.class, Map.class, String.class, Integer.class);
assertObjectEquals("[{foo:123}]", a2a);
assertInstanceOf(String.class, a2a.get(0).keySet().iterator().next());
@@ -581,15 +581,15 @@ public class ConfigTest {
List<ABean> a2b = c.getObject("a2", UonParser.DEFAULT, List.class, ABean.class);
assertObjectEquals("[{foo:'123'}]", a2b);
assertInstanceOf(ABean.class, a2b.get(0));
-
+
Map<String,Integer> a3 = c.getObject("a3", UonParser.DEFAULT, Map.class, String.class, Integer.class);
assertNull(a3);
-
+
Map<String,Integer> a4a = c.getObject("a4", UonParser.DEFAULT, Map.class, String.class, Integer.class);
assertObjectEquals("{foo:123}", a4a);
assertInstanceOf(String.class, a4a.keySet().iterator().next());
assertInstanceOf(Integer.class, a4a.values().iterator().next());
-
+
ABean a4b = c.getObject("a4", UonParser.DEFAULT, ABean.class);
assertObjectEquals("{foo:'123'}", a4b);
assertInstanceOf(ABean.class, a4b);
@@ -602,19 +602,19 @@ public class ConfigTest {
@Test
public void getObject3() throws Exception {
Config c = init(
- "a1={foo:123}",
- "a2=[{foo:123}]",
+ "a1={foo:123}",
+ "a2=[{foo:123}]",
"a3=",
"a4=\t{",
"\t foo : 123 /* comment */",
"\t}"
);
-
+
Map a1 = c.getObject("a1", Map.class);
assertObjectEquals("{foo:123}", a1);
assertInstanceOf(String.class, a1.keySet().iterator().next());
assertInstanceOf(Integer.class, a1.values().iterator().next());
-
+
List a2a = c.getObject("a2", List.class);
assertObjectEquals("[{foo:123}]", a2a);
assertInstanceOf(String.class, ((Map)a2a.get(0)).keySet().iterator().next());
@@ -622,12 +622,12 @@ public class ConfigTest {
Map a3 = c.getObject("a3", Map.class);
assertNull(a3);
-
+
Map a4a = c.getObject("a4", Map.class);
assertObjectEquals("{foo:123}", a4a);
assertInstanceOf(String.class, a4a.keySet().iterator().next());
assertInstanceOf(Integer.class, a4a.values().iterator().next());
-
+
ABean a4b = c.getObject("a4", ABean.class);
assertObjectEquals("{foo:'123'}", a4b);
assertInstanceOf(ABean.class, a4b);
@@ -640,19 +640,19 @@ public class ConfigTest {
@Test
public void getObject4() throws Exception {
Config c = init(
- "a1=(foo=123)",
- "a2=@((foo=123))",
+ "a1=(foo=123)",
+ "a2=@((foo=123))",
"a3=",
"a4=\t(",
"\t foo = 123",
"\t)"
);
-
+
Map a1 = c.getObject("a1", UonParser.DEFAULT, Map.class);
assertObjectEquals("{foo:123}", a1);
assertInstanceOf(String.class, a1.keySet().iterator().next());
assertInstanceOf(Integer.class, a1.values().iterator().next());
-
+
List a2a = c.getObject("a2", UonParser.DEFAULT, List.class);
assertObjectEquals("[{foo:123}]", a2a);
assertInstanceOf(String.class, ((Map)a2a.get(0)).keySet().iterator().next());
@@ -660,12 +660,12 @@ public class ConfigTest {
Map a3 = c.getObject("a3", UonParser.DEFAULT, Map.class);
assertNull(a3);
-
+
Map a4a = c.getObject("a4", UonParser.DEFAULT, Map.class);
assertObjectEquals("{foo:123}", a4a);
assertInstanceOf(String.class, a4a.keySet().iterator().next());
assertInstanceOf(Integer.class, a4a.values().iterator().next());
-
+
ABean a4b = c.getObject("a4", UonParser.DEFAULT, ABean.class);
assertObjectEquals("{foo:'123'}", a4b);
assertInstanceOf(ABean.class, a4b);
@@ -678,19 +678,19 @@ public class ConfigTest {
@Test
public void getObjectWithDefault1() throws Exception {
Config c = init(
- "a1={foo:123}",
- "a2=[{foo:123}]",
+ "a1={foo:123}",
+ "a2=[{foo:123}]",
"a3=",
"a4=\t{",
"\t foo : 123 /* comment */",
"\t}"
);
-
+
Map a1 = c.getObjectWithDefault("a1", new ObjectMap(), Map.class);
assertObjectEquals("{foo:123}", a1);
assertInstanceOf(String.class, a1.keySet().iterator().next());
assertInstanceOf(Integer.class, a1.values().iterator().next());
-
+
Map a1b = c.getObjectWithDefault("a1b", new ObjectMap(), Map.class);
assertObjectEquals("{}", a1b);
@@ -704,12 +704,12 @@ public class ConfigTest {
Map a3 = c.getObjectWithDefault("a3", new ObjectMap(), Map.class);
assertObjectEquals("{}", a3);
-
+
Map a4a = c.getObjectWithDefault("a4", new ObjectMap(), Map.class);
assertObjectEquals("{foo:123}", a4a);
assertInstanceOf(String.class, a4a.keySet().iterator().next());
assertInstanceOf(Integer.class, a4a.values().iterator().next());
-
+
Map a4b = c.getObjectWithDefault("a4b", new ObjectMap(), Map.class);
assertObjectEquals("{}", a4b);
@@ -725,19 +725,19 @@ public class ConfigTest {
@Test
public void getObjectWithDefault2() throws Exception {
Config c = init(
- "a1=(foo=123)",
- "a2=@((foo=123))",
+ "a1=(foo=123)",
+ "a2=@((foo=123))",
"a3=",
"a4=\t(",
"\t foo = 123",
"\t)"
);
-
+
Map a1 = c.getObjectWithDefault("a1", UonParser.DEFAULT, new ObjectMap(), Map.class);
assertObjectEquals("{foo:123}", a1);
assertInstanceOf(String.class, a1.keySet().iterator().next());
assertInstanceOf(Integer.class, a1.values().iterator().next());
-
+
Map a1b = c.getObjectWithDefault("a1b", UonParser.DEFAULT, new ObjectMap(), Map.class);
assertObjectEquals("{}", a1b);
@@ -751,12 +751,12 @@ public class ConfigTest {
Map a3 = c.getObjectWithDefault("a3", UonParser.DEFAULT, new ObjectMap(), Map.class);
assertObjectEquals("{}", a3);
-
+
Map a4a = c.getObjectWithDefault("a4", UonParser.DEFAULT, new ObjectMap(), Map.class);
assertObjectEquals("{foo:123}", a4a);
assertInstanceOf(String.class, a4a.keySet().iterator().next());
assertInstanceOf(Integer.class, a4a.values().iterator().next());
-
+
Map a4b = c.getObjectWithDefault("a4b", UonParser.DEFAULT, new ObjectMap(), Map.class);
assertObjectEquals("{}", a4b);
@@ -771,19 +771,19 @@ public class ConfigTest {
@Test
public void getObjectWithDefault3() throws Exception {
Config c = init(
- "a1={foo:123}",
- "a2=[{foo:123}]",
+ "a1={foo:123}",
+ "a2=[{foo:123}]",
"a3=",
"a4=\t{",
"\t foo : 123 /* comment */",
"\t}"
);
-
+
Map<String,Integer> a1 = c.getObjectWithDefault("a1", new HashMap<String,Integer>(), Map.class, String.class, Integer.class);
assertObjectEquals("{foo:123}", a1);
assertInstanceOf(String.class, a1.keySet().iterator().next());
assertInstanceOf(Integer.class, a1.values().iterator().next());
-
+
Map<String,Integer> a1b = c.getObjectWithDefault("a1b", new HashMap<String,Integer>(), Map.class, String.class, Integer.class);
assertObjectEquals("{}", a1b);
@@ -797,12 +797,12 @@ public class ConfigTest {
Map<String,Object> a3 = c.getObjectWithDefault("a3", new ObjectMap(), Map.class, String.class, Object.class);
assertObjectEquals("{}", a3);
-
+
Map<String,Integer> a4a = c.getObjectWithDefault("a4", new HashMap<String,Integer>(), Map.class, String.class, Integer.class);
assertObjectEquals("{foo:123}", a4a);
assertInstanceOf(String.class, a4a.keySet().iterator().next());
assertInstanceOf(Integer.class, a4a.values().iterator().next());
-
+
Map<String,Integer> a4b = c.getObjectWithDefault("a4b", new HashMap<String,Integer>(), Map.class, String.class, Integer.class);
assertObjectEquals("{}", a4b);
@@ -817,19 +817,19 @@ public class ConfigTest {
@Test
public void getObjectWithDefault4() throws Exception {
Config c = init(
- "a1=(foo=123)",
- "a2=@((foo=123))",
+ "a1=(foo=123)",
+ "a2=@((foo=123))",
"a3=",
"a4=\t(",
"\t foo = 123",
"\t)"
);
-
+
Map<String,Integer> a1 = c.getObjectWithDefault("a1", UonParser.DEFAULT, new HashMap<String,Integer>(), Map.class, String.class, Integer.class);
assertObjectEquals("{foo:123}", a1);
assertInstanceOf(String.class, a1.keySet().iterator().next());
assertInstanceOf(Integer.class, a1.values().iterator().next());
-
+
Map<String,Integer> a1b = c.getObjectWithDefault("a1b", UonParser.DEFAULT, new HashMap<String,Integer>(), Map.class, String.class, Integer.class);
assertObjectEquals("{}", a1b);
@@ -843,12 +843,12 @@ public class ConfigTest {
Map<String,Object> a3 = c.getObjectWithDefault("a3", UonParser.DEFAULT, new ObjectMap(), Map.class, String.class, Object.class);
assertObjectEquals("{}", a3);
-
+
Map<String,Integer> a4a = c.getObjectWithDefault("a4", UonParser.DEFAULT, new HashMap<String,Integer>(), Map.class, String.class, Integer.class);
assertObjectEquals("{foo:123}", a4a);
assertInstanceOf(String.class, a4a.keySet().iterator().next());
assertInstanceOf(Integer.class, a4a.values().iterator().next());
-
+
Map<String,Integer> a4b = c.getObjectWithDefault("a4b", UonParser.DEFAULT, new HashMap<String,Integer>(), Map.class, String.class, Integer.class);
assertObjectEquals("{}", a4b);
@@ -863,12 +863,12 @@ public class ConfigTest {
@Test
public void getKeys() throws Exception {
Config c = init("a1=1", "a2=2", "[S]", "b1=1", "b2=");
-
+
assertObjectEquals("['a1','a2']", c.getKeys(""));
assertObjectEquals("['a1','a2']", c.getKeys(""));
assertObjectEquals("['b1','b2']", c.getKeys("S"));
assertTrue(c.getKeys("T").isEmpty());
-
+
try {
c.getKeys(null);
} catch (IllegalArgumentException e) {
@@ -883,7 +883,7 @@ public class ConfigTest {
public void writeProperties() throws Exception {
ABean a = new ABean().init();
BBean b = new BBean().init();
-
+
Config c = init("foo=qux", "[S]", "foo=baz", "bar=baz");
c.writeProperties("S", a, true);
assertObjectEquals("{foo:'baz'}", a);
@@ -928,17 +928,17 @@ public class ConfigTest {
@Test
public void getSectionAsBean1() throws Exception {
Config c = init("foo=qux", "[S]", "foo=baz", "[T]", "foo=qux", "bar=qux");
-
+
ABean a = null;
BBean b = null;
-
+
a = c.getSectionAsBean("", ABean.class);
assertObjectEquals("{foo:'qux'}", a);
a = c.getSectionAsBean("", ABean.class);
assertObjectEquals("{foo:'qux'}", a);
a = c.getSectionAsBean("S", ABean.class);
assertObjectEquals("{foo:'baz'}", a);
-
+
b = c.getSectionAsBean("", BBean.class);
assertObjectEquals("{foo:'qux'}", b);
b = c.getSectionAsBean("", BBean.class);
@@ -965,14 +965,14 @@ public class ConfigTest {
} catch (IllegalArgumentException e) {
assertEquals("Section 'U' not found in configuration.", e.getMessage());
}
-
+
try {
c.getSectionAsBean(null, ABean.class);
fail();
} catch (IllegalArgumentException e) {
assertEquals("Field 'section' cannot be null.", e.getMessage());
}
-
+
try {
c.getSectionAsBean(null, BBean.class);
fail();
@@ -987,10 +987,10 @@ public class ConfigTest {
@Test
public void getSectionAsBean2() throws Exception {
Config c = init("foo=qux", "[S]", "foo=baz", "[T]", "foo=qux", "bar=qux");
-
+
ABean a = null;
BBean b = null;
-
+
a = c.getSectionAsBean("T", ABean.class, true);
assertObjectEquals("{foo:'qux'}", a);
b = c.getSectionAsBean("T", BBean.class, true);
@@ -1023,7 +1023,7 @@ public class ConfigTest {
@Test
public void getSectionAsMap() throws Exception {
Config c = init("a=1", "[S]", "b=2", "[T]");
-
+
assertObjectEquals("{a:'1'}", c.getSectionAsMap(""));
assertObjectEquals("{a:'1'}", c.getSectionAsMap(""));
assertObjectEquals("{b:'2'}", c.getSectionAsMap("S"));
@@ -1044,10 +1044,10 @@ public class ConfigTest {
public void getSectionAsInterface() throws Exception {
Config c = init("foo=qux", "[S]", "foo=baz", "[T]", "foo=qux", "bar=qux");
AInterface a = null;
-
+
a = c.getSectionAsInterface("", AInterface.class);
assertEquals("qux", a.getFoo());
-
+
a = c.getSectionAsInterface("", AInterface.class);
assertEquals("qux", a.getFoo());
@@ -1063,14 +1063,14 @@ public class ConfigTest {
} catch (IllegalArgumentException e) {
assertEquals("Class 'org.apache.juneau.config.ConfigTest$ABean' passed to getSectionAsInterface() is not an interface.", e.getMessage());
}
-
+
try {
c.getSectionAsInterface(null, AInterface.class);
} catch (IllegalArgumentException e) {
assertEquals("Field 'section' cannot be null.", e.getLocalizedMessage());
}
}
-
+
public static interface AInterface {
String getFoo();
}
@@ -1081,7 +1081,7 @@ public class ConfigTest {
@Test
public void exists() throws Exception {
Config c = init("a=1", "[S]", "b=2", "c=", "[T]");
-
+
assertTrue(c.exists("a"));
assertFalse(c.exists("b"));
assertTrue(c.exists("S/b"));
@@ -1096,19 +1096,19 @@ public class ConfigTest {
@Test
public void setSection1() throws Exception {
Config c = init();
-
+
c.setSection("", Arrays.asList("#C1", "#C2"));
assertTextEquals("#C1|#C2||", c);
c.setSection("", Arrays.asList("#C3", "#C4"));
assertTextEquals("#C3|#C4||", c);
-
+
c.setSection("S1", Arrays.asList("", "#C5", "#C6"));
assertTextEquals("#C3|#C4|||#C5|#C6|[S1]|", c);
-
+
c.setSection("S1", null);
assertTextEquals("#C3|#C4|||#C5|#C6|[S1]|", c);
-
+
c.setSection("S1", Collections.<String>emptyList());
assertTextEquals("#C3|#C4||[S1]|", c);
@@ -1127,19 +1127,19 @@ public class ConfigTest {
public void setSection2() throws Exception {
Config c = init();
ObjectMap m = new ObjectMap().append("a", "b");
-
+
c.setSection("", Arrays.asList("#C1", "#C2"), m);
assertTextEquals("#C1|#C2||a = b|", c);
c.setSection("", Arrays.asList("#C3", "#C4"), m);
assertTextEquals("#C3|#C4||a = b|", c);
-
+
c.setSection("S1", Arrays.asList("", "#C5", "#C6"), m);
assertTextEquals("#C3|#C4||a = b||#C5|#C6|[S1]|a = b|", c);
-
+
c.setSection("S1", null, m);
assertTextEquals("#C3|#C4||a = b||#C5|#C6|[S1]|a = b|", c);
-
+
c.setSection("S1", Collections.<String>emptyList(), m);
assertTextEquals("#C3|#C4||a = b|[S1]|a = b|", c);
@@ -1150,19 +1150,19 @@ public class ConfigTest {
assertEquals("Field 'section' cannot be null.", e.getLocalizedMessage());
}
}
-
+
//====================================================================================================
// public Config removeSection(String name) {
//====================================================================================================
@Test
public void removeSection() throws Exception {
Config c = init("a=1", "[S]", "b=2", "c=", "[T]");
-
+
c.removeSection("S");
c.removeSection("T");
-
+
assertTextEquals("a=1|", c);
-
+
c.removeSection("");
assertTextEquals("", c);
}
@@ -1173,7 +1173,7 @@ public class ConfigTest {
@Test
public void writeTo() throws Exception {
Config c = init("a=1", "[S]", "b=2", "c=", "[T]");
-
+
assertTextEquals("a=1|[S]|b=2|c=|[T]|", c.writeTo(new StringWriter()).toString());
}
@@ -1253,7 +1253,7 @@ public class ConfigTest {
);
cf.set("s1/foo", "mypassword");
-
+
assertEquals("mypassword", cf.getString("s1/foo"));
cf.commit();
@@ -1264,7 +1264,7 @@ public class ConfigTest {
assertEquals("mypassword", cf.getString("s1/foo"));
cf.load(new StringReader("[s1]\nfoo* = mypassword2\n"), true);
-
+
assertEquals("mypassword2", cf.getString("s1/foo"));
cf.set("s1/foo", "mypassword");
@@ -1357,7 +1357,7 @@ public class ConfigTest {
@Test
public void testHex() throws Exception {
Config cf = init().builder().binaryFormat(BinaryFormat.HEX).build();
-
+
cf.set("foo", "bar".getBytes("UTF-8"));
assertEquals("626172", cf.get("foo"));
assertObjectEquals("[98,97,114]", cf.getBytes("foo"));
@@ -1369,7 +1369,7 @@ public class ConfigTest {
@Test
public void testSpacedHex() throws Exception {
Config cf = init().builder().binaryFormat(BinaryFormat.SPACED_HEX).build();
-
+
cf.set("foo", "bar".getBytes("UTF-8"));
assertEquals("62 61 72", cf.get("foo"));
assertObjectEquals("[98,97,114]", cf.getBytes("foo"));
@@ -1418,7 +1418,7 @@ public class ConfigTest {
public void testListeners() throws Exception {
Config cf = init();
- final Set<String> changes = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ final Set<String> changes = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
cf.addListener(
new ConfigEventListener() {
@@ -1478,7 +1478,7 @@ public class ConfigTest {
cf.set("B/b4", "4", null, ConfigMod.ENCODED, null, null);
cf.commit();
assertObjectEquals("['a4={Wg==}','B/b4={Wg==}']", changes);
-
+
// Encoded overwrite
changes.clear();
cf.set("a4", "5");
@@ -1580,7 +1580,7 @@ public class ConfigTest {
assertObjectEquals("['1','2','3']", cf.getStringArray("x1", new String[]{"9"}));
assertObjectEquals("['4','5','6']", cf.getStringArray("x2", new String[]{"9"}));
assertObjectEquals("['9']", cf.getStringArray("x3", new String[]{"9"}));
-
+
System.clearProperty("X");
}
@@ -1709,20 +1709,20 @@ public class ConfigTest {
assertEquals("a,#b,=c", cf.getString("a"));
assertEquals("a,#b,=c", cf.getString("A/a"));
-
+
cf.set("a", "a,#b,=c", null, (ConfigMod)null, "comment#comment", null);
assertTextEquals("a = a,\\u0023b,=c # comment#comment|[A]|a = a,\\u0023b,=c|", cf);
assertEquals("a,#b,=c", cf.getString("a"));
}
-
+
public static void main(String[] args) {
System.err.println(Integer.parseInt("1_000"));
}
-
-
+
+
public static class ABean {
public String foo;
-
+
public ABean init() {
foo = "bar";
return this;
@@ -1731,7 +1731,7 @@ public class ConfigTest {
public static class BBean {
private String foo;
-
+
public String getFoo() { return foo; }
public BBean setFoo(String foo) {this.foo = foo; return this;}
public BBean init() {
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/store/FileStoreTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/store/FileStoreTest.java
index 9483456..deac35c 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/store/FileStoreTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/store/FileStoreTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -21,14 +21,14 @@ import org.apache.juneau.internal.*;
import org.junit.*;
public class FileStoreTest {
-
+
private static final File DIR = new File("./config");
-
+
@After
public void cleanUp() {
FileUtils.delete(DIR);
}
-
+
@Test
public void testNoFile() throws Exception {
ConfigFileStore fs = ConfigFileStore.create().directory(DIR).build();
@@ -66,14 +66,14 @@ public class FileStoreTest {
assertNull(fs.write("X.cfg", "foo", "bar"));
assertEquals("bar", fs.read("X.cfg"));
}
-
+
@Test
public void testCharset() throws Exception {
ConfigFileStore fs = ConfigFileStore.create().directory(DIR).charset("UTF-8").build();
assertNull(fs.write("X.cfg", null, "foo"));
assertEquals("foo", fs.read("X.cfg"));
- }
-
+ }
+
@Test
public void testWatcher() throws Exception {
ConfigFileStore fs = ConfigFileStore.create().directory(DIR).useWatcher().watcherSensitivity(WatcherSensitivity.HIGH).build();
@@ -99,7 +99,7 @@ public class FileStoreTest {
if (! latch.await(10, TimeUnit.SECONDS))
throw new Exception("CountDownLatch never reached zero.");
}
-
+
@Test
public void testUpdate() throws Exception {
ConfigFileStore fs = ConfigFileStore.create().directory(DIR).build();
@@ -119,17 +119,17 @@ public class FileStoreTest {
latch.countDown();
}
});
-
+
fs.update("X.cfg", "xxx");
fs.update("Y.cfg", "yyy");
if (! latch.await(10, TimeUnit.SECONDS))
throw new Exception("CountDownLatch never reached zero.");
- }
-
+ }
+
private void assertFileExists(String name) {
assertTrue(new File(DIR, name).exists());
}
-
+
private void assertFileNotExists(String name) {
assertTrue(! new File(DIR, name).exists());
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/store/MemoryStoreTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/store/MemoryStoreTest.java
index c3c0779..b2b7f69 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/store/MemoryStoreTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/config/store/MemoryStoreTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -19,7 +19,7 @@ import java.util.concurrent.*;
import org.junit.*;
public class MemoryStoreTest {
-
+
@Test
public void testNoFile() throws Exception {
ConfigMemoryStore fs = ConfigMemoryStore.create().build();
@@ -45,7 +45,7 @@ public class MemoryStoreTest {
assertNull(fs.write("X.cfg", "foo", "bar"));
assertEquals("bar", fs.read("X.cfg"));
}
-
+
@Test
public void testUpdate() throws Exception {
ConfigMemoryStore fs = ConfigMemoryStore.create().build();
@@ -65,10 +65,10 @@ public class MemoryStoreTest {
latch.countDown();
}
});
-
+
fs.update("X.cfg", "xxx");
fs.update("Y.cfg", "yyy");
if (! latch.await(10, TimeUnit.SECONDS))
throw new Exception("CountDownLatch never reached zero.");
- }
+ }
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/csv/CsvTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/csv/CsvTest.java
index 235aee9..d57fb1a 100755
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/csv/CsvTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/csv/CsvTest.java
@@ -26,7 +26,7 @@ public class CsvTest {
//====================================================================================================
@Test
public void testBasic() throws Exception {
- List<A> l = new LinkedList<A>();
+ List<A> l = new LinkedList<>();
l.add(new A("b1",1));
l.add(new A("b2",2));
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/cognos/CognosXmlTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/cognos/CognosXmlTest.java
index 4b1eea6..b759b75 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/cognos/CognosXmlTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/cognos/CognosXmlTest.java
@@ -58,7 +58,7 @@ public class CognosXmlTest {
+ " </data>\n"
+ "</dataset>\n";
- List<Object> rows = new LinkedList<Object>();
+ List<Object> rows = new LinkedList<>();
rows.add(new ObjectMap("{asOfDate:'Apr 26, 2002',rateOfReturn:0.21006642,famAcctIndex:'JA1',rowID:'F',brM:'B',productLineCode:1}"));
rows.add(new Item("Apr 27, 2002", 0.1111111, "BBB", "G", "B", 2));
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/html5/Html5BasicTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/html5/Html5BasicTest.java
index f8195fd..b1978ab 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/html5/Html5BasicTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/html5/Html5BasicTest.java
@@ -30,7 +30,7 @@ public class Html5BasicTest {
label("label")._for("Name")
)
);
-
+
String r = f.toString();
assertEquals("<form action='bar'><fieldset><legend>foo:</legend>Name:<input type='text'/><br/>Email:<input type='text'/><br/>X:<keygen name='X'/><label for='Name'>label</label></fieldset></form>", r);
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/jsonschema/JsonSchemaTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/jsonschema/JsonSchemaTest.java
index ee100ed..c962a43 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/jsonschema/JsonSchemaTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/jsonschema/JsonSchemaTest.java
@@ -245,7 +245,7 @@ public class JsonSchemaTest {
assertEquals(expected, r);
}
-
+
/** Bean with simple values for each property */
public static JsonSchema getTest1() {
return new JsonSchema()
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ContactTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ContactTest.java
index d6fade5..a427041 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ContactTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ContactTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -31,14 +31,14 @@ public class ContactTest {
@Test
public void testName() {
Contact t = new Contact();
-
+
t.name("foo");
assertEquals("foo", t.getName());
-
+
t.name(new StringBuilder("foo"));
assertEquals("foo", t.getName());
assertInstanceOf(String.class, t.getName());
-
+
t.name(null);
assertNull(t.getName());
}
@@ -52,11 +52,11 @@ public class ContactTest {
t.url("foo");
assertEquals("foo", t.getUrl().toString());
-
+
t.url(new StringBuilder("foo"));
assertEquals("foo", t.getUrl().toString());
assertInstanceOf(URI.class, t.getUrl());
-
+
t.url(null);
assertNull(t.getUrl());
}
@@ -67,10 +67,10 @@ public class ContactTest {
@Test
public void testEmail() {
Contact t = new Contact();
-
+
t.email("foo");
assertEquals("foo", t.getEmail());
-
+
t.email(new StringBuilder("foo"));
assertEquals("foo", t.getEmail());
assertInstanceOf(String.class, t.getEmail());
@@ -85,23 +85,23 @@ public class ContactTest {
@Test
public void testSet() throws Exception {
Contact t = new Contact();
-
+
t
.set("name", "foo")
.set("url", "bar")
.set("email", "baz")
.set("$ref", "qux");
-
+
assertObjectEquals("{name:'foo',url:'bar',email:'baz','$ref':'qux'}", t);
-
+
t
.set("name", new StringBuilder("foo"))
.set("url", new StringBuilder("bar"))
.set("email", new StringBuilder("baz"))
.set("$ref", new StringBuilder("qux"));
-
+
assertObjectEquals("{name:'foo',url:'bar',email:'baz','$ref':'qux'}", t);
-
+
assertEquals("foo", t.get("name", String.class));
assertEquals("bar", t.get("url", URI.class).toString());
assertEquals("baz", t.get("email", String.class));
@@ -116,7 +116,7 @@ public class ContactTest {
assertNull(t.get("null", Object.class));
assertNull(t.get(null, Object.class));
assertNull(t.get("foo", Object.class));
-
+
assertObjectEquals("{name:'foo',url:'bar',email:'baz','$ref':'qux'}", JsonParser.DEFAULT.parse("{name:'foo',url:'bar',email:'baz','$ref':'qux'}", Contact.class));
}
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ExternalDocumentationTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ExternalDocumentationTest.java
index 9fb5d79..e2bc174 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ExternalDocumentationTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ExternalDocumentationTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -31,14 +31,14 @@ public class ExternalDocumentationTest {
@Test
public void testDescription() {
ExternalDocumentation t = new ExternalDocumentation();
-
+
t.description("foo");
assertEquals("foo", t.getDescription());
-
+
t.description(new StringBuilder("foo"));
assertEquals("foo", t.getDescription());
assertInstanceOf(String.class, t.getDescription());
-
+
t.description(null);
assertNull(t.getDescription());
}
@@ -49,14 +49,14 @@ public class ExternalDocumentationTest {
@Test
public void testUrl() {
ExternalDocumentation t = new ExternalDocumentation();
-
+
t.url("foo");
assertEquals("foo", t.getUrl().toString());
-
+
t.url(new StringBuilder("foo"));
assertEquals("foo", t.getUrl().toString());
assertInstanceOf(URI.class, t.getUrl());
-
+
t.url(null);
assertNull(t.getUrl());
}
@@ -67,21 +67,21 @@ public class ExternalDocumentationTest {
@Test
public void testSet() throws Exception {
ExternalDocumentation t = new ExternalDocumentation();
-
+
t
.set("description", "foo")
.set("url", "bar")
.set("$ref", "baz");
-
+
assertObjectEquals("{description:'foo',url:'bar','$ref':'baz'}", t);
-
+
t
.set("description", new StringBuilder("foo"))
.set("url", new StringBuilder("bar"))
.set("$ref", new StringBuilder("baz"));
-
+
assertObjectEquals("{description:'foo',url:'bar','$ref':'baz'}", t);
-
+
assertEquals("foo", t.get("description", String.class));
assertEquals("bar", t.get("url", URI.class).toString());
assertEquals("baz", t.get("$ref", String.class));
@@ -94,7 +94,7 @@ public class ExternalDocumentationTest {
assertNull(t.get("null", Object.class));
assertNull(t.get(null, Object.class));
assertNull(t.get("foo", Object.class));
-
+
assertObjectEquals("{description:'foo',url:'bar','$ref':'baz'}", JsonParser.DEFAULT.parse("{description:'foo',url:'bar','$ref':'baz'}", ExternalDocumentation.class));
}
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/HeaderInfoTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/HeaderInfoTest.java
index 3877ecd..298b6c8 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/HeaderInfoTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/HeaderInfoTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -33,14 +33,14 @@ public class HeaderInfoTest {
@Test
public void testDescription() {
HeaderInfo t = new HeaderInfo();
-
+
t.description("foo");
assertEquals("foo", t.getDescription());
-
+
t.description(new StringBuilder("foo"));
assertEquals("foo", t.getDescription());
assertInstanceOf(String.class, t.getDescription());
-
+
t.description(null);
assertNull(t.getDescription());
}
@@ -51,14 +51,14 @@ public class HeaderInfoTest {
@Test
public void testType() {
HeaderInfo t = new HeaderInfo();
-
+
t.type("foo");
assertEquals("foo", t.getType());
-
+
t.type(new StringBuilder("foo"));
assertEquals("foo", t.getType());
assertInstanceOf(String.class, t.getType());
-
+
t.type(null);
assertNull(t.getType());
}
@@ -69,14 +69,14 @@ public class HeaderInfoTest {
@Test
public void testFormat() {
HeaderInfo t = new HeaderInfo();
-
+
t.format("foo");
assertEquals("foo", t.getFormat());
-
+
t.format(new StringBuilder("foo"));
assertEquals("foo", t.getFormat());
assertInstanceOf(String.class, t.getFormat());
-
+
t.format(null);
assertNull(t.getFormat());
}
@@ -87,10 +87,10 @@ public class HeaderInfoTest {
@Test
public void testItems() {
HeaderInfo t = new HeaderInfo();
-
+
t.items(items("foo"));
assertObjectEquals("{type:'foo'}", t.getItems());
-
+
t.items("{type:'foo'}");
assertObjectEquals("{type:'foo'}", t.getItems());
assertInstanceOf(Items.class, t.getItems());
@@ -105,14 +105,14 @@ public class HeaderInfoTest {
@Test
public void testCollectionFormat() {
HeaderInfo t = new HeaderInfo();
-
+
t.collectionFormat("foo");
assertEquals("foo", t.getCollectionFormat());
-
+
t.collectionFormat(new StringBuilder("foo"));
assertEquals("foo", t.getCollectionFormat());
assertInstanceOf(String.class, t.getCollectionFormat());
-
+
t.collectionFormat(null);
assertNull(t.getCollectionFormat());
}
@@ -123,14 +123,14 @@ public class HeaderInfoTest {
@Test
public void test_default() {
HeaderInfo t = new HeaderInfo();
-
+
t._default("foo");
assertEquals("foo", t.getDefault());
-
+
t._default(new StringBuilder("foo"));
assertEquals("foo", t.getDefault().toString());
assertInstanceOf(StringBuilder.class, t.getDefault());
-
+
t._default(null);
assertNull(t.getDefault());
}
@@ -141,11 +141,11 @@ public class HeaderInfoTest {
@Test
public void testMaximum() {
HeaderInfo t = new HeaderInfo();
-
+
t.maximum(123);
assertEquals(123, t.getMaximum());
assertInstanceOf(Integer.class, t.getMaximum());
-
+
t.maximum(123f);
assertEquals(123f, t.getMaximum());
assertInstanceOf(Float.class, t.getMaximum());
@@ -157,7 +157,7 @@ public class HeaderInfoTest {
t.maximum(new StringBuilder("123"));
assertEquals(123, t.getMaximum());
assertInstanceOf(Integer.class, t.getMaximum());
-
+
t.maximum(null);
assertNull(t.getMaximum());
}
@@ -168,11 +168,11 @@ public class HeaderInfoTest {
@Test
public void testExclusiveMaximum() {
HeaderInfo t = new HeaderInfo();
-
+
t.exclusiveMaximum(true);
assertEquals(true, t.getExclusiveMaximum());
assertInstanceOf(Boolean.class, t.getExclusiveMaximum());
-
+
t.exclusiveMaximum("true");
assertEquals(true, t.getExclusiveMaximum());
assertInstanceOf(Boolean.class, t.getExclusiveMaximum());
@@ -180,7 +180,7 @@ public class HeaderInfoTest {
t.exclusiveMaximum(new StringBuilder("true"));
assertEquals(true, t.getExclusiveMaximum());
assertInstanceOf(Boolean.class, t.getExclusiveMaximum());
-
+
t.exclusiveMaximum(null);
assertNull(t.getExclusiveMaximum());
}
@@ -191,11 +191,11 @@ public class HeaderInfoTest {
@Test
public void testMinimum() {
HeaderInfo t = new HeaderInfo();
-
+
t.minimum(123);
assertEquals(123, t.getMinimum());
assertInstanceOf(Integer.class, t.getMinimum());
-
+
t.minimum(123f);
assertEquals(123f, t.getMinimum());
assertInstanceOf(Float.class, t.getMinimum());
@@ -207,7 +207,7 @@ public class HeaderInfoTest {
t.minimum(new StringBuilder("123"));
assertEquals(123, t.getMinimum());
assertInstanceOf(Integer.class, t.getMinimum());
-
+
t.minimum(null);
assertNull(t.getMinimum());
}
@@ -218,11 +218,11 @@ public class HeaderInfoTest {
@Test
public void testExclusiveMinimum() {
HeaderInfo t = new HeaderInfo();
-
+
t.exclusiveMinimum(true);
assertEquals(true, t.getExclusiveMinimum());
assertInstanceOf(Boolean.class, t.getExclusiveMinimum());
-
+
t.exclusiveMinimum("true");
assertEquals(true, t.getExclusiveMinimum());
assertInstanceOf(Boolean.class, t.getExclusiveMinimum());
@@ -230,7 +230,7 @@ public class HeaderInfoTest {
t.exclusiveMinimum(new StringBuilder("true"));
assertEquals(true, t.getExclusiveMinimum());
assertInstanceOf(Boolean.class, t.getExclusiveMinimum());
-
+
t.exclusiveMinimum(null);
assertNull(t.getExclusiveMinimum());
}
@@ -241,11 +241,11 @@ public class HeaderInfoTest {
@Test
public void testMaxLength() {
HeaderInfo t = new HeaderInfo();
-
+
t.maxLength(123);
assertEquals(123, t.getMaxLength().intValue());
assertInstanceOf(Integer.class, t.getMaxLength());
-
+
t.maxLength(123f);
assertEquals(123, t.getMaxLength().intValue());
assertInstanceOf(Integer.class, t.getMaxLength());
@@ -257,7 +257,7 @@ public class HeaderInfoTest {
t.maxLength(new StringBuilder("123"));
assertEquals(123, t.getMaxLength().intValue());
assertInstanceOf(Integer.class, t.getMaxLength());
-
+
t.maxLength(null);
assertNull(t.getMaxLength());
}
@@ -268,11 +268,11 @@ public class HeaderInfoTest {
@Test
public void testMinLength() {
HeaderInfo t = new HeaderInfo();
-
+
t.minLength(123);
assertEquals(123, t.getMinLength().intValue());
assertInstanceOf(Integer.class, t.getMinLength());
-
+
t.minLength(123f);
assertEquals(123, t.getMinLength().intValue());
assertInstanceOf(Integer.class, t.getMinLength());
@@ -284,7 +284,7 @@ public class HeaderInfoTest {
t.minLength(new StringBuilder("123"));
assertEquals(123, t.getMinLength().intValue());
assertInstanceOf(Integer.class, t.getMinLength());
-
+
t.minLength(null);
assertNull(t.getMinLength());
}
@@ -295,14 +295,14 @@ public class HeaderInfoTest {
@Test
public void testPattern() {
HeaderInfo t = new HeaderInfo();
-
+
t.pattern("foo");
assertEquals("foo", t.getPattern());
-
+
t.pattern(new StringBuilder("foo"));
assertEquals("foo", t.getPattern());
assertInstanceOf(String.class, t.getPattern());
-
+
t.pattern(null);
assertNull(t.getPattern());
}
@@ -313,11 +313,11 @@ public class HeaderInfoTest {
@Test
public void testMaxItems() {
HeaderInfo t = new HeaderInfo();
-
+
t.maxItems(123);
assertEquals(123, t.getMaxItems().intValue());
assertInstanceOf(Integer.class, t.getMaxItems());
-
+
t.maxItems(123f);
assertEquals(123, t.getMaxItems().intValue());
assertInstanceOf(Integer.class, t.getMaxItems());
@@ -329,7 +329,7 @@ public class HeaderInfoTest {
t.maxItems(new StringBuilder("123"));
assertEquals(123, t.getMaxItems().intValue());
assertInstanceOf(Integer.class, t.getMaxItems());
-
+
t.maxItems(null);
assertNull(t.getMaxItems());
}
@@ -340,11 +340,11 @@ public class HeaderInfoTest {
@Test
public void testMinItems() {
HeaderInfo t = new HeaderInfo();
-
+
t.minItems(123);
assertEquals(123, t.getMinItems().intValue());
assertInstanceOf(Integer.class, t.getMinItems());
-
+
t.minItems(123f);
assertEquals(123, t.getMinItems().intValue());
assertInstanceOf(Integer.class, t.getMinItems());
@@ -356,7 +356,7 @@ public class HeaderInfoTest {
t.minItems(new StringBuilder("123"));
assertEquals(123, t.getMinItems().intValue());
assertInstanceOf(Integer.class, t.getMinItems());
-
+
t.minItems(null);
assertNull(t.getMinItems());
}
@@ -367,11 +367,11 @@ public class HeaderInfoTest {
@Test
public void testUniqueItems() {
HeaderInfo t = new HeaderInfo();
-
+
t.uniqueItems(true);
assertEquals(true, t.getUniqueItems());
assertInstanceOf(Boolean.class, t.getUniqueItems());
-
+
t.uniqueItems("true");
assertEquals(true, t.getUniqueItems());
assertInstanceOf(Boolean.class, t.getUniqueItems());
@@ -379,7 +379,7 @@ public class HeaderInfoTest {
t.uniqueItems(new StringBuilder("true"));
assertEquals(true, t.getUniqueItems());
assertInstanceOf(Boolean.class, t.getUniqueItems());
-
+
t.uniqueItems(null);
assertNull(t.getUniqueItems());
}
@@ -390,12 +390,12 @@ public class HeaderInfoTest {
@Test
public void testSetEnum() {
HeaderInfo t = new HeaderInfo();
-
- t.setEnum(new ASet<Object>().appendAll("foo","bar"));
+
+ t.setEnum(new ASet<>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
-
- t.setEnum(new ASet<Object>());
+
+ t.setEnum(new ASet<>());
assertObjectEquals("[]", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
@@ -409,12 +409,12 @@ public class HeaderInfoTest {
@Test
public void testAddEnum() {
HeaderInfo t = new HeaderInfo();
-
- t.addEnum(new ASet<Object>().appendAll("foo","bar"));
+
+ t.addEnum(new ASet<>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
-
- t.addEnum(new ASet<Object>().appendAll("baz"));
+
+ t.addEnum(new ASet<>().appendAll("baz"));
assertObjectEquals("['foo','bar','baz']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
@@ -429,19 +429,19 @@ public class HeaderInfoTest {
@Test
public void test_enum() {
HeaderInfo t = new HeaderInfo();
-
- t._enum(new ASet<Object>().appendAll("foo","bar"));
+
+ t._enum(new ASet<>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
-
- t._enum(new ASet<Object>().appendAll("baz"));
+
+ t._enum(new ASet<>().appendAll("baz"));
assertObjectEquals("['foo','bar','baz']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
t._enum((Object[])null);
assertObjectEquals("['foo','bar','baz']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
-
+
t.setEnum(null);
t._enum("foo")._enum(new StringBuilder("bar"))._enum("['baz','qux']")._enum((Object)new String[]{"quux"});
assertObjectEquals("['foo','bar','baz','qux','quux']", t.getEnum());
@@ -454,11 +454,11 @@ public class HeaderInfoTest {
@Test
public void testMultipleOf() {
HeaderInfo t = new HeaderInfo();
-
+
t.multipleOf(123);
assertEquals(123, t.getMultipleOf());
assertInstanceOf(Integer.class, t.getMultipleOf());
-
+
t.multipleOf(123f);
assertEquals(123f, t.getMultipleOf());
assertInstanceOf(Float.class, t.getMultipleOf());
@@ -470,7 +470,7 @@ public class HeaderInfoTest {
t.multipleOf(new StringBuilder("123"));
assertEquals(123, t.getMultipleOf());
assertInstanceOf(Integer.class, t.getMultipleOf());
-
+
t.multipleOf(null);
assertNull(t.getMultipleOf());
}
@@ -502,7 +502,7 @@ public class HeaderInfoTest {
.set("type", "j")
.set("uniqueItems", true)
.set("$ref", "ref");
-
+
assertObjectEquals("{description:'d',type:'j',format:'g',items:{type:'h'},collectionFormat:'c','default':'a',maximum:123.0,exclusiveMaximum:true,minimum:123.0,exclusiveMinimum:true,maxLength:123,minLength:123,pattern:'i',maxItems:123,minItems:123,uniqueItems:true,'enum':['b'],multipleOf:123.0,'$ref':'ref'}", t);
t
@@ -525,9 +525,9 @@ public class HeaderInfoTest {
.set("type", "j")
.set("uniqueItems", "true")
.set("$ref", "ref");
-
+
assertObjectEquals("{description:'d',type:'j',format:'g',items:{type:'h'},collectionFormat:'c','default':'a',maximum:123.0,exclusiveMaximum:true,minimum:123.0,exclusiveMinimum:true,maxLength:123,minLength:123,pattern:'i',maxItems:123,minItems:123,uniqueItems:true,'enum':['b'],multipleOf:123.0,'$ref':'ref'}", t);
-
+
t
.set("default", new StringBuilder("a"))
.set("enum", new StringBuilder("['b']"))
@@ -548,9 +548,9 @@ public class HeaderInfoTest {
.set("type", new StringBuilder("j"))
.set("uniqueItems", new StringBuilder("true"))
.set("$ref", new StringBuilder("ref"));
-
+
assertObjectEquals("{description:'d',type:'j',format:'g',items:{type:'h'},collectionFormat:'c','default':'a',maximum:123.0,exclusiveMaximum:true,minimum:123.0,exclusiveMinimum:true,maxLength:123,minLength:123,pattern:'i',maxItems:123,minItems:123,uniqueItems:true,'enum':['b'],multipleOf:123.0,'$ref':'ref'}", t);
-
+
assertEquals("a", t.get("default", String.class));
assertEquals("['b']", t.get("enum", String.class));
assertEquals("c", t.get("collectionFormat", String.class));
@@ -570,7 +570,7 @@ public class HeaderInfoTest {
assertEquals("j", t.get("type", String.class));
assertEquals("true", t.get("uniqueItems", String.class));
assertEquals("ref", t.get("$ref", String.class));
-
+
assertInstanceOf(StringBuilder.class, t.get("default", Object.class));
assertInstanceOf(List.class, t.get("enum", Object.class));
assertInstanceOf(String.class, t.get("collectionFormat", Object.class));
@@ -590,12 +590,12 @@ public class HeaderInfoTest {
assertInstanceOf(String.class, t.get("type", Object.class));
assertInstanceOf(Boolean.class, t.get("uniqueItems", Object.class));
assertInstanceOf(String.class, t.get("$ref", Object.class));
-
+
t.set("null", null).set(null, "null");
assertNull(t.get("null", Object.class));
assertNull(t.get(null, Object.class));
assertNull(t.get("foo", Object.class));
-
+
String s = "{description:'d',type:'j',format:'g',items:{type:'h'},collectionFormat:'c','default':'a',maximum:123.0,exclusiveMaximum:true,minimum:123.0,exclusiveMinimum:true,maxLength:123,minLength:123,pattern:'i',maxItems:123,minItems:123,uniqueItems:true,'enum':['b'],multipleOf:123.0,'$ref':'ref'}";
assertObjectEquals(s, JsonParser.DEFAULT.parse(s, HeaderInfo.class));
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/InfoTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/InfoTest.java
index c0581c5..dd8bcba 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/InfoTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/InfoTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -30,14 +30,14 @@ public class InfoTest {
@Test
public void testTitle() {
Info t = new Info();
-
+
t.title("foo");
assertEquals("foo", t.getTitle());
-
+
t.title(new StringBuilder("foo"));
assertEquals("foo", t.getTitle());
assertInstanceOf(String.class, t.getTitle());
-
+
t.title(null);
assertNull(t.getTitle());
}
@@ -48,14 +48,14 @@ public class InfoTest {
@Test
public void testDescription() {
Info t = new Info();
-
+
t.description("foo");
assertEquals("foo", t.getDescription());
-
+
t.description(new StringBuilder("foo"));
assertEquals("foo", t.getDescription());
assertInstanceOf(String.class, t.getDescription());
-
+
t.description(null);
assertNull(t.getDescription());
}
@@ -66,14 +66,14 @@ public class InfoTest {
@Test
public void testTermsOfService() {
Info t = new Info();
-
+
t.termsOfService("foo");
assertEquals("foo", t.getTermsOfService());
-
+
t.termsOfService(new StringBuilder("foo"));
assertEquals("foo", t.getTermsOfService());
assertInstanceOf(String.class, t.getTermsOfService());
-
+
t.termsOfService(null);
assertNull(t.getTermsOfService());
}
@@ -84,10 +84,10 @@ public class InfoTest {
@Test
public void testContact() {
Info t = new Info();
-
+
t.contact(contact("foo"));
assertObjectEquals("{name:'foo'}", t.getContact());
-
+
t.contact("{name:'foo'}");
assertObjectEquals("{name:'foo'}", t.getContact());
assertInstanceOf(Contact.class, t.getContact());
@@ -102,10 +102,10 @@ public class InfoTest {
@Test
public void testLicense() {
Info t = new Info();
-
+
t.license(license("foo"));
assertObjectEquals("{name:'foo'}", t.getLicense());
-
+
t.license("{name:'foo'}");
assertObjectEquals("{name:'foo'}", t.getLicense());
assertInstanceOf(License.class, t.getLicense());
@@ -120,14 +120,14 @@ public class InfoTest {
@Test
public void testVersion() {
Info t = new Info();
-
+
t.version("foo");
assertEquals("foo", t.getVersion());
-
+
t.version(new StringBuilder("foo"));
assertEquals("foo", t.getVersion());
assertInstanceOf(String.class, t.getVersion());
-
+
t.version(null);
assertNull(t.getVersion());
}
@@ -147,9 +147,9 @@ public class InfoTest {
.set("title", "e")
.set("version", "f")
.set("$ref", "ref");
-
+
assertObjectEquals("{title:'e',description:'b',version:'f',contact:{name:'a'},license:{name:'c'},termsOfService:'d','$ref':'ref'}", t);
-
+
t
.set("contact", "{name:'a'}")
.set("description", "b")
@@ -158,9 +158,9 @@ public class InfoTest {
.set("title", "e")
.set("version", "f")
.set("$ref", "ref");
-
+
assertObjectEquals("{title:'e',description:'b',version:'f',contact:{name:'a'},license:{name:'c'},termsOfService:'d','$ref':'ref'}", t);
-
+
t
.set("contact", new StringBuilder("{name:'a'}"))
.set("description", new StringBuilder("b"))
@@ -169,7 +169,7 @@ public class InfoTest {
.set("title", new StringBuilder("e"))
.set("version", new StringBuilder("f"))
.set("$ref", new StringBuilder("ref"));
-
+
assertObjectEquals("{title:'e',description:'b',version:'f',contact:{name:'a'},license:{name:'c'},termsOfService:'d','$ref':'ref'}", t);
assertEquals("{name:'a'}", t.get("contact", String.class));
@@ -179,7 +179,7 @@ public class InfoTest {
assertEquals("e", t.get("title", String.class));
assertEquals("f", t.get("version", String.class));
assertEquals("ref", t.get("$ref", String.class));
-
+
assertInstanceOf(Contact.class, t.get("contact", Object.class));
assertInstanceOf(String.class, t.get("description", Object.class));
assertInstanceOf(License.class, t.get("license", Object.class));
@@ -187,12 +187,12 @@ public class InfoTest {
assertInstanceOf(String.class, t.get("title", Object.class));
assertInstanceOf(String.class, t.get("version", Object.class));
assertInstanceOf(StringBuilder.class, t.get("$ref", Object.class));
-
+
t.set("null", null).set(null, "null");
assertNull(t.get("null", Object.class));
assertNull(t.get(null, Object.class));
assertNull(t.get("foo", Object.class));
-
+
String s = "{title:'e',description:'b',version:'f',contact:{name:'a'},license:{name:'c'},termsOfService:'d','$ref':'ref'}";
assertObjectEquals(s, JsonParser.DEFAULT.parse(s, Info.class));
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ItemsTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ItemsTest.java
index 73832bd..1cd3ca3 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ItemsTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ItemsTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -33,14 +33,14 @@ public class ItemsTest {
@Test
public void testType() {
Items t = new Items();
-
+
t.type("foo");
assertEquals("foo", t.getType());
-
+
t.type(new StringBuilder("foo"));
assertEquals("foo", t.getType());
assertInstanceOf(String.class, t.getType());
-
+
t.type(null);
assertNull(t.getType());
}
@@ -51,14 +51,14 @@ public class ItemsTest {
@Test
public void testFormat() {
Items t = new Items();
-
+
t.format("foo");
assertEquals("foo", t.getFormat());
-
+
t.format(new StringBuilder("foo"));
assertEquals("foo", t.getFormat());
assertInstanceOf(String.class, t.getFormat());
-
+
t.format(null);
assertNull(t.getFormat());
}
@@ -69,10 +69,10 @@ public class ItemsTest {
@Test
public void testItems() {
Items t = new Items();
-
+
t.items(items("foo"));
assertObjectEquals("{type:'foo'}", t.getItems());
-
+
t.items("{type:'foo'}");
assertObjectEquals("{type:'foo'}", t.getItems());
assertInstanceOf(Items.class, t.getItems());
@@ -87,14 +87,14 @@ public class ItemsTest {
@Test
public void testCollectionFormat() {
Items t = new Items();
-
+
t.collectionFormat("foo");
assertEquals("foo", t.getCollectionFormat());
-
+
t.collectionFormat(new StringBuilder("foo"));
assertEquals("foo", t.getCollectionFormat());
assertInstanceOf(String.class, t.getCollectionFormat());
-
+
t.collectionFormat(null);
assertNull(t.getCollectionFormat());
}
@@ -105,14 +105,14 @@ public class ItemsTest {
@Test
public void test_default() {
Items t = new Items();
-
+
t._default("foo");
assertEquals("foo", t.getDefault());
-
+
t._default(new StringBuilder("foo"));
assertEquals("foo", t.getDefault().toString());
assertInstanceOf(StringBuilder.class, t.getDefault());
-
+
t._default(null);
assertNull(t.getDefault());
}
@@ -123,11 +123,11 @@ public class ItemsTest {
@Test
public void testMaximum() {
Items t = new Items();
-
+
t.maximum(123);
assertEquals(123, t.getMaximum());
assertInstanceOf(Integer.class, t.getMaximum());
-
+
t.maximum(123f);
assertEquals(123f, t.getMaximum());
assertInstanceOf(Float.class, t.getMaximum());
@@ -139,7 +139,7 @@ public class ItemsTest {
t.maximum(new StringBuilder("123"));
assertEquals(123, t.getMaximum());
assertInstanceOf(Integer.class, t.getMaximum());
-
+
t.maximum(null);
assertNull(t.getMaximum());
}
@@ -150,11 +150,11 @@ public class ItemsTest {
@Test
public void testExclusiveMaximum() {
Items t = new Items();
-
+
t.exclusiveMaximum(true);
assertEquals(true, t.getExclusiveMaximum());
assertInstanceOf(Boolean.class, t.getExclusiveMaximum());
-
+
t.exclusiveMaximum("true");
assertEquals(true, t.getExclusiveMaximum());
assertInstanceOf(Boolean.class, t.getExclusiveMaximum());
@@ -162,7 +162,7 @@ public class ItemsTest {
t.exclusiveMaximum(new StringBuilder("true"));
assertEquals(true, t.getExclusiveMaximum());
assertInstanceOf(Boolean.class, t.getExclusiveMaximum());
-
+
t.exclusiveMaximum(null);
assertNull(t.getExclusiveMaximum());
}
@@ -173,11 +173,11 @@ public class ItemsTest {
@Test
public void testMinimum() {
Items t = new Items();
-
+
t.minimum(123);
assertEquals(123, t.getMinimum());
assertInstanceOf(Integer.class, t.getMinimum());
-
+
t.minimum(123f);
assertEquals(123f, t.getMinimum());
assertInstanceOf(Float.class, t.getMinimum());
@@ -189,7 +189,7 @@ public class ItemsTest {
t.minimum(new StringBuilder("123"));
assertEquals(123, t.getMinimum());
assertInstanceOf(Integer.class, t.getMinimum());
-
+
t.minimum(null);
assertNull(t.getMinimum());
}
@@ -200,11 +200,11 @@ public class ItemsTest {
@Test
public void testExclusiveMinimum() {
Items t = new Items();
-
+
t.exclusiveMinimum(true);
assertEquals(true, t.getExclusiveMinimum());
assertInstanceOf(Boolean.class, t.getExclusiveMinimum());
-
+
t.exclusiveMinimum("true");
assertEquals(true, t.getExclusiveMinimum());
assertInstanceOf(Boolean.class, t.getExclusiveMinimum());
@@ -212,7 +212,7 @@ public class ItemsTest {
t.exclusiveMinimum(new StringBuilder("true"));
assertEquals(true, t.getExclusiveMinimum());
assertInstanceOf(Boolean.class, t.getExclusiveMinimum());
-
+
t.exclusiveMinimum(null);
assertNull(t.getExclusiveMinimum());
}
@@ -223,11 +223,11 @@ public class ItemsTest {
@Test
public void testMaxLength() {
Items t = new Items();
-
+
t.maxLength(123);
assertEquals(123, t.getMaxLength().intValue());
assertInstanceOf(Integer.class, t.getMaxLength());
-
+
t.maxLength(123f);
assertEquals(123, t.getMaxLength().intValue());
assertInstanceOf(Integer.class, t.getMaxLength());
@@ -239,7 +239,7 @@ public class ItemsTest {
t.maxLength(new StringBuilder("123"));
assertEquals(123, t.getMaxLength().intValue());
assertInstanceOf(Integer.class, t.getMaxLength());
-
+
t.maxLength(null);
assertNull(t.getMaxLength());
}
@@ -250,11 +250,11 @@ public class ItemsTest {
@Test
public void testMinLength() {
Items t = new Items();
-
+
t.minLength(123);
assertEquals(123, t.getMinLength().intValue());
assertInstanceOf(Integer.class, t.getMinLength());
-
+
t.minLength(123f);
assertEquals(123, t.getMinLength().intValue());
assertInstanceOf(Integer.class, t.getMinLength());
@@ -266,7 +266,7 @@ public class ItemsTest {
t.minLength(new StringBuilder("123"));
assertEquals(123, t.getMinLength().intValue());
assertInstanceOf(Integer.class, t.getMinLength());
-
+
t.minLength(null);
assertNull(t.getMinLength());
}
@@ -277,14 +277,14 @@ public class ItemsTest {
@Test
public void testPattern() {
Items t = new Items();
-
+
t.pattern("foo");
assertEquals("foo", t.getPattern());
-
+
t.pattern(new StringBuilder("foo"));
assertEquals("foo", t.getPattern());
assertInstanceOf(String.class, t.getPattern());
-
+
t.pattern(null);
assertNull(t.getPattern());
}
@@ -295,11 +295,11 @@ public class ItemsTest {
@Test
public void testMaxItems() {
Items t = new Items();
-
+
t.maxItems(123);
assertEquals(123, t.getMaxItems().intValue());
assertInstanceOf(Integer.class, t.getMaxItems());
-
+
t.maxItems(123f);
assertEquals(123, t.getMaxItems().intValue());
assertInstanceOf(Integer.class, t.getMaxItems());
@@ -311,7 +311,7 @@ public class ItemsTest {
t.maxItems(new StringBuilder("123"));
assertEquals(123, t.getMaxItems().intValue());
assertInstanceOf(Integer.class, t.getMaxItems());
-
+
t.maxItems(null);
assertNull(t.getMaxItems());
}
@@ -322,11 +322,11 @@ public class ItemsTest {
@Test
public void testMinItems() {
Items t = new Items();
-
+
t.minItems(123);
assertEquals(123, t.getMinItems().intValue());
assertInstanceOf(Integer.class, t.getMinItems());
-
+
t.minItems(123f);
assertEquals(123, t.getMinItems().intValue());
assertInstanceOf(Integer.class, t.getMinItems());
@@ -338,7 +338,7 @@ public class ItemsTest {
t.minItems(new StringBuilder("123"));
assertEquals(123, t.getMinItems().intValue());
assertInstanceOf(Integer.class, t.getMinItems());
-
+
t.minItems(null);
assertNull(t.getMinItems());
}
@@ -349,11 +349,11 @@ public class ItemsTest {
@Test
public void testUniqueItems() {
Items t = new Items();
-
+
t.uniqueItems(true);
assertEquals(true, t.getUniqueItems());
assertInstanceOf(Boolean.class, t.getUniqueItems());
-
+
t.uniqueItems("true");
assertEquals(true, t.getUniqueItems());
assertInstanceOf(Boolean.class, t.getUniqueItems());
@@ -361,7 +361,7 @@ public class ItemsTest {
t.uniqueItems(new StringBuilder("true"));
assertEquals(true, t.getUniqueItems());
assertInstanceOf(Boolean.class, t.getUniqueItems());
-
+
t.uniqueItems(null);
assertNull(t.getUniqueItems());
}
@@ -372,12 +372,12 @@ public class ItemsTest {
@Test
public void testSetEnum() {
Items t = new Items();
-
- t.setEnum(new ASet<Object>().appendAll("foo","bar"));
+
+ t.setEnum(new ASet<>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
-
- t.setEnum(new ASet<Object>());
+
+ t.setEnum(new ASet<>());
assertObjectEquals("[]", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
@@ -391,12 +391,12 @@ public class ItemsTest {
@Test
public void testAddEnum() {
Items t = new Items();
-
- t.addEnum(new ASet<Object>().appendAll("foo","bar"));
+
+ t.addEnum(new ASet<>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
-
- t.addEnum(new ASet<Object>().appendAll("baz"));
+
+ t.addEnum(new ASet<>().appendAll("baz"));
assertObjectEquals("['foo','bar','baz']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
@@ -411,19 +411,19 @@ public class ItemsTest {
@Test
public void test_enum() {
Items t = new Items();
-
- t._enum(new ASet<Object>().appendAll("foo","bar"));
+
+ t._enum(new ASet<>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
-
- t._enum(new ASet<Object>().appendAll("baz"));
+
+ t._enum(new ASet<>().appendAll("baz"));
assertObjectEquals("['foo','bar','baz']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
t._enum((Object[])null);
assertObjectEquals("['foo','bar','baz']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
-
+
t.setEnum(null);
t._enum("foo")._enum(new StringBuilder("bar"))._enum("['baz','qux']")._enum((Object)new String[]{"quux"});
assertObjectEquals("['foo','bar','baz','qux','quux']", t.getEnum());
@@ -436,11 +436,11 @@ public class ItemsTest {
@Test
public void testMultipleOf() {
Items t = new Items();
-
+
t.multipleOf(123);
assertEquals(123, t.getMultipleOf());
assertInstanceOf(Integer.class, t.getMultipleOf());
-
+
t.multipleOf(123f);
assertEquals(123f, t.getMultipleOf());
assertInstanceOf(Float.class, t.getMultipleOf());
@@ -452,7 +452,7 @@ public class ItemsTest {
t.multipleOf(new StringBuilder("123"));
assertEquals(123, t.getMultipleOf());
assertInstanceOf(Integer.class, t.getMultipleOf());
-
+
t.multipleOf(null);
assertNull(t.getMultipleOf());
}
@@ -483,7 +483,7 @@ public class ItemsTest {
.set("type", "j")
.set("uniqueItems", true)
.set("$ref", "ref");
-
+
assertObjectEquals("{type:'j',format:'g',items:{type:'h'},collectionFormat:'c','default':'a',maximum:123.0,exclusiveMaximum:true,minimum:123.0,exclusiveMinimum:true,maxLength:123,minLength:123,pattern:'i',maxItems:123,minItems:123,uniqueItems:true,'enum':['b'],multipleOf:123.0,'$ref':'ref'}", t);
t
@@ -505,9 +505,9 @@ public class ItemsTest {
.set("type", "j")
.set("uniqueItems", "true")
.set("$ref", "ref");
-
+
assertObjectEquals("{type:'j',format:'g',items:{type:'h'},collectionFormat:'c','default':'a',maximum:123.0,exclusiveMaximum:true,minimum:123.0,exclusiveMinimum:true,maxLength:123,minLength:123,pattern:'i',maxItems:123,minItems:123,uniqueItems:true,'enum':['b'],multipleOf:123.0,'$ref':'ref'}", t);
-
+
t
.set("default", new StringBuilder("a"))
.set("enum", new StringBuilder("['b']"))
@@ -527,9 +527,9 @@ public class ItemsTest {
.set("type", new StringBuilder("j"))
.set("uniqueItems", new StringBuilder("true"))
.set("$ref", new StringBuilder("ref"));
-
+
assertObjectEquals("{type:'j',format:'g',items:{type:'h'},collectionFormat:'c','default':'a',maximum:123.0,exclusiveMaximum:true,minimum:123.0,exclusiveMinimum:true,maxLength:123,minLength:123,pattern:'i',maxItems:123,minItems:123,uniqueItems:true,'enum':['b'],multipleOf:123.0,'$ref':'ref'}", t);
-
+
assertEquals("a", t.get("default", String.class));
assertEquals("['b']", t.get("enum", String.class));
assertEquals("c", t.get("collectionFormat", String.class));
@@ -548,7 +548,7 @@ public class ItemsTest {
assertEquals("j", t.get("type", String.class));
assertEquals("true", t.get("uniqueItems", String.class));
assertEquals("ref", t.get("$ref", String.class));
-
+
assertInstanceOf(StringBuilder.class, t.get("default", Object.class));
assertInstanceOf(List.class, t.get("enum", Object.class));
assertInstanceOf(String.class, t.get("collectionFormat", Object.class));
@@ -567,12 +567,12 @@ public class ItemsTest {
assertInstanceOf(String.class, t.get("type", Object.class));
assertInstanceOf(Boolean.class, t.get("uniqueItems", Object.class));
assertInstanceOf(String.class, t.get("$ref", Object.class));
-
+
t.set("null", null).set(null, "null");
assertNull(t.get("null", Object.class));
assertNull(t.get(null, Object.class));
assertNull(t.get("foo", Object.class));
-
+
String s = "{type:'j',format:'g',items:{type:'h'},collectionFormat:'c','default':'a',maximum:123.0,exclusiveMaximum:true,minimum:123.0,exclusiveMinimum:true,maxLength:123,minLength:123,pattern:'i',maxItems:123,minItems:123,uniqueItems:true,'enum':['b'],multipleOf:123.0,'$ref':'ref'}";
assertObjectEquals(s, JsonParser.DEFAULT.parse(s, Items.class));
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/LicenseTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/LicenseTest.java
index 5ca02f9..baa1c12 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/LicenseTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/LicenseTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -31,14 +31,14 @@ public class LicenseTest {
@Test
public void testName() {
License t = new License();
-
+
t.name("foo");
assertEquals("foo", t.getName());
-
+
t.name(new StringBuilder("foo"));
assertEquals("foo", t.getName());
assertInstanceOf(String.class, t.getName());
-
+
t.name(null);
assertNull(t.getName());
}
@@ -49,10 +49,10 @@ public class LicenseTest {
@Test
public void testUrl() {
License t = new License();
-
+
t.url(URI.create("foo"));
assertEquals("foo", t.getUrl().toString());
-
+
t.url("foo");
assertEquals("foo", t.getUrl().toString());
assertInstanceOf(URI.class, t.getUrl());
@@ -67,41 +67,41 @@ public class LicenseTest {
@Test
public void testSet() throws Exception {
License t = new License();
-
+
t
.set("name", "a")
.set("url", URI.create("b"))
.set("$ref", "ref");
-
+
assertObjectEquals("{name:'a',url:'b','$ref':'ref'}", t);
-
+
t
.set("name", "a")
.set("url", "b")
.set("$ref", "ref");
-
+
assertObjectEquals("{name:'a',url:'b','$ref':'ref'}", t);
t
.set("name", new StringBuilder("a"))
.set("url", new StringBuilder("b"))
.set("$ref", new StringBuilder("ref"));
-
+
assertObjectEquals("{name:'a',url:'b','$ref':'ref'}", t);
-
+
assertEquals("a", t.get("name", String.class));
assertEquals("b", t.get("url", String.class));
assertEquals("ref", t.get("$ref", String.class));
-
+
assertInstanceOf(String.class, t.get("name", Object.class));
assertInstanceOf(URI.class, t.get("url", Object.class));
assertInstanceOf(StringBuilder.class, t.get("$ref", Object.class));
-
+
t.set("null", null).set(null, "null");
assertNull(t.get("null", Object.class));
assertNull(t.get(null, Object.class));
assertNull(t.get("foo", Object.class));
-
+
String s = "{name:'a',url:'b','$ref':'ref'}";
assertObjectEquals(s, JsonParser.DEFAULT.parse(s, License.class));
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/OperationTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/OperationTest.java
index 6c887b7..8241ab8 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/OperationTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/OperationTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -34,11 +34,11 @@ public class OperationTest {
@Test
public void testSetTags() {
Operation t = new Operation();
-
+
t.setTags(new ASet<String>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getTags());
assertInstanceOf(List.class, t.getTags());
-
+
t.setTags(new ASet<String>());
assertObjectEquals("[]", t.getTags());
assertInstanceOf(List.class, t.getTags());
@@ -57,7 +57,7 @@ public class OperationTest {
t.addTags(new ASet<String>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getTags());
assertInstanceOf(List.class, t.getTags());
-
+
t.addTags(new ASet<String>());
assertObjectEquals("['foo','bar']", t.getTags());
assertInstanceOf(List.class, t.getTags());
@@ -75,7 +75,7 @@ public class OperationTest {
Operation t = new Operation();
t.tags(new ASet<String>().appendAll("a"));
- t.tags(new ASet<Object>().appendAll(new StringBuilder("b")));
+ t.tags(new ASet<>().appendAll(new StringBuilder("b")));
t.tags((Object)new String[] {"c"});
t.tags((Object)new Object[] {new StringBuilder("d")});
t.tags("e");
@@ -93,14 +93,14 @@ public class OperationTest {
@Test
public void testSummary() {
Operation t = new Operation();
-
+
t.summary("foo");
assertEquals("foo", t.getSummary());
-
+
t.summary(new StringBuilder("foo"));
assertEquals("foo", t.getSummary());
assertInstanceOf(String.class, t.getSummary());
-
+
t.summary(null);
assertNull(t.getSummary());
}
@@ -111,14 +111,14 @@ public class OperationTest {
@Test
public void testDescription() {
Operation t = new Operation();
-
+
t.description("foo");
assertEquals("foo", t.getDescription());
-
+
t.description(new StringBuilder("foo"));
assertEquals("foo", t.getDescription());
assertInstanceOf(String.class, t.getDescription());
-
+
t.description(null);
assertNull(t.getDescription());
}
@@ -129,10 +129,10 @@ public class OperationTest {
@Test
public void testExternalDocs() {
Operation t = new Operation();
-
+
t.externalDocs(externalDocumentation("foo"));
assertObjectEquals("{url:'foo'}", t.getExternalDocs());
-
+
t.externalDocs("{url:'foo'}");
assertObjectEquals("{url:'foo'}", t.getExternalDocs());
assertInstanceOf(ExternalDocumentation.class, t.getExternalDocs());
@@ -147,14 +147,14 @@ public class OperationTest {
@Test
public void testOperationId() {
Operation t = new Operation();
-
+
t.operationId("foo");
assertEquals("foo", t.getOperationId());
-
+
t.operationId(new StringBuilder("foo"));
assertEquals("foo", t.getOperationId());
assertInstanceOf(String.class, t.getOperationId());
-
+
t.operationId(null);
assertNull(t.getOperationId());
}
@@ -165,11 +165,11 @@ public class OperationTest {
@Test
public void testSetConsumes() {
Operation t = new Operation();
-
+
t.setConsumes(new ASet<MediaType>().appendAll(MediaType.forString("text/foo")));
assertObjectEquals("['text/foo']", t.getConsumes());
assertInstanceOf(List.class, t.getConsumes());
-
+
t.setConsumes(new ASet<MediaType>());
assertObjectEquals("[]", t.getConsumes());
assertInstanceOf(List.class, t.getConsumes());
@@ -188,7 +188,7 @@ public class OperationTest {
t.addConsumes(new ASet<MediaType>().appendAll(MediaType.forString("text/foo")));
assertObjectEquals("['text/foo']", t.getConsumes());
assertInstanceOf(List.class, t.getConsumes());
-
+
t.addConsumes(new ASet<MediaType>());
assertObjectEquals("['text/foo']", t.getConsumes());
assertInstanceOf(List.class, t.getConsumes());
@@ -226,11 +226,11 @@ public class OperationTest {
@Test
public void testSetProduces() {
Operation t = new Operation();
-
+
t.setProduces(new ASet<MediaType>().appendAll(MediaType.forString("text/foo")));
assertObjectEquals("['text/foo']", t.getProduces());
assertInstanceOf(List.class, t.getProduces());
-
+
t.setProduces(new ASet<MediaType>());
assertObjectEquals("[]", t.getProduces());
assertInstanceOf(List.class, t.getProduces());
@@ -249,7 +249,7 @@ public class OperationTest {
t.addProduces(new ASet<MediaType>().appendAll(MediaType.forString("text/foo")));
assertObjectEquals("['text/foo']", t.getProduces());
assertInstanceOf(List.class, t.getProduces());
-
+
t.addProduces(new ASet<MediaType>());
assertObjectEquals("['text/foo']", t.getProduces());
assertInstanceOf(List.class, t.getProduces());
@@ -287,11 +287,11 @@ public class OperationTest {
@Test
public void testSetParameters() {
Operation t = new Operation();
-
+
t.setParameters(new ASet<ParameterInfo>().appendAll(parameterInfo("foo","bar")));
assertObjectEquals("[{'in':'foo',name:'bar'}]", t.getParameters());
assertInstanceOf(List.class, t.getParameters());
-
+
t.setParameters(new ASet<ParameterInfo>());
assertObjectEquals("[]", t.getParameters());
assertInstanceOf(List.class, t.getParameters());
@@ -310,7 +310,7 @@ public class OperationTest {
t.addParameters(new ASet<ParameterInfo>().appendAll(parameterInfo("foo","bar")));
assertObjectEquals("[{'in':'foo',name:'bar'}]", t.getParameters());
assertInstanceOf(List.class, t.getParameters());
-
+
t.addParameters(new ASet<ParameterInfo>());
assertObjectEquals("[{'in':'foo',name:'bar'}]", t.getParameters());
assertInstanceOf(List.class, t.getParameters());
@@ -348,11 +348,11 @@ public class OperationTest {
@Test
public void testSetResponses() {
Operation t = new Operation();
-
+
t.setResponses(new AMap<String,ResponseInfo>().append("123",responseInfo("bar")));
assertObjectEquals("{'123':{description:'bar'}}", t.getResponses());
assertInstanceOf(Map.class, t.getResponses());
-
+
t.setResponses(new AMap<String,ResponseInfo>());
assertObjectEquals("{}", t.getResponses());
assertInstanceOf(Map.class, t.getResponses());
@@ -371,7 +371,7 @@ public class OperationTest {
t.addResponses(new AMap<String,ResponseInfo>().append("123",responseInfo("bar")));
assertObjectEquals("{'123':{description:'bar'}}", t.getResponses());
assertInstanceOf(Map.class, t.getResponses());
-
+
t.addResponses(new AMap<String,ResponseInfo>());
assertObjectEquals("{'123':{description:'bar'}}", t.getResponses());
assertInstanceOf(Map.class, t.getResponses());
@@ -387,7 +387,7 @@ public class OperationTest {
@Test
public void testResponse() {
Operation t = new Operation();
-
+
t.response("1", responseInfo("foo"));
t.response(null, responseInfo("bar"));
t.response("2", null);
@@ -400,13 +400,13 @@ public class OperationTest {
@Test
public void testResponses() {
Operation t = new Operation();
-
+
t.responses(new AMap<Integer,ResponseInfo>().append(1,responseInfo("a")));
t.responses(new AMap<String,String>().append("2","{description:'b'}"));
t.responses("{3:{description:'c'}}");
t.responses("{}");
t.responses((Object)null);
-
+
assertObjectEquals("{'1':{description:'a'},'2':{description:'b'},'3':{description:'c'}}", t.getResponses());
for (Map.Entry<String,ResponseInfo> e : t.getResponses().entrySet()) {
assertInstanceOf(String.class, e.getKey());
@@ -424,7 +424,7 @@ public class OperationTest {
t.setSchemes(new ASet<String>().appendAll("foo"));
assertObjectEquals("['foo']", t.getSchemes());
assertInstanceOf(List.class, t.getSchemes());
-
+
t.setSchemes(new ASet<String>());
assertObjectEquals("[]", t.getSchemes());
assertInstanceOf(List.class, t.getSchemes());
@@ -443,7 +443,7 @@ public class OperationTest {
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());
@@ -451,7 +451,7 @@ public class OperationTest {
t.setSecurity(null);
assertNull(t.getSecurity());
}
-
+
/**
* Test method for {@link Operation#addSchemes(java.util.Collection)}.
*/
@@ -462,7 +462,7 @@ public class OperationTest {
t.addSchemes(new ASet<String>().appendAll("foo"));
assertObjectEquals("['foo']", t.getSchemes());
assertInstanceOf(List.class, t.getSchemes());
-
+
t.addSchemes(new ASet<String>());
assertObjectEquals("['foo']", t.getSchemes());
assertInstanceOf(List.class, t.getSchemes());
@@ -480,7 +480,7 @@ public class OperationTest {
Operation t = new Operation();
t.schemes(new ASet<String>().appendAll("a"));
- t.schemes(new ASet<Object>().appendAll(new StringBuilder("b")));
+ t.schemes(new ASet<>().appendAll(new StringBuilder("b")));
t.schemes((Object)new String[] {"c"});
t.schemes((Object)new Object[] {new StringBuilder("d")});
t.schemes("e");
@@ -498,11 +498,11 @@ public class OperationTest {
@Test
public void testDeprecated() {
Operation t = new Operation();
-
+
t.deprecated(true);
assertEquals(true, t.getDeprecated());
assertInstanceOf(Boolean.class, t.getDeprecated());
-
+
t.deprecated("true");
assertEquals(true, t.getDeprecated());
assertInstanceOf(Boolean.class, t.getDeprecated());
@@ -510,7 +510,7 @@ public class OperationTest {
t.deprecated(new StringBuilder("true"));
assertEquals(true, t.getDeprecated());
assertInstanceOf(Boolean.class, t.getDeprecated());
-
+
t.deprecated(null);
assertNull(t.getDeprecated());
}
@@ -525,7 +525,7 @@ public class OperationTest {
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());
@@ -541,12 +541,12 @@ public class OperationTest {
@Test
public void testSecurity() {
Operation t = new Operation();
-
+
t.security("a", "a1", "a2");
t.security("b");
t.security("c", (String)null);
t.security(null, "d");
-
+
assertObjectEquals("[{a:['a1','a2']},{b:[]},{c:[null]},{null:['d']}]", t.getSecurity());
}
@@ -591,9 +591,9 @@ public class OperationTest {
.set("summary", "j")
.set("tags", new ASet<String>().appendAll("k"))
.set("$ref", "ref");
-
+
assertObjectEquals("{operationId:'d',summary:'j',description:'b',tags:['k'],externalDocs:{url:'c'},consumes:['text/a'],produces:['text/f'],parameters:[{'in':'e1',name:'e2'}],responses:{'1':{description:'g'}},schemes:['h'],deprecated:true,security:[{i1:['i2']}],'$ref':'ref'}", t);
-
+
t
.set("consumes", "['text/a']")
.set("deprecated", "true")
@@ -608,9 +608,9 @@ public class OperationTest {
.set("summary", "j")
.set("tags", "['k']")
.set("$ref", "ref");
-
+
assertObjectEquals("{operationId:'d',summary:'j',description:'b',tags:['k'],externalDocs:{url:'c'},consumes:['text/a'],produces:['text/f'],parameters:[{'in':'e1',name:'e2'}],responses:{'1':{description:'g'}},schemes:['h'],deprecated:true,security:[{i1:['i2']}],'$ref':'ref'}", t);
-
+
t
.set("consumes", new StringBuilder("['text/a']"))
.set("deprecated", new StringBuilder("true"))
@@ -625,7 +625,7 @@ public class OperationTest {
.set("summary", new StringBuilder("j"))
.set("tags", new StringBuilder("['k']"))
.set("$ref", new StringBuilder("ref"));
-
+
assertObjectEquals("{operationId:'d',summary:'j',description:'b',tags:['k'],externalDocs:{url:'c'},consumes:['text/a'],produces:['text/f'],parameters:[{'in':'e1',name:'e2'}],responses:{'1':{description:'g'}},schemes:['h'],deprecated:true,security:[{i1:['i2']}],'$ref':'ref'}", t);
assertEquals("['text/a']", t.get("consumes", String.class));
@@ -641,7 +641,7 @@ public class OperationTest {
assertEquals("j", t.get("summary", String.class));
assertEquals("['k']", t.get("tags", String.class));
assertEquals("ref", t.get("$ref", String.class));
-
+
assertInstanceOf(List.class, t.get("consumes", Object.class));
assertInstanceOf(MediaType.class, t.get("consumes", List.class).get(0));
assertInstanceOf(Boolean.class, t.get("deprecated", Object.class));
@@ -665,7 +665,7 @@ public class OperationTest {
assertNull(t.get("null", Object.class));
assertNull(t.get(null, Object.class));
assertNull(t.get("foo", Object.class));
-
+
String s = "{operationId:'d',summary:'j',description:'b',tags:['k'],externalDocs:{url:'c'},consumes:['text/a'],produces:['text/f'],parameters:[{'in':'e1',name:'e2'}],responses:{'1':{description:'g'}},schemes:['h'],deprecated:true,security:[{i1:['i2']}],'$ref':'ref'}";
assertObjectEquals(s, JsonParser.DEFAULT.parse(s, Operation.class));
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ParameterInfoTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ParameterInfoTest.java
index cc317ca..5a8e623 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ParameterInfoTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ParameterInfoTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -33,14 +33,14 @@ public class ParameterInfoTest {
@Test
public void testName() {
ParameterInfo t = new ParameterInfo();
-
+
t.name("foo");
assertEquals("foo", t.getName());
-
+
t.name(new StringBuilder("foo"));
assertEquals("foo", t.getName());
assertInstanceOf(String.class, t.getName());
-
+
t.name(null);
assertNull(t.getName());
}
@@ -51,14 +51,14 @@ public class ParameterInfoTest {
@Test
public void testIn() {
ParameterInfo t = new ParameterInfo();
-
+
t.in("foo");
assertEquals("foo", t.getIn());
-
+
t.in(new StringBuilder("foo"));
assertEquals("foo", t.getIn());
assertInstanceOf(String.class, t.getIn());
-
+
t.in(null);
assertNull(t.getIn());
}
@@ -69,14 +69,14 @@ public class ParameterInfoTest {
@Test
public void testDescription() {
ParameterInfo t = new ParameterInfo();
-
+
t.description("foo");
assertEquals("foo", t.getDescription());
-
+
t.description(new StringBuilder("foo"));
assertEquals("foo", t.getDescription());
assertInstanceOf(String.class, t.getDescription());
-
+
t.description(null);
assertNull(t.getDescription());
}
@@ -87,11 +87,11 @@ public class ParameterInfoTest {
@Test
public void testRequired() {
ParameterInfo t = new ParameterInfo();
-
+
t.required(true);
assertEquals(true, t.getRequired());
assertInstanceOf(Boolean.class, t.getRequired());
-
+
t.required("true");
assertEquals(true, t.getRequired());
assertInstanceOf(Boolean.class, t.getRequired());
@@ -99,7 +99,7 @@ public class ParameterInfoTest {
t.required(new StringBuilder("true"));
assertEquals(true, t.getRequired());
assertInstanceOf(Boolean.class, t.getRequired());
-
+
t.required(null);
assertNull(t.getRequired());
}
@@ -110,10 +110,10 @@ public class ParameterInfoTest {
@Test
public void testSchema() {
ParameterInfo t = new ParameterInfo();
-
+
t.schema(schemaInfo().title("foo"));
assertObjectEquals("{title:'foo'}", t.getSchema());
-
+
t.schema("{title:'foo'}");
assertObjectEquals("{title:'foo'}", t.getSchema());
assertInstanceOf(SchemaInfo.class, t.getSchema());
@@ -128,14 +128,14 @@ public class ParameterInfoTest {
@Test
public void testType() {
ParameterInfo t = new ParameterInfo();
-
+
t.type("foo");
assertEquals("foo", t.getType());
-
+
t.type(new StringBuilder("foo"));
assertEquals("foo", t.getType());
assertInstanceOf(String.class, t.getType());
-
+
t.type(null);
assertNull(t.getType());
}
@@ -146,14 +146,14 @@ public class ParameterInfoTest {
@Test
public void testFormat() {
ParameterInfo t = new ParameterInfo();
-
+
t.format("foo");
assertEquals("foo", t.getFormat());
-
+
t.format(new StringBuilder("foo"));
assertEquals("foo", t.getFormat());
assertInstanceOf(String.class, t.getFormat());
-
+
t.format(null);
assertNull(t.getFormat());
}
@@ -164,11 +164,11 @@ public class ParameterInfoTest {
@Test
public void testAllowEmptyValue() {
ParameterInfo t = new ParameterInfo();
-
+
t.allowEmptyValue(true);
assertEquals(true, t.getAllowEmptyValue());
assertInstanceOf(Boolean.class, t.getAllowEmptyValue());
-
+
t.allowEmptyValue("true");
assertEquals(true, t.getAllowEmptyValue());
assertInstanceOf(Boolean.class, t.getAllowEmptyValue());
@@ -176,7 +176,7 @@ public class ParameterInfoTest {
t.allowEmptyValue(new StringBuilder("true"));
assertEquals(true, t.getAllowEmptyValue());
assertInstanceOf(Boolean.class, t.getAllowEmptyValue());
-
+
t.allowEmptyValue(null);
assertNull(t.getAllowEmptyValue());
}
@@ -187,10 +187,10 @@ public class ParameterInfoTest {
@Test
public void testItems() {
ParameterInfo t = new ParameterInfo();
-
+
t.items(items("foo"));
assertObjectEquals("{type:'foo'}", t.getItems());
-
+
t.items("{type:'foo'}");
assertObjectEquals("{type:'foo'}", t.getItems());
assertInstanceOf(Items.class, t.getItems());
@@ -205,14 +205,14 @@ public class ParameterInfoTest {
@Test
public void testCollectionFormat() {
ParameterInfo t = new ParameterInfo();
-
+
t.collectionFormat("foo");
assertEquals("foo", t.getCollectionFormat());
-
+
t.collectionFormat(new StringBuilder("foo"));
assertEquals("foo", t.getCollectionFormat());
assertInstanceOf(String.class, t.getCollectionFormat());
-
+
t.collectionFormat(null);
assertNull(t.getCollectionFormat());
}
@@ -223,14 +223,14 @@ public class ParameterInfoTest {
@Test
public void test_default() {
ParameterInfo t = new ParameterInfo();
-
+
t._default("foo");
assertEquals("foo", t.getDefault());
-
+
t._default(new StringBuilder("foo"));
assertEquals("foo", t.getDefault().toString());
assertInstanceOf(StringBuilder.class, t.getDefault());
-
+
t._default(null);
assertNull(t.getDefault());
}
@@ -241,11 +241,11 @@ public class ParameterInfoTest {
@Test
public void testMaximum() {
ParameterInfo t = new ParameterInfo();
-
+
t.maximum(123);
assertEquals(123, t.getMaximum());
assertInstanceOf(Integer.class, t.getMaximum());
-
+
t.maximum(123f);
assertEquals(123f, t.getMaximum());
assertInstanceOf(Float.class, t.getMaximum());
@@ -257,7 +257,7 @@ public class ParameterInfoTest {
t.maximum(new StringBuilder("123"));
assertEquals(123, t.getMaximum());
assertInstanceOf(Integer.class, t.getMaximum());
-
+
t.maximum(null);
assertNull(t.getMaximum());
}
@@ -268,11 +268,11 @@ public class ParameterInfoTest {
@Test
public void testExclusiveMaximum() {
ParameterInfo t = new ParameterInfo();
-
+
t.exclusiveMaximum(true);
assertEquals(true, t.getExclusiveMaximum());
assertInstanceOf(Boolean.class, t.getExclusiveMaximum());
-
+
t.exclusiveMaximum("true");
assertEquals(true, t.getExclusiveMaximum());
assertInstanceOf(Boolean.class, t.getExclusiveMaximum());
@@ -280,7 +280,7 @@ public class ParameterInfoTest {
t.exclusiveMaximum(new StringBuilder("true"));
assertEquals(true, t.getExclusiveMaximum());
assertInstanceOf(Boolean.class, t.getExclusiveMaximum());
-
+
t.exclusiveMaximum(null);
assertNull(t.getExclusiveMaximum());
}
@@ -291,11 +291,11 @@ public class ParameterInfoTest {
@Test
public void testMinimum() {
ParameterInfo t = new ParameterInfo();
-
+
t.minimum(123);
assertEquals(123, t.getMinimum());
assertInstanceOf(Integer.class, t.getMinimum());
-
+
t.minimum(123f);
assertEquals(123f, t.getMinimum());
assertInstanceOf(Float.class, t.getMinimum());
@@ -307,7 +307,7 @@ public class ParameterInfoTest {
t.minimum(new StringBuilder("123"));
assertEquals(123, t.getMinimum());
assertInstanceOf(Integer.class, t.getMinimum());
-
+
t.minimum(null);
assertNull(t.getMinimum());
}
@@ -318,11 +318,11 @@ public class ParameterInfoTest {
@Test
public void testExclusiveMinimum() {
ParameterInfo t = new ParameterInfo();
-
+
t.exclusiveMinimum(true);
assertEquals(true, t.getExclusiveMinimum());
assertInstanceOf(Boolean.class, t.getExclusiveMinimum());
-
+
t.exclusiveMinimum("true");
assertEquals(true, t.getExclusiveMinimum());
assertInstanceOf(Boolean.class, t.getExclusiveMinimum());
@@ -330,7 +330,7 @@ public class ParameterInfoTest {
t.exclusiveMinimum(new StringBuilder("true"));
assertEquals(true, t.getExclusiveMinimum());
assertInstanceOf(Boolean.class, t.getExclusiveMinimum());
-
+
t.exclusiveMinimum(null);
assertNull(t.getExclusiveMinimum());
}
@@ -341,11 +341,11 @@ public class ParameterInfoTest {
@Test
public void testMaxLength() {
ParameterInfo t = new ParameterInfo();
-
+
t.maxLength(123);
assertEquals(123, t.getMaxLength().intValue());
assertInstanceOf(Integer.class, t.getMaxLength());
-
+
t.maxLength(123f);
assertEquals(123, t.getMaxLength().intValue());
assertInstanceOf(Integer.class, t.getMaxLength());
@@ -357,7 +357,7 @@ public class ParameterInfoTest {
t.maxLength(new StringBuilder("123"));
assertEquals(123, t.getMaxLength().intValue());
assertInstanceOf(Integer.class, t.getMaxLength());
-
+
t.maxLength(null);
assertNull(t.getMaxLength());
}
@@ -368,11 +368,11 @@ public class ParameterInfoTest {
@Test
public void testMinLength() {
ParameterInfo t = new ParameterInfo();
-
+
t.minLength(123);
assertEquals(123, t.getMinLength().intValue());
assertInstanceOf(Integer.class, t.getMinLength());
-
+
t.minLength(123f);
assertEquals(123, t.getMinLength().intValue());
assertInstanceOf(Integer.class, t.getMinLength());
@@ -384,7 +384,7 @@ public class ParameterInfoTest {
t.minLength(new StringBuilder("123"));
assertEquals(123, t.getMinLength().intValue());
assertInstanceOf(Integer.class, t.getMinLength());
-
+
t.minLength(null);
assertNull(t.getMinLength());
}
@@ -395,14 +395,14 @@ public class ParameterInfoTest {
@Test
public void testPattern() {
ParameterInfo t = new ParameterInfo();
-
+
t.pattern("foo");
assertEquals("foo", t.getPattern());
-
+
t.pattern(new StringBuilder("foo"));
assertEquals("foo", t.getPattern());
assertInstanceOf(String.class, t.getPattern());
-
+
t.pattern(null);
assertNull(t.getPattern());
}
@@ -413,11 +413,11 @@ public class ParameterInfoTest {
@Test
public void testMaxItems() {
ParameterInfo t = new ParameterInfo();
-
+
t.maxItems(123);
assertEquals(123, t.getMaxItems().intValue());
assertInstanceOf(Integer.class, t.getMaxItems());
-
+
t.maxItems(123f);
assertEquals(123, t.getMaxItems().intValue());
assertInstanceOf(Integer.class, t.getMaxItems());
@@ -429,7 +429,7 @@ public class ParameterInfoTest {
t.maxItems(new StringBuilder("123"));
assertEquals(123, t.getMaxItems().intValue());
assertInstanceOf(Integer.class, t.getMaxItems());
-
+
t.maxItems(null);
assertNull(t.getMaxItems());
}
@@ -440,11 +440,11 @@ public class ParameterInfoTest {
@Test
public void testMinItems() {
ParameterInfo t = new ParameterInfo();
-
+
t.minItems(123);
assertEquals(123, t.getMinItems().intValue());
assertInstanceOf(Integer.class, t.getMinItems());
-
+
t.minItems(123f);
assertEquals(123, t.getMinItems().intValue());
assertInstanceOf(Integer.class, t.getMinItems());
@@ -456,7 +456,7 @@ public class ParameterInfoTest {
t.minItems(new StringBuilder("123"));
assertEquals(123, t.getMinItems().intValue());
assertInstanceOf(Integer.class, t.getMinItems());
-
+
t.minItems(null);
assertNull(t.getMinItems());
}
@@ -467,11 +467,11 @@ public class ParameterInfoTest {
@Test
public void testUniqueItems() {
ParameterInfo t = new ParameterInfo();
-
+
t.uniqueItems(true);
assertEquals(true, t.getUniqueItems());
assertInstanceOf(Boolean.class, t.getUniqueItems());
-
+
t.uniqueItems("true");
assertEquals(true, t.getUniqueItems());
assertInstanceOf(Boolean.class, t.getUniqueItems());
@@ -479,7 +479,7 @@ public class ParameterInfoTest {
t.uniqueItems(new StringBuilder("true"));
assertEquals(true, t.getUniqueItems());
assertInstanceOf(Boolean.class, t.getUniqueItems());
-
+
t.uniqueItems(null);
assertNull(t.getUniqueItems());
}
@@ -490,12 +490,12 @@ public class ParameterInfoTest {
@Test
public void testSetEnum() {
ParameterInfo t = new ParameterInfo();
-
- t.setEnum(new ASet<Object>().appendAll("foo","bar"));
+
+ t.setEnum(new ASet<>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
-
- t.setEnum(new ASet<Object>());
+
+ t.setEnum(new ASet<>());
assertObjectEquals("[]", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
@@ -509,12 +509,12 @@ public class ParameterInfoTest {
@Test
public void testAddEnum() {
ParameterInfo t = new ParameterInfo();
-
- t.addEnum(new ASet<Object>().appendAll("foo","bar"));
+
+ t.addEnum(new ASet<>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
-
- t.addEnum(new ASet<Object>().appendAll("baz"));
+
+ t.addEnum(new ASet<>().appendAll("baz"));
assertObjectEquals("['foo','bar','baz']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
@@ -529,19 +529,19 @@ public class ParameterInfoTest {
@Test
public void test_enum() {
ParameterInfo t = new ParameterInfo();
-
- t._enum(new ASet<Object>().appendAll("foo","bar"));
+
+ t._enum(new ASet<>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
-
- t._enum(new ASet<Object>().appendAll("baz"));
+
+ t._enum(new ASet<>().appendAll("baz"));
assertObjectEquals("['foo','bar','baz']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
t._enum((Object[])null);
assertObjectEquals("['foo','bar','baz']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
-
+
t.setEnum(null);
t._enum("foo")._enum(new StringBuilder("bar"))._enum("['baz','qux']")._enum((Object)new String[]{"quux"});
assertObjectEquals("['foo','bar','baz','qux','quux']", t.getEnum());
@@ -554,11 +554,11 @@ public class ParameterInfoTest {
@Test
public void testMultipleOf() {
ParameterInfo t = new ParameterInfo();
-
+
t.multipleOf(123);
assertEquals(123, t.getMultipleOf());
assertInstanceOf(Integer.class, t.getMultipleOf());
-
+
t.multipleOf(123f);
assertEquals(123f, t.getMultipleOf());
assertInstanceOf(Float.class, t.getMultipleOf());
@@ -570,7 +570,7 @@ public class ParameterInfoTest {
t.multipleOf(new StringBuilder("123"));
assertEquals(123, t.getMultipleOf());
assertInstanceOf(Integer.class, t.getMultipleOf());
-
+
t.multipleOf(null);
assertNull(t.getMultipleOf());
}
@@ -581,10 +581,10 @@ public class ParameterInfoTest {
@Test
public void testSet() throws Exception {
ParameterInfo t = new ParameterInfo();
-
+
t
.set("default", "a")
- .set("enum", new ASet<Object>().appendAll("b"))
+ .set("enum", new ASet<>().appendAll("b"))
.set("allowEmptyValue", true)
.set("collectionFormat", "c")
.set("description", "d")
@@ -607,9 +607,9 @@ public class ParameterInfoTest {
.set("type", "k")
.set("uniqueItems", true)
.set("$ref", "ref");
-
+
assertObjectEquals("{'in':'f',name:'h',type:'k',description:'d',required:true,schema:{title:'j'},format:'e',allowEmptyValue:true,items:{type:'g'},collectionFormat:'c','default':'a',maximum:123.0,exclusiveMaximum:true,minimum:123.0,exclusiveMinimum:true,maxLength:123,minLength:123,pattern:'i',maxItems:123,minItems:123,uniqueItems:true,'enum':['b'],multipleOf:123.0,'$ref':'ref'}", t);
-
+
t
.set("default", "a")
.set("enum", "['b']")
@@ -635,9 +635,9 @@ public class ParameterInfoTest {
.set("type", "k")
.set("uniqueItems", "true")
.set("$ref", "ref");
-
+
assertObjectEquals("{'in':'f',name:'h',type:'k',description:'d',required:true,schema:{title:'j'},format:'e',allowEmptyValue:true,items:{type:'g'},collectionFormat:'c','default':'a',maximum:123.0,exclusiveMaximum:true,minimum:123.0,exclusiveMinimum:true,maxLength:123,minLength:123,pattern:'i',maxItems:123,minItems:123,uniqueItems:true,'enum':['b'],multipleOf:123.0,'$ref':'ref'}", t);
-
+
t
.set("default", new StringBuilder("a"))
.set("enum", new StringBuilder("['b']"))
@@ -663,7 +663,7 @@ public class ParameterInfoTest {
.set("type", new StringBuilder("k"))
.set("uniqueItems", new StringBuilder("true"))
.set("$ref", new StringBuilder("ref"));
-
+
assertObjectEquals("{'in':'f',name:'h',type:'k',description:'d',required:true,schema:{title:'j'},format:'e',allowEmptyValue:true,items:{type:'g'},collectionFormat:'c','default':'a',maximum:123.0,exclusiveMaximum:true,minimum:123.0,exclusiveMinimum:true,maxLength:123,minLength:123,pattern:'i',maxItems:123,minItems:123,uniqueItems:true,'enum':['b'],multipleOf:123.0,'$ref':'ref'}", t);
assertEquals("a", t.get("default", String.class));
@@ -690,7 +690,7 @@ public class ParameterInfoTest {
assertEquals("k", t.get("type", String.class));
assertEquals("true", t.get("uniqueItems", String.class));
assertEquals("ref", t.get("$ref", String.class));
-
+
assertInstanceOf(StringBuilder.class, t.get("default", Object.class));
assertInstanceOf(List.class, t.get("enum", Object.class));
assertInstanceOf(Boolean.class, t.get("allowEmptyValue", Object.class));
@@ -715,12 +715,12 @@ public class ParameterInfoTest {
assertInstanceOf(String.class, t.get("type", Object.class));
assertInstanceOf(Boolean.class, t.get("uniqueItems", Object.class));
assertInstanceOf(StringBuilder.class, t.get("$ref", Object.class));
-
+
t.set("null", null).set(null, "null");
assertNull(t.get("null", Object.class));
assertNull(t.get(null, Object.class));
assertNull(t.get("foo", Object.class));
-
+
String s = "{'in':'f',name:'h',type:'k',description:'d',required:true,schema:{title:'j'},format:'e',allowEmptyValue:true,items:{type:'g'},collectionFormat:'c','default':'a',maximum:123.0,exclusiveMaximum:true,minimum:123.0,exclusiveMinimum:true,maxLength:123,minLength:123,pattern:'i',maxItems:123,minItems:123,uniqueItems:true,'enum':['b'],multipleOf:123.0,'$ref':'ref'}";
assertObjectEquals(s, JsonParser.DEFAULT.parse(s, ParameterInfo.class));
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ResponseInfoTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ResponseInfoTest.java
index 92c497b..7abcdf6 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ResponseInfoTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/ResponseInfoTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -33,14 +33,14 @@ public class ResponseInfoTest {
@Test
public void testDescription() {
ResponseInfo t = new ResponseInfo();
-
+
t.description("foo");
assertEquals("foo", t.getDescription());
-
+
t.description(new StringBuilder("foo"));
assertEquals("foo", t.getDescription());
assertInstanceOf(String.class, t.getDescription());
-
+
t.description(null);
assertNull(t.getDescription());
}
@@ -51,10 +51,10 @@ public class ResponseInfoTest {
@Test
public void testSchema() {
ResponseInfo t = new ResponseInfo();
-
+
t.schema(schemaInfo().title("foo"));
assertObjectEquals("{title:'foo'}", t.getSchema());
-
+
t.schema("{title:'foo'}");
assertObjectEquals("{title:'foo'}", t.getSchema());
assertInstanceOf(SchemaInfo.class, t.getSchema());
@@ -69,12 +69,12 @@ public class ResponseInfoTest {
@Test
public void testSetHeaders() {
ResponseInfo t = new ResponseInfo();
-
+
t.setHeaders(new AMap<String,HeaderInfo>().append("foo",headerInfo("bar")));
assertObjectEquals("{foo:{type:'bar'}}", t.getHeaders());
assertInstanceOf(Map.class, t.getHeaders());
assertInstanceOf(HeaderInfo.class, t.getHeaders().get("foo"));
-
+
t.setHeaders(new AMap<String,HeaderInfo>());
assertObjectEquals("{}", t.getHeaders());
assertInstanceOf(Map.class, t.getHeaders());
@@ -89,12 +89,12 @@ public class ResponseInfoTest {
@Test
public void testAddHeaders() {
ResponseInfo t = new ResponseInfo();
-
+
t.addHeaders(new AMap<String,HeaderInfo>().append("foo",headerInfo("bar")));
assertObjectEquals("{foo:{type:'bar'}}", t.getHeaders());
assertInstanceOf(Map.class, t.getHeaders());
assertInstanceOf(HeaderInfo.class, t.getHeaders().get("foo"));
-
+
t.addHeaders(new AMap<String,HeaderInfo>());
assertObjectEquals("{foo:{type:'bar'}}", t.getHeaders());
assertInstanceOf(Map.class, t.getHeaders());
@@ -112,7 +112,7 @@ public class ResponseInfoTest {
@Test
public void testHeader() {
ResponseInfo t = new ResponseInfo();
-
+
t.header("a", headerInfo("a1"));
t.header("b", null);
t.header(null, headerInfo("c1"));
@@ -126,13 +126,13 @@ public class ResponseInfoTest {
@Test
public void testHeaders() {
ResponseInfo t = new ResponseInfo();
-
+
t.headers(new AMap<String,HeaderInfo>().append("a", headerInfo("a1")));
t.headers(new AMap<String,String>().append("b", "{type:'b1'}"));
t.headers("{c:{type:'c1'}}");
t.headers("{}");
t.headers((Object[])null);
-
+
assertObjectEquals("{a:{type:'a1'},b:{type:'b1'},c:{type:'c1'}}", t.getHeaders());
}
@@ -142,11 +142,11 @@ public class ResponseInfoTest {
@Test
public void testSetExamples() {
ResponseInfo t = new ResponseInfo();
-
+
t.setExamples(new AMap<String,Object>().append("foo","bar").append("baz",new AList<String>().append("qux")));
assertObjectEquals("{foo:'bar',baz:['qux']}", t.getExamples());
assertInstanceOf(Map.class, t.getExamples());
-
+
t.setExamples(new AMap<String,Object>());
assertObjectEquals("{}", t.getExamples());
assertInstanceOf(Map.class, t.getExamples());
@@ -161,11 +161,11 @@ public class ResponseInfoTest {
@Test
public void testAddExamples() {
ResponseInfo t = new ResponseInfo();
-
+
t.addExamples(new AMap<String,Object>().append("foo","bar").append("baz",new AList<String>().append("qux")));
assertObjectEquals("{foo:'bar',baz:['qux']}", t.getExamples());
assertInstanceOf(Map.class, t.getExamples());
-
+
t.addExamples(new AMap<String,Object>());
assertObjectEquals("{foo:'bar',baz:['qux']}", t.getExamples());
assertInstanceOf(Map.class, t.getExamples());
@@ -185,7 +185,7 @@ public class ResponseInfoTest {
t.example("text/a", "a");
t.example("text/b", null);
t.example(null, "c");
-
+
assertObjectEquals("{'text/a':'a','text/b':null,null:'c'}", t.getExamples());
}
@@ -195,12 +195,12 @@ public class ResponseInfoTest {
@Test
public void testExamples() {
ResponseInfo t = new ResponseInfo();
-
+
t.examples(new AMap<String,Object>().append("1",new AList<String>().append("a")));
t.examples("{2:{c1:'c2'}}");
t.examples("{}");
t.examples((Object)null);
-
+
assertObjectEquals("{'1':['a'],'2':{c1:'c2'}}", t.getExamples());
}
@@ -210,23 +210,23 @@ public class ResponseInfoTest {
@Test
public void testSet() throws Exception {
ResponseInfo t = new ResponseInfo();
-
+
t
.set("description", "a")
.set("examples", new AMap<String,Object>().append("foo","bar").append("baz",new AList<String>().append("qux")))
.set("headers", new AMap<String,HeaderInfo>().append("a", headerInfo("a1")))
.set("schema", schemaInfo().type("d"))
.set("$ref", "ref");
-
+
assertObjectEquals("{description:'a',schema:{type:'d'},headers:{a:{type:'a1'}},examples:{foo:'bar',baz:['qux']},'$ref':'ref'}", t);
-
+
t
.set("description", "a")
.set("examples", "{foo:'bar',baz:['qux']}")
.set("headers", "{a:{type:'a1'}}")
.set("schema", "{type:'d'}")
.set("$ref", "ref");
-
+
assertObjectEquals("{description:'a',schema:{type:'d'},headers:{a:{type:'a1'}},examples:{foo:'bar',baz:['qux']},'$ref':'ref'}", t);
t
@@ -235,27 +235,27 @@ public class ResponseInfoTest {
.set("headers", new StringBuilder("{a:{type:'a1'}}"))
.set("schema", new StringBuilder("{type:'d'}"))
.set("$ref", new StringBuilder("ref"));
-
+
assertObjectEquals("{description:'a',schema:{type:'d'},headers:{a:{type:'a1'}},examples:{foo:'bar',baz:['qux']},'$ref':'ref'}", t);
-
+
assertEquals("a", t.get("description", String.class));
assertEquals("{foo:'bar',baz:['qux']}", t.get("examples", String.class));
assertEquals("{a:{type:'a1'}}", t.get("headers", String.class));
assertEquals("{type:'d'}", t.get("schema", String.class));
assertEquals("ref", t.get("$ref", String.class));
-
+
assertInstanceOf(String.class, t.get("description", Object.class));
assertInstanceOf(Map.class, t.get("examples", Object.class));
assertInstanceOf(Map.class, t.get("headers", Object.class));
assertInstanceOf(HeaderInfo.class, t.get("headers", Map.class).values().iterator().next());
assertInstanceOf(SchemaInfo.class, t.get("schema", Object.class));
assertInstanceOf(StringBuilder.class, t.get("$ref", Object.class));
-
+
t.set("null", null).set(null, "null");
assertNull(t.get("null", Object.class));
assertNull(t.get(null, Object.class));
assertNull(t.get("foo", Object.class));
-
+
String s = "{description:'a',schema:{type:'d'},headers:{a:{type:'a1'}},examples:{foo:'bar',baz:['qux']},'$ref':'ref'}";
assertObjectEquals(s, JsonParser.DEFAULT.parse(s, ResponseInfo.class));
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/SchemaInfoTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/SchemaInfoTest.java
index da1a0c5..308a964 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/SchemaInfoTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/SchemaInfoTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -33,14 +33,14 @@ public class SchemaInfoTest {
@Test
public void testFormat() {
SchemaInfo t = new SchemaInfo();
-
+
t.format("foo");
assertEquals("foo", t.getFormat());
-
+
t.format(new StringBuilder("foo"));
assertEquals("foo", t.getFormat());
assertInstanceOf(String.class, t.getFormat());
-
+
t.format(null);
assertNull(t.getFormat());
}
@@ -51,14 +51,14 @@ public class SchemaInfoTest {
@Test
public void testTitle() {
SchemaInfo t = new SchemaInfo();
-
+
t.title("foo");
assertEquals("foo", t.getTitle());
-
+
t.title(new StringBuilder("foo"));
assertEquals("foo", t.getTitle());
assertInstanceOf(String.class, t.getTitle());
-
+
t.title(null);
assertNull(t.getTitle());
}
@@ -69,14 +69,14 @@ public class SchemaInfoTest {
@Test
public void testDescription() {
SchemaInfo t = new SchemaInfo();
-
+
t.description("foo");
assertEquals("foo", t.getDescription());
-
+
t.description(new StringBuilder("foo"));
assertEquals("foo", t.getDescription());
assertInstanceOf(String.class, t.getDescription());
-
+
t.description(null);
assertNull(t.getDescription());
}
@@ -87,14 +87,14 @@ public class SchemaInfoTest {
@Test
public void test_default() {
SchemaInfo t = new SchemaInfo();
-
+
t._default("foo");
assertEquals("foo", t.getDefault());
-
+
t._default(new StringBuilder("foo"));
assertEquals("foo", t.getDefault().toString());
assertInstanceOf(StringBuilder.class, t.getDefault());
-
+
t._default(null);
assertNull(t.getDefault());
}
@@ -105,11 +105,11 @@ public class SchemaInfoTest {
@Test
public void testMultipleOf() {
SchemaInfo t = new SchemaInfo();
-
+
t.multipleOf(123);
assertEquals(123, t.getMultipleOf());
assertInstanceOf(Integer.class, t.getMultipleOf());
-
+
t.multipleOf(123f);
assertEquals(123f, t.getMultipleOf());
assertInstanceOf(Float.class, t.getMultipleOf());
@@ -121,7 +121,7 @@ public class SchemaInfoTest {
t.multipleOf(new StringBuilder("123"));
assertEquals(123, t.getMultipleOf());
assertInstanceOf(Integer.class, t.getMultipleOf());
-
+
t.multipleOf(null);
assertNull(t.getMultipleOf());
}
@@ -132,11 +132,11 @@ public class SchemaInfoTest {
@Test
public void testMaximum() {
SchemaInfo t = new SchemaInfo();
-
+
t.maximum(123);
assertEquals(123, t.getMaximum());
assertInstanceOf(Integer.class, t.getMaximum());
-
+
t.maximum(123f);
assertEquals(123f, t.getMaximum());
assertInstanceOf(Float.class, t.getMaximum());
@@ -148,7 +148,7 @@ public class SchemaInfoTest {
t.maximum(new StringBuilder("123"));
assertEquals(123, t.getMaximum());
assertInstanceOf(Integer.class, t.getMaximum());
-
+
t.maximum(null);
assertNull(t.getMaximum());
}
@@ -159,11 +159,11 @@ public class SchemaInfoTest {
@Test
public void testExclusiveMaximum() {
SchemaInfo t = new SchemaInfo();
-
+
t.exclusiveMaximum(true);
assertEquals(true, t.getExclusiveMaximum());
assertInstanceOf(Boolean.class, t.getExclusiveMaximum());
-
+
t.exclusiveMaximum("true");
assertEquals(true, t.getExclusiveMaximum());
assertInstanceOf(Boolean.class, t.getExclusiveMaximum());
@@ -171,7 +171,7 @@ public class SchemaInfoTest {
t.exclusiveMaximum(new StringBuilder("true"));
assertEquals(true, t.getExclusiveMaximum());
assertInstanceOf(Boolean.class, t.getExclusiveMaximum());
-
+
t.exclusiveMaximum(null);
assertNull(t.getExclusiveMaximum());
}
@@ -182,11 +182,11 @@ public class SchemaInfoTest {
@Test
public void testMinimum() {
SchemaInfo t = new SchemaInfo();
-
+
t.minimum(123);
assertEquals(123, t.getMinimum());
assertInstanceOf(Integer.class, t.getMinimum());
-
+
t.minimum(123f);
assertEquals(123f, t.getMinimum());
assertInstanceOf(Float.class, t.getMinimum());
@@ -198,7 +198,7 @@ public class SchemaInfoTest {
t.minimum(new StringBuilder("123"));
assertEquals(123, t.getMinimum());
assertInstanceOf(Integer.class, t.getMinimum());
-
+
t.minimum(null);
assertNull(t.getMinimum());
}
@@ -209,11 +209,11 @@ public class SchemaInfoTest {
@Test
public void testExclusiveMinimum() {
SchemaInfo t = new SchemaInfo();
-
+
t.exclusiveMinimum(true);
assertEquals(true, t.getExclusiveMinimum());
assertInstanceOf(Boolean.class, t.getExclusiveMinimum());
-
+
t.exclusiveMinimum("true");
assertEquals(true, t.getExclusiveMinimum());
assertInstanceOf(Boolean.class, t.getExclusiveMinimum());
@@ -221,7 +221,7 @@ public class SchemaInfoTest {
t.exclusiveMinimum(new StringBuilder("true"));
assertEquals(true, t.getExclusiveMinimum());
assertInstanceOf(Boolean.class, t.getExclusiveMinimum());
-
+
t.exclusiveMinimum(null);
assertNull(t.getExclusiveMinimum());
}
@@ -232,11 +232,11 @@ public class SchemaInfoTest {
@Test
public void testMaxLength() {
SchemaInfo t = new SchemaInfo();
-
+
t.maxLength(123);
assertEquals(123, t.getMaxLength().intValue());
assertInstanceOf(Integer.class, t.getMaxLength());
-
+
t.maxLength(123f);
assertEquals(123, t.getMaxLength().intValue());
assertInstanceOf(Integer.class, t.getMaxLength());
@@ -248,7 +248,7 @@ public class SchemaInfoTest {
t.maxLength(new StringBuilder("123"));
assertEquals(123, t.getMaxLength().intValue());
assertInstanceOf(Integer.class, t.getMaxLength());
-
+
t.maxLength(null);
assertNull(t.getMaxLength());
}
@@ -259,11 +259,11 @@ public class SchemaInfoTest {
@Test
public void testMinLength() {
SchemaInfo t = new SchemaInfo();
-
+
t.minLength(123);
assertEquals(123, t.getMinLength().intValue());
assertInstanceOf(Integer.class, t.getMinLength());
-
+
t.minLength(123f);
assertEquals(123, t.getMinLength().intValue());
assertInstanceOf(Integer.class, t.getMinLength());
@@ -275,7 +275,7 @@ public class SchemaInfoTest {
t.minLength(new StringBuilder("123"));
assertEquals(123, t.getMinLength().intValue());
assertInstanceOf(Integer.class, t.getMinLength());
-
+
t.minLength(null);
assertNull(t.getMinLength());
}
@@ -286,14 +286,14 @@ public class SchemaInfoTest {
@Test
public void testPattern() {
SchemaInfo t = new SchemaInfo();
-
+
t.pattern("foo");
assertEquals("foo", t.getPattern());
-
+
t.pattern(new StringBuilder("foo"));
assertEquals("foo", t.getPattern());
assertInstanceOf(String.class, t.getPattern());
-
+
t.pattern(null);
assertNull(t.getPattern());
}
@@ -304,11 +304,11 @@ public class SchemaInfoTest {
@Test
public void testMaxItems() {
SchemaInfo t = new SchemaInfo();
-
+
t.maxItems(123);
assertEquals(123, t.getMaxItems().intValue());
assertInstanceOf(Integer.class, t.getMaxItems());
-
+
t.maxItems(123f);
assertEquals(123, t.getMaxItems().intValue());
assertInstanceOf(Integer.class, t.getMaxItems());
@@ -320,7 +320,7 @@ public class SchemaInfoTest {
t.maxItems(new StringBuilder("123"));
assertEquals(123, t.getMaxItems().intValue());
assertInstanceOf(Integer.class, t.getMaxItems());
-
+
t.maxItems(null);
assertNull(t.getMaxItems());
}
@@ -331,11 +331,11 @@ public class SchemaInfoTest {
@Test
public void testMinItems() {
SchemaInfo t = new SchemaInfo();
-
+
t.minItems(123);
assertEquals(123, t.getMinItems().intValue());
assertInstanceOf(Integer.class, t.getMinItems());
-
+
t.minItems(123f);
assertEquals(123, t.getMinItems().intValue());
assertInstanceOf(Integer.class, t.getMinItems());
@@ -347,7 +347,7 @@ public class SchemaInfoTest {
t.minItems(new StringBuilder("123"));
assertEquals(123, t.getMinItems().intValue());
assertInstanceOf(Integer.class, t.getMinItems());
-
+
t.minItems(null);
assertNull(t.getMinItems());
}
@@ -358,11 +358,11 @@ public class SchemaInfoTest {
@Test
public void testUniqueItems() {
SchemaInfo t = new SchemaInfo();
-
+
t.uniqueItems(true);
assertEquals(true, t.getUniqueItems());
assertInstanceOf(Boolean.class, t.getUniqueItems());
-
+
t.uniqueItems("true");
assertEquals(true, t.getUniqueItems());
assertInstanceOf(Boolean.class, t.getUniqueItems());
@@ -370,7 +370,7 @@ public class SchemaInfoTest {
t.uniqueItems(new StringBuilder("true"));
assertEquals(true, t.getUniqueItems());
assertInstanceOf(Boolean.class, t.getUniqueItems());
-
+
t.uniqueItems(null);
assertNull(t.getUniqueItems());
}
@@ -381,11 +381,11 @@ public class SchemaInfoTest {
@Test
public void testMaxProperties() {
SchemaInfo t = new SchemaInfo();
-
+
t.maxProperties(123);
assertEquals(123, t.getMaxProperties().intValue());
assertInstanceOf(Integer.class, t.getMaxProperties());
-
+
t.maxProperties(123f);
assertEquals(123, t.getMaxProperties().intValue());
assertInstanceOf(Integer.class, t.getMaxProperties());
@@ -397,7 +397,7 @@ public class SchemaInfoTest {
t.maxProperties(new StringBuilder("123"));
assertEquals(123, t.getMaxProperties().intValue());
assertInstanceOf(Integer.class, t.getMaxProperties());
-
+
t.maxProperties(null);
assertNull(t.getMaxProperties());
}
@@ -408,11 +408,11 @@ public class SchemaInfoTest {
@Test
public void testMinProperties() {
SchemaInfo t = new SchemaInfo();
-
+
t.minProperties(123);
assertEquals(123, t.getMinProperties().intValue());
assertInstanceOf(Integer.class, t.getMinProperties());
-
+
t.minProperties(123f);
assertEquals(123, t.getMinProperties().intValue());
assertInstanceOf(Integer.class, t.getMinProperties());
@@ -424,7 +424,7 @@ public class SchemaInfoTest {
t.minProperties(new StringBuilder("123"));
assertEquals(123, t.getMinProperties().intValue());
assertInstanceOf(Integer.class, t.getMinProperties());
-
+
t.minProperties(null);
assertNull(t.getMinProperties());
}
@@ -435,11 +435,11 @@ public class SchemaInfoTest {
@Test
public void testRequired() {
SchemaInfo t = new SchemaInfo();
-
+
t.required("['x']");
assertEquals("[x]", t.getRequired().toString());
assertInstanceOf(List.class, t.getRequired());
-
+
t.required("['x']");
assertEquals("[x, x]", t.getRequired().toString());
assertInstanceOf(List.class, t.getRequired());
@@ -447,7 +447,7 @@ public class SchemaInfoTest {
t.required(new StringBuilder("['x']"));
assertEquals("[x, x, x]", t.getRequired().toString());
assertInstanceOf(List.class, t.getRequired());
-
+
t.setRequired(null);
assertNull(t.getRequired());
}
@@ -458,12 +458,12 @@ public class SchemaInfoTest {
@Test
public void testSetEnum() {
SchemaInfo t = new SchemaInfo();
-
- t.setEnum(new ASet<Object>().appendAll("foo","bar"));
+
+ t.setEnum(new ASet<>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
-
- t.setEnum(new ASet<Object>());
+
+ t.setEnum(new ASet<>());
assertObjectEquals("[]", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
@@ -477,12 +477,12 @@ public class SchemaInfoTest {
@Test
public void testAddEnum() {
SchemaInfo t = new SchemaInfo();
-
- t.addEnum(new ASet<Object>().appendAll("foo","bar"));
+
+ t.addEnum(new ASet<>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
-
- t.addEnum(new ASet<Object>().appendAll("baz"));
+
+ t.addEnum(new ASet<>().appendAll("baz"));
assertObjectEquals("['foo','bar','baz']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
@@ -497,19 +497,19 @@ public class SchemaInfoTest {
@Test
public void test_enum() {
SchemaInfo t = new SchemaInfo();
-
- t._enum(new ASet<Object>().appendAll("foo","bar"));
+
+ t._enum(new ASet<>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
-
- t._enum(new ASet<Object>().appendAll("baz"));
+
+ t._enum(new ASet<>().appendAll("baz"));
assertObjectEquals("['foo','bar','baz']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
t._enum((Object[])null);
assertObjectEquals("['foo','bar','baz']", t.getEnum());
assertInstanceOf(List.class, t.getEnum());
-
+
t.setEnum(null);
t._enum("foo")._enum(new StringBuilder("bar"))._enum("['baz','qux']")._enum((Object)new String[]{"quux"});
assertObjectEquals("['foo','bar','baz','qux','quux']", t.getEnum());
@@ -522,14 +522,14 @@ public class SchemaInfoTest {
@Test
public void testType() {
SchemaInfo t = new SchemaInfo();
-
+
t.type("foo");
assertEquals("foo", t.getType());
-
+
t.type(new StringBuilder("foo"));
assertEquals("foo", t.getType());
assertInstanceOf(String.class, t.getType());
-
+
t.type(null);
assertNull(t.getType());
}
@@ -540,10 +540,10 @@ public class SchemaInfoTest {
@Test
public void testItems() {
SchemaInfo t = new SchemaInfo();
-
+
t.items(items("foo"));
assertObjectEquals("{type:'foo'}", t.getItems());
-
+
t.items("{type:'foo'}");
assertObjectEquals("{type:'foo'}", t.getItems());
assertInstanceOf(Items.class, t.getItems());
@@ -558,12 +558,12 @@ public class SchemaInfoTest {
@Test
public void testSetAllOf() {
SchemaInfo t = new SchemaInfo();
-
- t.setAllOf(new ASet<Object>().appendAll("foo","bar"));
+
+ t.setAllOf(new ASet<>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getAllOf());
assertInstanceOf(List.class, t.getAllOf());
-
- t.setAllOf(new ASet<Object>());
+
+ t.setAllOf(new ASet<>());
assertObjectEquals("[]", t.getAllOf());
assertInstanceOf(List.class, t.getAllOf());
@@ -577,12 +577,12 @@ public class SchemaInfoTest {
@Test
public void testAddAllOf() {
SchemaInfo t = new SchemaInfo();
-
- t.addAllOf(new ASet<Object>().appendAll("foo","bar"));
+
+ t.addAllOf(new ASet<>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getAllOf());
assertInstanceOf(List.class, t.getAllOf());
-
- t.addAllOf(new ASet<Object>());
+
+ t.addAllOf(new ASet<>());
assertObjectEquals("['foo','bar']", t.getAllOf());
assertInstanceOf(List.class, t.getAllOf());
@@ -597,9 +597,9 @@ public class SchemaInfoTest {
@Test
public void testAllOf() {
SchemaInfo t = new SchemaInfo();
-
+
t.allOf(new ASet<String>().appendAll("a"));
- t.allOf(new ASet<Object>().appendAll(new StringBuilder("b")));
+ t.allOf(new ASet<>().appendAll(new StringBuilder("b")));
t.allOf((Object)new String[] {"c"});
t.allOf((Object)new Object[] {new StringBuilder("d")});
t.allOf("e");
@@ -615,11 +615,11 @@ public class SchemaInfoTest {
@Test
public void testSetProperties() {
SchemaInfo t = new SchemaInfo();
-
+
t.setProperties(new AMap<String,SchemaInfo>().append("foo",new SchemaInfo().type("foo")));
assertObjectEquals("{foo:{type:'foo'}}", t.getProperties());
assertInstanceOf(Map.class, t.getProperties());
-
+
t.setProperties(new AMap<String,SchemaInfo>());
assertObjectEquals("{}", t.getProperties());
assertInstanceOf(Map.class, t.getProperties());
@@ -634,11 +634,11 @@ public class SchemaInfoTest {
@Test
public void testAddProperties() {
SchemaInfo t = new SchemaInfo();
-
+
t.addProperties(new AMap<String,SchemaInfo>().append("foo", new SchemaInfo().type("foo")));
assertObjectEquals("{foo:{type:'foo'}}", t.getProperties());
assertInstanceOf(Map.class, t.getProperties());
-
+
t.addProperties(new AMap<String,SchemaInfo>());
assertObjectEquals("{foo:{type:'foo'}}", t.getProperties());
assertInstanceOf(Map.class, t.getProperties());
@@ -654,13 +654,13 @@ public class SchemaInfoTest {
@Test
public void testProperties() {
SchemaInfo t = new SchemaInfo();
-
+
t.properties(new AMap<String,Map<String,Object>>().append("a", new AMap<String,Object>().append("type", "foo")));
t.properties(new AMap<String,String>().append("b", "{type:'bar'}"));
t.properties("{c:{type:'baz'}}");
t.properties("{}");
t.properties((Object[])null);
-
+
assertObjectEquals("{a:{type:'foo'},b:{type:'bar'},c:{type:'baz'}}", t.getProperties());
assertInstanceOf(SchemaInfo.class, t.getProperties().get("a"));
assertInstanceOf(SchemaInfo.class, t.getProperties().get("b"));
@@ -673,11 +673,11 @@ public class SchemaInfoTest {
@Test
public void testSetAdditionalProperties() {
SchemaInfo t = new SchemaInfo();
-
+
t.setAdditionalProperties(new SchemaInfo().type("foo"));
assertObjectEquals("{type:'foo'}", t.getAdditionalProperties());
assertInstanceOf(SchemaInfo.class, t.getAdditionalProperties());
-
+
t.setAdditionalProperties(new SchemaInfo());
assertObjectEquals("{}", t.getAdditionalProperties());
assertInstanceOf(SchemaInfo.class, t.getAdditionalProperties());
@@ -694,7 +694,7 @@ public class SchemaInfoTest {
SchemaInfo t = new SchemaInfo();
t.additionalProperties(new AMap<String,Object>().append("type","foo"));
-
+
assertObjectEquals("{type:'foo'}", t.getAdditionalProperties());
assertInstanceOf(SchemaInfo.class, t.getAdditionalProperties());
}
@@ -705,14 +705,14 @@ public class SchemaInfoTest {
@Test
public void testDiscriminator() {
SchemaInfo t = new SchemaInfo();
-
+
t.discriminator("foo");
assertEquals("foo", t.getDiscriminator());
-
+
t.discriminator(new StringBuilder("foo"));
assertEquals("foo", t.getDiscriminator());
assertInstanceOf(String.class, t.getDiscriminator());
-
+
t.discriminator(null);
assertNull(t.getDiscriminator());
}
@@ -723,11 +723,11 @@ public class SchemaInfoTest {
@Test
public void testReadOnly() {
SchemaInfo t = new SchemaInfo();
-
+
t.readOnly(true);
assertEquals(true, t.getReadOnly());
assertInstanceOf(Boolean.class, t.getReadOnly());
-
+
t.readOnly("true");
assertEquals(true, t.getReadOnly());
assertInstanceOf(Boolean.class, t.getReadOnly());
@@ -735,7 +735,7 @@ public class SchemaInfoTest {
t.readOnly(new StringBuilder("true"));
assertEquals(true, t.getReadOnly());
assertInstanceOf(Boolean.class, t.getReadOnly());
-
+
t.readOnly(null);
assertNull(t.getReadOnly());
}
@@ -746,10 +746,10 @@ public class SchemaInfoTest {
@Test
public void testXml() {
SchemaInfo t = new SchemaInfo();
-
+
t.xml(xml().name("foo"));
assertObjectEquals("{name:'foo'}", t.getXml());
-
+
t.xml("{name:'foo'}");
assertObjectEquals("{name:'foo'}", t.getXml());
assertInstanceOf(Xml.class, t.getXml());
@@ -764,10 +764,10 @@ public class SchemaInfoTest {
@Test
public void testExternalDocs() {
SchemaInfo t = new SchemaInfo();
-
+
t.externalDocs(externalDocumentation("foo"));
assertObjectEquals("{url:'foo'}", t.getExternalDocs());
-
+
t.externalDocs("{url:'foo'}");
assertObjectEquals("{url:'foo'}", t.getExternalDocs());
assertInstanceOf(ExternalDocumentation.class, t.getExternalDocs());
@@ -782,10 +782,10 @@ public class SchemaInfoTest {
@Test
public void testExample() {
SchemaInfo t = new SchemaInfo();
-
+
t.example("foo");
assertEquals("foo", t.getExample());
-
+
t.example(123);
assertEquals(123, t.getExample());
@@ -799,10 +799,10 @@ public class SchemaInfoTest {
@Test
public void testSet() throws Exception {
SchemaInfo t = new SchemaInfo();
-
+
t
.set("default", "a")
- .set("enum", new ASet<Object>().appendAll("b"))
+ .set("enum", new ASet<>().appendAll("b"))
.set("additionalProperties", new AMap<String,Object>().append("c",new AList<String>().append("c1")))
.set("allOf", new ASet<String>().appendAll("d"))
.set("description", "e")
@@ -831,9 +831,9 @@ public class SchemaInfoTest {
.set("uniqueItems", true)
.set("xml", xml().name("o"))
.set("$ref", "ref");
-
+
assertObjectEquals("{format:'i',title:'m',description:'e','default':'a',multipleOf:123.0,maximum:123.0,exclusiveMaximum:true,minimum:123.0,exclusiveMinimum:true,maxLength:123,minLength:123,pattern:'k',maxItems:123,minItems:123,uniqueItems:true,maxProperties:123,minProperties:123,required:['x'],'enum':['b'],type:'n',items:{type:'j'},allOf:['d'],properties:{l:{l1:1}},additionalProperties:{c:['c1']},discriminator:'f',readOnly:true,xml:{name:'o'},externalDocs:{url:'h'},example:'g','$ref':' [...]
-
+
t
.set("default", "a")
.set("enum", "['b']")
@@ -865,9 +865,9 @@ public class SchemaInfoTest {
.set("uniqueItems", "true")
.set("xml", "{name:'o'}")
.set("$ref", "ref");
-
+
assertObjectEquals("{format:'i',title:'m',description:'e','default':'a',multipleOf:123.0,maximum:123.0,exclusiveMaximum:true,minimum:123.0,exclusiveMinimum:true,maxLength:123,minLength:123,pattern:'k',maxItems:123,minItems:123,uniqueItems:true,maxProperties:123,minProperties:123,required:['x'],'enum':['b'],type:'n',items:{type:'j'},allOf:['d'],properties:{l:{l1:1}},additionalProperties:{c:['c1']},discriminator:'f',readOnly:true,xml:{name:'o'},externalDocs:{url:'h'},example:'g','$ref':' [...]
-
+
t
.set("default", new StringBuilder("a"))
.set("enum", new StringBuilder("['b']"))
@@ -899,7 +899,7 @@ public class SchemaInfoTest {
.set("uniqueItems", new StringBuilder("true"))
.set("xml", new StringBuilder("{name:'o'}"))
.set("$ref", new StringBuilder("ref"));
-
+
assertObjectEquals("{format:'i',title:'m',description:'e','default':'a',multipleOf:123.0,maximum:123.0,exclusiveMaximum:true,minimum:123.0,exclusiveMinimum:true,maxLength:123,minLength:123,pattern:'k',maxItems:123,minItems:123,uniqueItems:true,maxProperties:123,minProperties:123,required:['x'],'enum':['b'],type:'n',items:{type:'j'},allOf:['d'],properties:{l:{l1:1}},additionalProperties:{c:['c1']},discriminator:'f',readOnly:true,xml:{name:'o'},externalDocs:{url:'h'},example:'g','$ref':' [...]
assertEquals("a", t.get("default", String.class));
@@ -932,7 +932,7 @@ public class SchemaInfoTest {
assertEquals("true", t.get("uniqueItems", String.class));
assertEquals("{name:'o'}", t.get("xml", String.class));
assertEquals("ref", t.get("$ref", String.class));
-
+
assertInstanceOf(StringBuilder.class, t.get("default", Object.class));
assertInstanceOf(List.class, t.get("enum", Object.class));
assertInstanceOf(SchemaInfo.class, t.get("additionalProperties", Object.class));
@@ -963,12 +963,12 @@ public class SchemaInfoTest {
assertInstanceOf(Boolean.class, t.get("uniqueItems", Object.class));
assertInstanceOf(Xml.class, t.get("xml", Object.class));
assertInstanceOf(String.class, t.get("$ref", Object.class));
-
+
t.set("null", null).set(null, "null");
assertNull(t.get("null", Object.class));
assertNull(t.get(null, Object.class));
assertNull(t.get("foo", Object.class));
-
+
String s = "{format:'i',title:'m',description:'e','default':'a',multipleOf:123.0,maximum:123.0,exclusiveMaximum:true,minimum:123.0,exclusiveMinimum:true,maxLength:123,minLength:123,pattern:'k',maxItems:123,minItems:123,uniqueItems:true,maxProperties:123,minProperties:123,required:['x'],'enum':['b'],type:'n',items:{type:'j'},allOf:['d'],properties:{l:{l1:1}},additionalProperties:{c:['c1']},discriminator:'f',readOnly:true,xml:{name:'o'},externalDocs:{url:'h'},example:'g','$ref':'ref'}";
assertObjectEquals(s, JsonParser.DEFAULT.parse(s, SchemaInfo.class));
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/SecuritySchemeTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/SecuritySchemeTest.java
index ff4d328..e7974eb 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/SecuritySchemeTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/SecuritySchemeTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -32,14 +32,14 @@ public class SecuritySchemeTest {
@Test
public void testType() {
SecurityScheme t = new SecurityScheme();
-
+
t.type("foo");
assertEquals("foo", t.getType());
-
+
t.type(new StringBuilder("foo"));
assertEquals("foo", t.getType());
assertInstanceOf(String.class, t.getType());
-
+
t.type(null);
assertNull(t.getType());
}
@@ -50,14 +50,14 @@ public class SecuritySchemeTest {
@Test
public void testDescription() {
SecurityScheme t = new SecurityScheme();
-
+
t.description("foo");
assertEquals("foo", t.getDescription());
-
+
t.description(new StringBuilder("foo"));
assertEquals("foo", t.getDescription());
assertInstanceOf(String.class, t.getDescription());
-
+
t.description(null);
assertNull(t.getDescription());
}
@@ -68,14 +68,14 @@ public class SecuritySchemeTest {
@Test
public void testName() {
SecurityScheme t = new SecurityScheme();
-
+
t.name("foo");
assertEquals("foo", t.getName());
-
+
t.name(new StringBuilder("foo"));
assertEquals("foo", t.getName());
assertInstanceOf(String.class, t.getName());
-
+
t.name(null);
assertNull(t.getName());
}
@@ -86,14 +86,14 @@ public class SecuritySchemeTest {
@Test
public void testIn() {
SecurityScheme t = new SecurityScheme();
-
+
t.in("foo");
assertEquals("foo", t.getIn());
-
+
t.in(new StringBuilder("foo"));
assertEquals("foo", t.getIn());
assertInstanceOf(String.class, t.getIn());
-
+
t.in(null);
assertNull(t.getIn());
}
@@ -104,14 +104,14 @@ public class SecuritySchemeTest {
@Test
public void testFlow() {
SecurityScheme t = new SecurityScheme();
-
+
t.flow("foo");
assertEquals("foo", t.getFlow());
-
+
t.flow(new StringBuilder("foo"));
assertEquals("foo", t.getFlow());
assertInstanceOf(String.class, t.getFlow());
-
+
t.flow(null);
assertNull(t.getFlow());
}
@@ -122,14 +122,14 @@ public class SecuritySchemeTest {
@Test
public void testAuthorizationUrl() {
SecurityScheme t = new SecurityScheme();
-
+
t.authorizationUrl("foo");
assertEquals("foo", t.getAuthorizationUrl());
-
+
t.authorizationUrl(new StringBuilder("foo"));
assertEquals("foo", t.getAuthorizationUrl());
assertInstanceOf(String.class, t.getAuthorizationUrl());
-
+
t.authorizationUrl(null);
assertNull(t.getAuthorizationUrl());
}
@@ -140,14 +140,14 @@ public class SecuritySchemeTest {
@Test
public void testTokenUrl() {
SecurityScheme t = new SecurityScheme();
-
+
t.tokenUrl("foo");
assertEquals("foo", t.getTokenUrl());
-
+
t.tokenUrl(new StringBuilder("foo"));
assertEquals("foo", t.getTokenUrl());
assertInstanceOf(String.class, t.getTokenUrl());
-
+
t.tokenUrl(null);
assertNull(t.getTokenUrl());
}
@@ -158,11 +158,11 @@ public class SecuritySchemeTest {
@Test
public void testSetScopes() {
SecurityScheme t = new SecurityScheme();
-
+
t.setScopes(new AMap<String,String>().append("foo","bar"));
assertObjectEquals("{foo:'bar'}", t.getScopes());
assertInstanceOf(Map.class, t.getScopes());
-
+
t.setScopes(new AMap<String,String>());
assertObjectEquals("{}", t.getScopes());
assertInstanceOf(Map.class, t.getScopes());
@@ -177,11 +177,11 @@ public class SecuritySchemeTest {
@Test
public void testAddScopes() {
SecurityScheme t = new SecurityScheme();
-
+
t.addScopes(new AMap<String,String>().append("foo","bar"));
assertObjectEquals("{foo:'bar'}", t.getScopes());
assertInstanceOf(Map.class, t.getScopes());
-
+
t.addScopes(new AMap<String,String>());
assertObjectEquals("{foo:'bar'}", t.getScopes());
assertInstanceOf(Map.class, t.getScopes());
@@ -197,12 +197,12 @@ public class SecuritySchemeTest {
@Test
public void testScopes() {
SecurityScheme t = new SecurityScheme();
-
+
t.scopes(new AMap<String,String>().append("a", "a1"));
t.scopes("{b:'b1'}");
t.scopes("{}");
t.scopes((Object[])null);
-
+
assertObjectEquals("{a:'a1',b:'b1'}", t.getScopes());
}
@@ -212,7 +212,7 @@ public class SecuritySchemeTest {
@Test
public void testSet() throws Exception {
SecurityScheme t = new SecurityScheme();
-
+
t
.set("authorizationUrl", "a")
.set("description", "b")
@@ -223,9 +223,9 @@ public class SecuritySchemeTest {
.set("tokenUrl", "f")
.set("type", "g")
.set("$ref", "ref");
-
+
assertObjectEquals("{type:'g',description:'b',name:'e','in':'d',flow:'c',authorizationUrl:'a',tokenUrl:'f',scopes:{foo:'bar'},'$ref':'ref'}", t);
-
+
t
.set("authorizationUrl", "a")
.set("description", "b")
@@ -236,20 +236,20 @@ public class SecuritySchemeTest {
.set("tokenUrl", "f")
.set("type", "g")
.set("$ref", "ref");
-
+
assertObjectEquals("{type:'g',description:'b',name:'e','in':'d',flow:'c',authorizationUrl:'a',tokenUrl:'f',scopes:{foo:'bar'},'$ref':'ref'}", t);
-
+
t
.set("authorizationUrl", new StringBuilder("a"))
.set("description", new StringBuilder("b"))
.set("flow", new StringBuilder("c"))
.set("in", new StringBuilder("d"))
.set("name", new StringBuilder("e"))
- .set("scopes", new StringBuilder("{foo:'bar'}"))
+ .set("scopes", new StringBuilder("{foo:'bar'}"))
.set("tokenUrl", new StringBuilder("f"))
.set("type", new StringBuilder("g"))
.set("$ref", new StringBuilder("ref"));
-
+
assertObjectEquals("{type:'g',description:'b',name:'e','in':'d',flow:'c',authorizationUrl:'a',tokenUrl:'f',scopes:{foo:'bar'},'$ref':'ref'}", t);
assertEquals("a", t.get("authorizationUrl", String.class));
@@ -261,7 +261,7 @@ public class SecuritySchemeTest {
assertEquals("f", t.get("tokenUrl", String.class));
assertEquals("g", t.get("type", String.class));
assertEquals("ref", t.get("$ref", String.class));
-
+
assertInstanceOf(String.class, t.get("authorizationUrl", Object.class));
assertInstanceOf(String.class, t.get("description", Object.class));
assertInstanceOf(String.class, t.get("flow", Object.class));
@@ -271,12 +271,12 @@ public class SecuritySchemeTest {
assertInstanceOf(String.class, t.get("tokenUrl", Object.class));
assertInstanceOf(String.class, t.get("type", Object.class));
assertInstanceOf(StringBuilder.class, t.get("$ref", Object.class));
-
+
t.set("null", null).set(null, "null");
assertNull(t.get("null", Object.class));
assertNull(t.get(null, Object.class));
assertNull(t.get("foo", Object.class));
-
+
String s = "{type:'g',description:'b',name:'e','in':'d',flow:'c',authorizationUrl:'a',tokenUrl:'f',scopes:{foo:'bar'},'$ref':'ref'}";
assertObjectEquals(s, JsonParser.DEFAULT.parse(s, SecurityScheme.class));
}
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/SwaggerBuilderTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/SwaggerBuilderTest.java
index 544b5a3..d2e76a7 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/SwaggerBuilderTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/SwaggerBuilderTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -102,7 +102,7 @@ public class SwaggerBuilderTest {
public void testHeaderInfoStrict() {
HeaderInfo t = headerInfoStrict("string");
assertObjectEquals("{type:'string'}", t);
-
+
try {
headerInfoStrict("foo");
} catch (Exception e) {
@@ -153,7 +153,7 @@ public class SwaggerBuilderTest {
public void testItemsStrict() {
Items t = itemsStrict("string");
assertObjectEquals("{type:'string'}", t);
-
+
try {
itemsStrict("foo");
} catch (Exception e) {
@@ -213,7 +213,7 @@ public class SwaggerBuilderTest {
public void testParameterInfoStrict() {
ParameterInfo t = parameterInfoStrict("query", "bar");
assertObjectEquals("{'in':'query',name:'bar'}", t);
-
+
try {
parameterInfoStrict("foo", "bar");
} catch (Exception e) {
diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/SwaggerTest.java b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/SwaggerTest.java
index 1727a7b..e3fd006 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/SwaggerTest.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/dto/swagger/SwaggerTest.java
@@ -2,7 +2,7 @@
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
-// * with the License. You may obtain a copy of the License at *
+// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
@@ -35,14 +35,14 @@ public class SwaggerTest {
@Test
public void testSwagger() {
Swagger t = new Swagger();
-
+
t.swagger("foo");
assertEquals("foo", t.getSwagger());
-
+
t.swagger(new StringBuilder("foo"));
assertEquals("foo", t.getSwagger());
assertInstanceOf(String.class, t.getSwagger());
-
+
t.swagger(null);
assertNull(t.getSwagger());
}
@@ -53,10 +53,10 @@ public class SwaggerTest {
@Test
public void testInfo() {
Swagger t = new Swagger();
-
+
t.info(info("foo", "bar"));
assertObjectEquals("{title:'foo',version:'bar'}", t.getInfo());
-
+
t.info("{title:'foo',version:'bar'}");
assertObjectEquals("{title:'foo',version:'bar'}", t.getInfo());
assertInstanceOf(Info.class, t.getInfo());
@@ -71,14 +71,14 @@ public class SwaggerTest {
@Test
public void testHost() {
Swagger t = new Swagger();
-
+
t.host("foo");
assertEquals("foo", t.getHost());
-
+
t.host(new StringBuilder("foo"));
assertEquals("foo", t.getHost());
assertInstanceOf(String.class, t.getHost());
-
+
t.host(null);
assertNull(t.getHost());
}
@@ -89,14 +89,14 @@ public class SwaggerTest {
@Test
public void testBasePath() {
Swagger t = new Swagger();
-
+
t.basePath("foo");
assertEquals("foo", t.getBasePath());
-
+
t.basePath(new StringBuilder("foo"));
assertEquals("foo", t.getBasePath());
assertInstanceOf(String.class, t.getBasePath());
-
+
t.basePath(null);
assertNull(t.getBasePath());
}
@@ -107,11 +107,11 @@ public class SwaggerTest {
@Test
public void testSetSchemes() {
Swagger t = new Swagger();
-
+
t.setSchemes(new ASet<String>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getSchemes());
assertInstanceOf(List.class, t.getSchemes());
-
+
t.setSchemes(new ASet<String>());
assertObjectEquals("[]", t.getSchemes());
assertInstanceOf(List.class, t.getSchemes());
@@ -126,11 +126,11 @@ public class SwaggerTest {
@Test
public void testAddSchemes() {
Swagger t = new Swagger();
-
+
t.addSchemes(new ASet<String>().appendAll("foo","bar"));
assertObjectEquals("['foo','bar']", t.getSchemes());
assertInstanceOf(List.class, t.getSchemes());
-
+
t.addSchemes(new ASet<String>());
assertObjectEquals("['foo','bar']", t.getSchemes());
assertInstanceOf(List.class, t.getSchemes());
@@ -146,15 +146,15 @@ public class SwaggerTest {
@Test
public void testSchemes() {
Swagger t = new Swagger();
-
+
t.schemes(new ASet<String>().appendAll("foo"));
- t.schemes(new ASet<Object>().appendAll(new StringBuilder("bar")));
+ t.schemes(new ASet<>().appendAll(new StringBuilder("bar")));
t.schemes((Object)new String[] {"baz"});
t.schemes("['qux']");
t.schemes("quux");
t.schemes("[]");
t.schemes((Object)null);
-
+
assertObjectEquals("['foo','bar','baz','qux','quux']", t.getSchemes());
}
@@ -164,11 +164,11 @@ public class SwaggerTest {
@Test
public void testSetConsumes() {
Swagger t = new Swagger();
-
+
t.setConsumes(new ASet<MediaType>().appendAll(MediaType.forString("text/foo")));
assertObjectEquals("['text/foo']", t.getConsumes());
assertInstanceOf(List.class, t.getConsumes());
-
+
t.setConsumes(new ASet<MediaType>());
assertObjectEquals("[]", t.getConsumes());
assertInstanceOf(List.class, t.getConsumes());
@@ -183,11 +183,11 @@ public class SwaggerTest {
@Test
public void testAddConsumes() {
Swagger t = new Swagger();
-
+
t.addConsumes(new ASet<MediaType>().appendAll(MediaType.forString("text/foo")));
assertObjectEquals("['text/foo']", t.getConsumes());
assertInstanceOf(List.class, t.getConsumes());
-
+
t.addConsumes(new ASet<MediaType>());
assertObjectEquals("['text/foo']", t.getConsumes());
assertInstanceOf(List.class, t.getConsumes());
@@ -203,7 +203,7 @@ public class SwaggerTest {
@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");
@@ -225,11 +225,11 @@ public class SwaggerTest {
@Test
public void testSetProduces() {
Swagger t = new Swagger();
-
+
t.setProduces(new ASet<MediaType>().appendAll(MediaType.forString("text/foo")));
assertObjectEquals("['text/foo']", t.getProduces());
assertInstanceOf(List.class, t.getProduces());
-
+
t.setProduces(new ASet<MediaType>());
assertObjectEquals("[]", t.getProduces());
assertInstanceOf(List.class, t.getProduces());
@@ -244,11 +244,11 @@ public class SwaggerTest {
@Test
public void testAddProduces() {
Swagger t = new Swagger();
-
+
t.addProduces(new ASet<MediaType>().appendAll(MediaType.forString("text/foo")));
assertObjectEquals("['text/foo']", t.getProduces());
assertInstanceOf(List.class, t.getProduces());
-
+
t.addProduces(new ASet<MediaType>());
assertObjectEquals("['text/foo']", t.getProduces());
assertInstanceOf(List.class, t.getProduces());
@@ -286,11 +286,11 @@ public class SwaggerTest {
@Test
public void testSetPaths() {
Swagger t = new Swagger();
-
+
t.setPaths(new AMap<String,OperationMap>().append("foo", new OperationMap().append("bar",operation().summary("baz"))));
assertObjectEquals("{foo:{bar:{summary:'baz'}}}", t.getPaths());
assertInstanceOf(Map.class, t.getPaths());
-
+
t.setPaths(new AMap<String,OperationMap>());
assertObjectEquals("{}", t.getPaths());
assertInstanceOf(Map.class, t.getPaths());
@@ -305,11 +305,11 @@ public class SwaggerTest {
@Test
public void testAddPaths() {
Swagger t = new Swagger();
-
+
t.addPaths(new AMap<String,OperationMap>().append("foo", new OperationMap().append("bar",operation().summary("baz"))));
assertObjectEquals("{foo:{bar:{summary:'baz'}}}", t.getPaths());
assertInstanceOf(Map.class, t.getPaths());
-
+
t.addPaths(new AMap<String,OperationMap>());
assertObjectEquals("{foo:{bar:{summary:'baz'}}}", t.getPaths());
assertInstanceOf(Map.class, t.getPaths());
@@ -325,10 +325,10 @@ public class SwaggerTest {
@Test
public void testPath() {
Swagger t = new Swagger();
-
+
t.path("a", "a1", operation().description("a2"));
t.path("b", null, null);
-
+
assertObjectEquals("{a:{a1:{description:'a2'}},b:{null:null}}", t.getPaths());
}
@@ -338,14 +338,14 @@ public class SwaggerTest {
@Test
public void testPaths() {
Swagger t = new Swagger();
-
+
t.paths(new AMap<String,Map<String,Operation>>().append("a", new AMap<String,Operation>().append("a1", operation().operationId("a2"))));
t.paths(new AMap<String,Map<String,String>>().append("b", new AMap<String,String>().append("b1", "{operationId:'b2'}")));
t.paths(new AMap<String,String>().append("c", "{c1:{operationId:'c2'}}"));
t.paths("{d:{d1:{operationId:'d2'}}}");
t.paths("{}");
t.paths((Object[])null);
-
+
assertObjectEquals("{a:{a1:{operationId:'a2'}},b:{b1:{operationId:'b2'}},c:{c1:{operationId:'c2'}},d:{d1:{operationId:'d2'}}}", t.getPaths());
for (Map<String,Operation> m : t.getPaths().values()) {
for (Operation o : m.values()) {
@@ -360,11 +360,11 @@ public class SwaggerTest {
@Test
public void testSetDefinitions() {
Swagger t = new Swagger();
-
+
t.setDefinitions(new AMap<String,ObjectMap>().append("foo",new ObjectMap().append("type","bar")));
assertObjectEquals("{foo:{type:'bar'}}", t.getDefinitions());
assertInstanceOf(Map.class, t.getDefinitions());
-
+
t.setDefinitions(new AMap<String,ObjectMap>());
assertObjectEquals("{}", t.getDefinitions());
assertInstanceOf(Map.class, t.getDefinitions());
@@ -379,11 +379,11 @@ public class SwaggerTest {
@Test
public void testAddDefinitions() {
Swagger t = new Swagger();
-
+
t.addDefinitions(new AMap<String,ObjectMap>().append("foo", new ObjectMap().append("type", "bar")));
assertObjectEquals("{foo:{type:'bar'}}", t.getDefinitions());
assertInstanceOf(Map.class, t.getDefinitions());
-
+
t.addDefinitions(new AMap<String,ObjectMap>());
assertObjectEquals("{foo:{type:'bar'}}", t.getDefinitions());
assertInstanceOf(Map.class, t.getDefinitions());
@@ -403,7 +403,7 @@ public class SwaggerTest {
t.definition("a", new ObjectMap().append("type","a1"));
t.definition("b", null);
t.definition(null, new ObjectMap().append("type", "c1"));
-
+
assertObjectEquals("{a:{type:'a1'},b:null,null:{type:'c1'}}", t.getDefinitions());
}
@@ -413,13 +413,13 @@ public class SwaggerTest {
@Test
public void testDefinitions() {
Swagger t = new Swagger();
-
+
t.definitions(new AMap<String,SchemaInfo>().append("a", schemaInfo().type("a1")));
t.definitions(new AMap<String,String>().append("b", "{type:'b1'}"));
t.definitions("{c:{type:'c1'}}");
t.definitions("{}");
t.definitions((Object[])null);
-
+
assertObjectEquals("{a:{type:'a1'},b:{type:'b1'},c:{type:'c1'}}", t.getDefinitions());
}
@@ -429,11 +429,11 @@ public class SwaggerTest {
@Test
public void testSetParameters() {
Swagger t = new Swagger();
-
+
t.setParameters(new AMap<String,ParameterInfo>().append("foo",parameterInfo().name("bar")));
assertObjectEquals("{foo:{name:'bar'}}", t.getParameters());
assertInstanceOf(Map.class, t.getParameters());
-
+
t.setParameters(new AMap<String,ParameterInfo>());
assertObjectEquals("{}", t.getParameters());
assertInstanceOf(Map.class, t.getParameters());
@@ -448,11 +448,11 @@ public class SwaggerTest {
@Test
public void testAddParameters() {
Swagger t = new Swagger();
-
+
t.addParameters(new AMap<String,ParameterInfo>().append("foo",parameterInfo().name("bar")));
assertObjectEquals("{foo:{name:'bar'}}", t.getParameters());
assertInstanceOf(Map.class, t.getParameters());
-
+
t.addParameters(new AMap<String,ParameterInfo>());
assertObjectEquals("{foo:{name:'bar'}}", t.getParameters());
assertInstanceOf(Map.class, t.getParameters());
@@ -468,7 +468,7 @@ public class SwaggerTest {
@Test
public void testParameter() {
Swagger t = new Swagger();
-
+
t.parameter("a", parameterInfo().in("a1"));
t.parameter("b", null);
t.parameter(null, parameterInfo().in("c1"));
@@ -482,13 +482,13 @@ public class SwaggerTest {
@Test
public void testParameters() {
Swagger t = new Swagger();
-
+
t.parameters(new AMap<String,ParameterInfo>().append("a", parameterInfo("a1", "a2")));
t.parameters(new AMap<String,String>().append("b", "{in:'b1',name:'b2'}"));
t.parameters("{c:{in:'c1',name:'c2'}}");
t.parameters("{}");
t.parameters((Object[])null);
-
+
assertObjectEquals("{a:{'in':'a1',name:'a2'},b:{'in':'b1',name:'b2'},c:{'in':'c1',name:'c2'}}", t.getParameters());
}
@@ -498,11 +498,11 @@ public class SwaggerTest {
@Test
public void testSetResponses() {
Swagger t = new Swagger();
-
+
t.setResponses(new AMap<String,ResponseInfo>().append("123",responseInfo("bar")));
assertObjectEquals("{'123':{description:'bar'}}", t.getResponses());
assertInstanceOf(Map.class, t.getResponses());
-
+
t.setResponses(new AMap<String,ResponseInfo>());
assertObjectEquals("{}", t.getResponses());
assertInstanceOf(Map.class, t.getResponses());
@@ -517,11 +517,11 @@ public class SwaggerTest {
@Test
public void testAddResponses() {
Swagger t = new Swagger();
-
+
t.addResponses(new AMap<String,ResponseInfo>().append("123",responseInfo("bar")));
assertObjectEquals("{'123':{description:'bar'}}", t.getResponses());
assertInstanceOf(Map.class, t.getResponses());
-
+
t.addResponses(new AMap<String,ResponseInfo>());
assertObjectEquals("{'123':{description:'bar'}}", t.getResponses());
assertInstanceOf(Map.class, t.getResponses());
@@ -537,7 +537,7 @@ public class SwaggerTest {
@Test
public void testResponse() {
Swagger t = new Swagger();
-
+
t.response("a", responseInfo("a1"));
t.response(null, responseInfo("b1"));
t.response("c", null);
@@ -551,13 +551,13 @@ public class SwaggerTest {
@Test
public void testResponses() {
Swagger t = new Swagger();
-
+
t.responses(new AMap<String,ResponseInfo>().append("a", responseInfo("a1")));
t.responses(new AMap<String,String>().append("b", "{description:'b1'}"));
t.responses("{c:{description:'c1'}}");
t.responses("{}");
t.responses((Object[])null);
-
+
assertObjectEquals("{a:{description:'a1'},b:{description:'b1'},c:{description:'c1'}}", t.getResponses());
for (ResponseInfo ri : t.getResponses().values())
assertInstanceOf(ResponseInfo.class, ri);
@@ -569,11 +569,11 @@ public class SwaggerTest {
@Test
public void testSetSecurityDefinitions() {
Swagger t = new Swagger();
-
+
t.setSecurityDefinitions(new AMap<String,SecurityScheme>().append("foo",securityScheme("bar")));
assertObjectEquals("{foo:{type:'bar'}}", t.getSecurityDefinitions());
assertInstanceOf(Map.class, t.getSecurityDefinitions());
-
+
t.setSecurityDefinitions(new AMap<String,SecurityScheme>());
assertObjectEquals("{}", t.getSecurityDefinitions());
assertInstanceOf(Map.class, t.getSecurityDefinitions());
@@ -588,11 +588,11 @@ public class SwaggerTest {
@Test
public void testAddSecurityDefinitions() {
Swagger t = new Swagger();
-
+
t.addSecurityDefinitions(new AMap<String,SecurityScheme>().append("foo",securityScheme("bar")));
assertObjectEquals("{foo:{type:'bar'}}", t.getSecurityDefinitions());
assertInstanceOf(Map.class, t.getSecurityDefinitions());
-
+
t.addSecurityDefinitions(new AMap<String,SecurityScheme>());
assertObjectEquals("{foo:{type:'bar'}}", t.getSecurityDefinitions());
assertInstanceOf(Map.class, t.getSecurityDefinitions());
@@ -608,7 +608,7 @@ public class SwaggerTest {
@Test
public void testSecurityDefinition() {
Swagger t = new Swagger();
-
+
t.securityDefinition("a", securityScheme("a1"));
t.securityDefinition("b", null);
t.securityDefinition(null, securityScheme("c1"));
@@ -622,13 +622,13 @@ public class SwaggerTest {
@Test
public void testSecurityDefinitions() {
Swagger t = new Swagger();
-
... 7088 lines suppressed ...