From 13847b2c147ae7a4efc3f5a6aa7ecdeff2b678de Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Thu, 23 Jun 2016 10:14:01 +0200 Subject: [PATCH] Refined logging-statements of SimpleMapperTest --- .../de/juplo/jackson/SimpleMapperTest.java | 104 +++++++++++++----- src/test/resources/logback.xml | 19 ++++ 2 files changed, 93 insertions(+), 30 deletions(-) create mode 100644 src/test/resources/logback.xml diff --git a/src/test/java/de/juplo/jackson/SimpleMapperTest.java b/src/test/java/de/juplo/jackson/SimpleMapperTest.java index 873139e..e5769e4 100644 --- a/src/test/java/de/juplo/jackson/SimpleMapperTest.java +++ b/src/test/java/de/juplo/jackson/SimpleMapperTest.java @@ -11,12 +11,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Spliterator; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,6 +38,8 @@ public class SimpleMapperTest @Test public void testConvertEmptyInputToArraySpliterator() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + Spliterator spliterator; spliterator = SimpleMapper.getArraySpliterator(get("/empty/1.json")); @@ -61,6 +57,8 @@ public class SimpleMapperTest @Test public void testConvertEmptyInputToList() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + List list; list = SimpleMapper.convertArray(get("/empty/1.json")); @@ -78,6 +76,8 @@ public class SimpleMapperTest @Test public void testConvertEmptyInputToObjectSpliterator() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + Spliterator> spliterator; spliterator = SimpleMapper.getObjectSpliterator(get("/empty/1.json")); @@ -95,6 +95,8 @@ public class SimpleMapperTest @Test public void testConvertEmptyInputToMap() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + Map map; map = SimpleMapper.convertObject(get("/empty/1.json")); @@ -112,6 +114,8 @@ public class SimpleMapperTest @Test public void testConvertEmptyInput() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + Object object; object = SimpleMapper.convert(get("/empty/1.json")); @@ -130,6 +134,8 @@ public class SimpleMapperTest @Test public void testConvertEmptyArrayToArraySpliterator() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + Spliterator spliterator; spliterator = SimpleMapper.getArraySpliterator(get("/array/empty/1.json")); @@ -165,6 +171,8 @@ public class SimpleMapperTest @Test public void testConvertEmptyArrayToList() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + List list; list = SimpleMapper.convertArray(get("/array/empty/1.json")); @@ -180,6 +188,8 @@ public class SimpleMapperTest @Test public void testConvertEmptyArrayToObjectSpliterator() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + try { SimpleMapper.getObjectSpliterator(get("/array/empty/1.json")); @@ -187,7 +197,7 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } try @@ -197,7 +207,7 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } try @@ -207,7 +217,7 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } try @@ -217,13 +227,15 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } } @Test public void testConvertEmptyArrayToMap() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + try { SimpleMapper.convertObject(get("/array/empty/1.json")); @@ -231,7 +243,7 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } try @@ -241,7 +253,7 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } try @@ -251,7 +263,7 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } try @@ -261,13 +273,15 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } } @Test public void testConvertEmptyArray() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + Object object; object = SimpleMapper.convert(get("/array/empty/1.json")); @@ -292,6 +306,8 @@ public class SimpleMapperTest @Test public void testConvertEmptyObjectToArraySpliterator() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + try { SimpleMapper.getArraySpliterator(get("/object/empty/1.json")); @@ -299,7 +315,7 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } try @@ -309,7 +325,7 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } try @@ -319,7 +335,7 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } try @@ -329,13 +345,15 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } } @Test public void testConvertEmptyObjectToList() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + try { SimpleMapper.convertArray(get("/object/empty/1.json")); @@ -343,7 +361,7 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } try @@ -353,7 +371,7 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } try @@ -363,7 +381,7 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } try @@ -373,13 +391,15 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } } @Test public void testConvertEmptyObjectToObjectSpliterator() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + Spliterator> spliterator; spliterator = SimpleMapper.getObjectSpliterator(get("/object/empty/1.json")); @@ -415,6 +435,8 @@ public class SimpleMapperTest @Test public void testConvertEmptyObjectToMap() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + Map map; map = SimpleMapper.convertObject(get("/object/empty/1.json")); @@ -430,6 +452,8 @@ public class SimpleMapperTest @Test public void testConvertEmptyObject() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + Object object; object = SimpleMapper.convert(get("/object/empty/1.json")); @@ -454,6 +478,8 @@ public class SimpleMapperTest @Test public void testConvertArrayToArraySpliterator() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + Spliterator spliterator; spliterator = SimpleMapper.getArraySpliterator(get("/array/1.json")); @@ -486,6 +512,8 @@ public class SimpleMapperTest @Test public void testConvertArrayToList() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + List list; list = SimpleMapper.convertArray(get("/array/1.json")); @@ -501,6 +529,8 @@ public class SimpleMapperTest @Test public void testConvertArrayToObjectSpliterator() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + try { SimpleMapper.getObjectSpliterator(get("/array/1.json")); @@ -508,7 +538,7 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } try @@ -518,13 +548,15 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } } @Test public void testConvertArrayToMap() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + try { SimpleMapper.convertObject(get("/array/1.json")); @@ -532,7 +564,7 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } try @@ -542,13 +574,15 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } } @Test public void testConvertArray() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + Object object; List list; @@ -570,6 +604,8 @@ public class SimpleMapperTest @Test public void testConvertObjectToArraySpliterator() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + try { SimpleMapper.getArraySpliterator(get("/object/1.json")); @@ -577,7 +613,7 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } try @@ -587,13 +623,15 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } } @Test public void testConvertObjectToList() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + try { SimpleMapper.convertArray(get("/object/1.json")); @@ -601,7 +639,7 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } try @@ -611,13 +649,15 @@ public class SimpleMapperTest } catch(IllegalArgumentException e) { - LOG.info(e.getMessage()); + LOG.trace("expected exception", e); } } @Test public void testConvertObjectToObjectSpliterator() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + Spliterator> spliterator; spliterator = SimpleMapper.getObjectSpliterator(get("/object/1.json")); @@ -653,6 +693,8 @@ public class SimpleMapperTest @Test public void testConvertObjectToMap() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + Map map; map = SimpleMapper.convertObject(get("/object/1.json")); @@ -668,6 +710,8 @@ public class SimpleMapperTest @Test public void testConvertObject() throws Exception { + LOG.info("<-- Start Of New Test-Case!"); + Object object; Map map; diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml new file mode 100644 index 0000000..cd0fb78 --- /dev/null +++ b/src/test/resources/logback.xml @@ -0,0 +1,19 @@ + + + + + + %p - %c{0}.%M\(%L\) | %m%n + + + + + + + + + + + + + -- 2.20.1