From 00973ce2014632745fcc37fcf7fbdcf7f26e376a Mon Sep 17 00:00:00 2001 From: mikr Date: Sun, 28 Jun 2020 20:46:29 +0200 Subject: [PATCH] JAVA-1766 Update core-groovy-2 module --- core-groovy-2/determine-datatype/pom.xml | 44 --------------- .../groovy/determine/datatype/Person.groovy | 14 ----- .../determine/datatype/PersonTest.groovy | 55 ------------------- 3 files changed, 113 deletions(-) delete mode 100644 core-groovy-2/determine-datatype/pom.xml delete mode 100644 core-groovy-2/determine-datatype/src/com/baeldung/groovy/determine/datatype/Person.groovy delete mode 100644 core-groovy-2/determine-datatype/src/com/baeldung/groovy/determine/datatype/PersonTest.groovy diff --git a/core-groovy-2/determine-datatype/pom.xml b/core-groovy-2/determine-datatype/pom.xml deleted file mode 100644 index e03cb58ead..0000000000 --- a/core-groovy-2/determine-datatype/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - 4.0.0 - com.baeldung.groovy - determine-datatype - 0.0.1-SNAPSHOT - - src - - - maven-compiler-plugin - 3.8.0 - - 1.8 - 1.8 - - - - org.codehaus.gmaven - groovy-maven-plugin - - - org.codehaus.groovy - groovy-all - 2.0.6 - - - - - - - - - org.junit - junit5-engine - ${junit5.version} - - - - - 5.0.0-ALPHA - - \ No newline at end of file diff --git a/core-groovy-2/determine-datatype/src/com/baeldung/groovy/determine/datatype/Person.groovy b/core-groovy-2/determine-datatype/src/com/baeldung/groovy/determine/datatype/Person.groovy deleted file mode 100644 index 1a89dce435..0000000000 --- a/core-groovy-2/determine-datatype/src/com/baeldung/groovy/determine/datatype/Person.groovy +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.groovy.determine.datatype - -class Person { - - private int ageAsInt - private Double ageAsDouble - private String ageAsString - - Person() {} - Person(int ageAsInt) { this.ageAsInt = ageAsInt} - Person(Double ageAsDouble) { this.ageAsDouble = ageAsDouble} - Person(String ageAsString) { this.ageAsString = ageAsString} -} -class Student extends Person {} diff --git a/core-groovy-2/determine-datatype/src/com/baeldung/groovy/determine/datatype/PersonTest.groovy b/core-groovy-2/determine-datatype/src/com/baeldung/groovy/determine/datatype/PersonTest.groovy deleted file mode 100644 index 56095a3f1b..0000000000 --- a/core-groovy-2/determine-datatype/src/com/baeldung/groovy/determine/datatype/PersonTest.groovy +++ /dev/null @@ -1,55 +0,0 @@ -package com.baeldung.groovy.determine.datatype; - -import org.junit.Assert -import org.junit.Test; - -public class PersonTest { - - @Test - public void givenWhenParameterTypeIsInteger_thenReturnTrue() { - Person personObj = new Person(10) - Assert.assertTrue(personObj.ageAsInt instanceof Integer); - } - - @Test - public void givenWhenParameterTypeIsDouble_thenReturnTrue() { - Person personObj = new Person(10.0) - Assert.assertTrue((personObj.ageAsDouble).getClass() == Double) - } - - @Test - public void givenWhenParameterTypeIsString_thenReturnTrue() { - Person personObj = new Person("10 years") - Assert.assertTrue(personObj.ageAsString.class == String) - } - - @Test - public void givenClassName_WhenParameterIsInteger_thenReturnTrue() { - Assert.assertTrue(Person.class.getDeclaredField('ageAsInt').type == int.class) - } - - @Test - public void givenWhenObjectIsInstanceOfType_thenReturnTrue() { - Person personObj = new Person() - Assert.assertTrue(personObj instanceof Person) - } - - @Test - public void givenWhenInstanceIsOfSubtype_thenReturnTrue() { - Student studentObj = new Student() - Assert.assertTrue(studentObj in Person) - } - - @Test - public void givenGroovyList_WhenFindClassName_thenReturnTrue() { - def ageList = ['ageAsString','ageAsDouble', 10] - Assert.assertTrue(ageList.class == ArrayList) - Assert.assertTrue(ageList.getClass() == ArrayList) - } - - @Test - public void givenGrooyMap_WhenFindClassName_thenReturnTrue() { - def ageMap = [ageAsString: '10 years', ageAsDouble: 10.0] - Assert.assertFalse(ageMap.class == LinkedHashMap) - } -} \ No newline at end of file