From 2c78748c6354f976c8b63360b6f8194fd4362ebb Mon Sep 17 00:00:00 2001 From: Mike Duff Date: Mon, 8 Jul 2013 16:18:27 -0500 Subject: [PATCH] Issue #2173 - Update unit tests for Java 1.7 and SLF4J Change-Id: I7cd6378b17d1388d6006bc8ade9708f4797ff51a Former-commit-id: 63998469f8133c96cd48f9e23685ece4400573c9 [formerly bbd008a01210890dd3a332cb8c2cbca8b6ff8636] [formerly 40f30c4e7a11ab601554583119b5b98eb67136e6] [formerly c76a29c074ee1d7313a840c37a108ffa7ee54cf2 [formerly 40f30c4e7a11ab601554583119b5b98eb67136e6 [formerly 6c2646847984f3f8ef7a1640128bd06a2abb6a57]]] Former-commit-id: c76a29c074ee1d7313a840c37a108ffa7ee54cf2 Former-commit-id: 670b7b901a1f1387ba1044b5c27baefab36b6aa3 [formerly 8751b44abf942eda1c71e4f8331ed15cdc29f95c] Former-commit-id: f7e2ee9e2f1595dbb72ef847a1d6aa0c8a7c9a3d --- tests/resources/log4j.xml | 24 --------- tests/resources/logback-test.xml | 53 +++++++++++++++++++ .../uf/common/util/ReflectionUtilTest.java | 6 +-- .../datadelivery/retrieval/LinkStoreTest.java | 38 +++++++------ 4 files changed, 74 insertions(+), 47 deletions(-) delete mode 100644 tests/resources/log4j.xml create mode 100644 tests/resources/logback-test.xml diff --git a/tests/resources/log4j.xml b/tests/resources/log4j.xml deleted file mode 100644 index e3ba85425e..0000000000 --- a/tests/resources/log4j.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/resources/logback-test.xml b/tests/resources/logback-test.xml new file mode 100644 index 0000000000..26f98cbf78 --- /dev/null +++ b/tests/resources/logback-test.xml @@ -0,0 +1,53 @@ + + + + %-5p %d [%t] %c{0}: %m%n + + + INFO + + + + + System.err + + WARN + + + %-5p %d [%t] %c{0}: %m%n + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/unit/com/raytheon/uf/common/util/ReflectionUtilTest.java b/tests/unit/com/raytheon/uf/common/util/ReflectionUtilTest.java index c3288f93ec..fd0ba7ff52 100644 --- a/tests/unit/com/raytheon/uf/common/util/ReflectionUtilTest.java +++ b/tests/unit/com/raytheon/uf/common/util/ReflectionUtilTest.java @@ -24,7 +24,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.util.ArrayList; -import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -39,7 +38,8 @@ import org.junit.Test; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Jul 10, 2012 634 djohnson Initial creation + * Jul 10, 2012 634 djohnson Initial creation + * Jul 08, 2013 2173 mpduff Update to work with Java 1.7. * * * @@ -94,7 +94,7 @@ public class ReflectionUtilTest { @Test public void testGetterRetrievesIsPrefixedValue() { - List list = Collections.emptyList(); + List list = new ArrayList(0); boolean value = (Boolean) ReflectionUtil.getter(list, "empty"); diff --git a/tests/unit/com/raytheon/uf/edex/datadelivery/retrieval/LinkStoreTest.java b/tests/unit/com/raytheon/uf/edex/datadelivery/retrieval/LinkStoreTest.java index 47962ebff2..d79b69cd78 100644 --- a/tests/unit/com/raytheon/uf/edex/datadelivery/retrieval/LinkStoreTest.java +++ b/tests/unit/com/raytheon/uf/edex/datadelivery/retrieval/LinkStoreTest.java @@ -42,6 +42,7 @@ import org.junit.Test; * ------------ ---------- ----------- -------------------------- * Jul 26, 2012 955 djohnson Initial creation * Sep 11, 2012 1154 djohnson Test JAXB marshall/unmarshall. + * Jul 08, 2013 2173 mpduff Change to look at xml values, not the xml itself. * * * @@ -97,27 +98,24 @@ public class LinkStoreTest { Writer writer = new StringWriter(); context.createMarshaller().marshal(linkStore, writer); - final String expectedXml = "" - + "" - + "urlOne" - + "" - + ""; - - assertEquals("The marshalled XML did not match what was expected!", - expectedXml, writer.toString()); - LinkStore restored = (LinkStore) context.createUnmarshaller() - .unmarshal( - new StringReader(writer.toString())); + .unmarshal(new StringReader(writer.toString())); + + Link link2 = restored.getLink(LinkStore.getLinkKey(linkStoreLink)); + + assertEquals("Links do not match", link, link2); + + assertEquals("Names do not match", link.getName(), link2.getName()); + + assertEquals("URLs do not match", link.getUrl(), link2.getUrl()); + + assertEquals("Creation Times do not match", + linkStore.getCreationTime(), restored.getCreationTime()); + + assertEquals("Date Strings do not match", linkStore.getDateString(), + restored.getDateString()); + assertEquals("Dates do not match", linkStore.getDate(), + restored.getDate()); assertEquals( "The jaxb unmarshalled version should have been equal to the original!",