From ccaff1cc79621fe09fb9ed0fb40c3673d809457b Mon Sep 17 00:00:00 2001 From: danglotb Date: Tue, 26 Nov 2019 16:19:57 +0100 Subject: [PATCH] test: update test --- .../ObjectLogTest.java | 13 ++++++++++++- .../objectlog/ObjectLogUtilsTest.java | 8 ++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/dspot/src/test/java/eu/stamp_project/dspot/assertiongenerator/assertiongenerator/methodreconstructor/observer/testwithloggenerator/objectlogsyntaxbuilder_constructs/ObjectLogTest.java b/dspot/src/test/java/eu/stamp_project/dspot/assertiongenerator/assertiongenerator/methodreconstructor/observer/testwithloggenerator/objectlogsyntaxbuilder_constructs/ObjectLogTest.java index e6a19bc63..b8bff766d 100644 --- a/dspot/src/test/java/eu/stamp_project/dspot/assertiongenerator/assertiongenerator/methodreconstructor/observer/testwithloggenerator/objectlogsyntaxbuilder_constructs/ObjectLogTest.java +++ b/dspot/src/test/java/eu/stamp_project/dspot/assertiongenerator/assertiongenerator/methodreconstructor/observer/testwithloggenerator/objectlogsyntaxbuilder_constructs/ObjectLogTest.java @@ -5,6 +5,7 @@ import org.junit.Test; import java.io.File; +import java.io.Serializable; import java.util.*; import static org.junit.Assert.assertEquals; @@ -38,6 +39,9 @@ private static class MyInternalClass { public MyInternalClass(int a, int b) { this.a = a; this.b = b; + this.myList = new MyList(); + this.myList.add("toto"); + this.myList.add("tata"); } public List getObject() { @@ -67,6 +71,13 @@ public Iterable getIterable() { public Collection getCollection() { return Collections.singleton(""); } + public static class MyList extends ArrayList implements Serializable { + public int aValue = 23; + } + public MyList myList; + public MyList getMyList() { + return this.myList; + } } public static Integer add(Integer a, Integer b) { @@ -88,7 +99,7 @@ public void test() throws Exception { assertNotNull(add__0); // assertEquals(1, add__0.getNotDeterministValues().size()); final Map observationValues = add__0.getObservationValues(); - assertEquals(5, observationValues.size()); + assertEquals(8, observationValues.size()); // assertEquals(25, observationValues.get("(myInternalClass ).compute()")); assertEquals(3, observationValues.get("(myInternalClass ).getA()")); assertEquals(20, observationValues.get("(myInternalClass ).getB()")); diff --git a/dspot/src/test/java/eu/stamp_project/dspot/assertiongenerator/assertiongenerator/methodreconstructor/observer/testwithloggenerator/objectlogsyntaxbuilder_constructs/objectlog/ObjectLogUtilsTest.java b/dspot/src/test/java/eu/stamp_project/dspot/assertiongenerator/assertiongenerator/methodreconstructor/observer/testwithloggenerator/objectlogsyntaxbuilder_constructs/objectlog/ObjectLogUtilsTest.java index 8de7e6306..13aa10700 100644 --- a/dspot/src/test/java/eu/stamp_project/dspot/assertiongenerator/assertiongenerator/methodreconstructor/observer/testwithloggenerator/objectlogsyntaxbuilder_constructs/objectlog/ObjectLogUtilsTest.java +++ b/dspot/src/test/java/eu/stamp_project/dspot/assertiongenerator/assertiongenerator/methodreconstructor/observer/testwithloggenerator/objectlogsyntaxbuilder_constructs/objectlog/ObjectLogUtilsTest.java @@ -14,8 +14,15 @@ */ public class ObjectLogUtilsTest { + public class MyList extends ArrayList { + + } + @Test//TODO empty collection / map are considered as primitive, we may need to found a semantic of the method. public void testIsPrimitiveCollectionOrMap() throws Exception { + + assertFalse(ObjectLogUtils.isCollection(new MyList())); + final ArrayList list = new ArrayList<>(); assertFalse(ObjectLogUtils.isNonEmptyPrimitiveCollectionOrMap(list)); list.add(1); @@ -32,6 +39,7 @@ public void testIsPrimitiveCollectionOrMap() throws Exception { assertTrue(ObjectLogUtils.isNonEmptyPrimitiveCollectionOrMap(set)); assertFalse(ObjectLogUtils.isNonEmptyPrimitiveCollectionOrMap(1)); + } @Test