tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pottlin...@apache.org
Subject [1/6] incubator-tamaya git commit: TAMAYA-217: Convert test assertions to AssertJ
Date Mon, 26 Feb 2018 21:10:57 GMT
Repository: incubator-tamaya
Updated Branches:
  refs/heads/master 125eed202 -> 119c49821


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/119c4982/code/spi-support/src/test/java/org/apache/tamaya/spisupport/propertysource/WrappedPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/propertysource/WrappedPropertySourceTest.java
b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/propertysource/WrappedPropertySourceTest.java
index 5b46ee7..26d68ae 100644
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/propertysource/WrappedPropertySourceTest.java
+++ b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/propertysource/WrappedPropertySourceTest.java
@@ -23,7 +23,7 @@ import java.util.Map;
 import org.apache.tamaya.spi.PropertySource;
 import org.apache.tamaya.spi.PropertyValue;
 import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.assertj.core.api.Assertions.*;
 
 /**
  *
@@ -37,9 +37,9 @@ public class WrappedPropertySourceTest {
     @Test
     public void testOf_PropertySource() {
         WrappedPropertySource instance = WrappedPropertySource.of(new MockedWrappablePropertySource());
-        assertEquals("MockedWrappablePropertySource", instance.getName());
+        assertThat(instance.getName()).isEqualTo("MockedWrappablePropertySource");
         WrappedPropertySource instance2 = WrappedPropertySource.of(instance);
-        assertEquals("MockedWrappablePropertySource", instance2.getName());
+        assertThat(instance2.getName()).isEqualTo("MockedWrappablePropertySource");
     }
 
     /**
@@ -48,12 +48,12 @@ public class WrappedPropertySourceTest {
     @Test
     public void testOrdinalsAndOrdinalConstructors() {
         WrappedPropertySource instance = WrappedPropertySource.of(new MockedWrappablePropertySource(),
null);
-        assertEquals(10, instance.getOrdinal());
+        assertThat(instance.getOrdinal()).isEqualTo(10);
         instance.setOrdinal(20);
-        assertEquals(20, instance.getOrdinal());
+        assertThat(instance.getOrdinal()).isEqualTo(20);
         
         WrappedPropertySource instance2 = WrappedPropertySource.of(instance, null);
-        assertEquals(10, instance2.getOrdinal());
+        assertThat(instance2.getOrdinal()).isEqualTo(10);
     }
 
     /**
@@ -67,9 +67,9 @@ public class WrappedPropertySourceTest {
         first.setName("second");
         
         WrappedPropertySource instance = WrappedPropertySource.of(first);
-        assertEquals(first, instance.getDelegate());
+        assertThat(instance.getDelegate()).isEqualTo(first);
         instance.setDelegate(second);
-        assertEquals(second, instance.getDelegate());
+        assertThat(instance.getDelegate()).isEqualTo(second);
         
     }
 
@@ -81,7 +81,7 @@ public class WrappedPropertySourceTest {
     public void testGet() {
         WrappedPropertySource instance = WrappedPropertySource.of(new MockedWrappablePropertySource());
         PropertyValue result = instance.get("thisKey");
-        assertEquals("valueFromMockedWrappablePropertySource", result.getValue());
+        assertThat(result.getValue()).isEqualTo("valueFromMockedWrappablePropertySource");
     }
 
     /**
@@ -91,8 +91,8 @@ public class WrappedPropertySourceTest {
     public void testGetProperties() {
         WrappedPropertySource instance = WrappedPropertySource.of(new MockedWrappablePropertySource());
         Map<String, PropertyValue> result = instance.getProperties();
-        assertTrue(result.containsKey("someKey"));
-        assertEquals(1, result.size());
+        assertThat(result.containsKey("someKey")).isTrue();
+        assertThat(result).hasSize(1);
     }
 
     /**
@@ -101,7 +101,7 @@ public class WrappedPropertySourceTest {
     @Test
     public void testIsScannable() {
         WrappedPropertySource instance = WrappedPropertySource.of(new MockedWrappablePropertySource());
-        assertTrue(instance.isScannable());
+        assertThat(instance.isScannable()).isTrue();
     }
 
     @Test
@@ -117,16 +117,16 @@ public class WrappedPropertySourceTest {
         WrappedPropertySource wps2 = WrappedPropertySource.of(source2);
         WrappedPropertySource wps3 = WrappedPropertySource.of(source3);
 
-        assertEquals(wps1, wps1);
-        assertNotEquals(null, wps1);
-        assertNotEquals(source1, wps1);
-        assertNotEquals(wps1, source1);
-        assertNotEquals("aString", wps1);
-        assertEquals(wps1, wps2);
-        assertNotEquals(wps1, wps3);
-        assertEquals(wps1.hashCode(), wps2.hashCode());
-        assertNotEquals(wps1.hashCode(), wps3.hashCode());
-        assertTrue(wps1.toString().contains("name=testEqualsName"));
+        assertThat(wps1).isEqualTo(wps1);
+        assertThat(wps1).isNotEqualTo(null);
+        assertThat(source1).isNotEqualTo(wps1);
+        assertThat(wps1).isNotEqualTo(source1);
+        assertThat("aString").isNotEqualTo(wps1);
+        assertThat(wps2).isEqualTo(wps1);
+        assertThat(wps1).isNotEqualTo(wps3);
+        assertThat(wps2.hashCode()).isEqualTo(wps1.hashCode());
+        assertThat(wps1.hashCode()).isNotEqualTo(wps3.hashCode());
+        assertThat(wps1.toString().contains("name=testEqualsName")).isTrue();
     }
 
     private class MockedWrappablePropertySource implements PropertySource{

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/119c4982/examples/01-minimal/pom.xml
----------------------------------------------------------------------
diff --git a/examples/01-minimal/pom.xml b/examples/01-minimal/pom.xml
index e1d8a71..0f0f8ba 100644
--- a/examples/01-minimal/pom.xml
+++ b/examples/01-minimal/pom.xml
@@ -49,10 +49,6 @@ under the License.
             <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.hamcrest</groupId>
-            <artifactId>java-hamcrest</artifactId>
-        </dependency>
-        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/119c4982/examples/02-custom-property-source/pom.xml
----------------------------------------------------------------------
diff --git a/examples/02-custom-property-source/pom.xml b/examples/02-custom-property-source/pom.xml
index 4fe43b4..53b0f81 100644
--- a/examples/02-custom-property-source/pom.xml
+++ b/examples/02-custom-property-source/pom.xml
@@ -46,14 +46,10 @@ under the License.
             <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.hamcrest</groupId>
-            <artifactId>java-hamcrest</artifactId>
-        </dependency>
-        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
     
-</project>
\ No newline at end of file
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/119c4982/examples/11-distributed/pom.xml
----------------------------------------------------------------------
diff --git a/examples/11-distributed/pom.xml b/examples/11-distributed/pom.xml
index 0f0bfe9..b253b2c 100644
--- a/examples/11-distributed/pom.xml
+++ b/examples/11-distributed/pom.xml
@@ -82,10 +82,6 @@
             <version>${tamaya.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.hamcrest</groupId>
-            <artifactId>java-hamcrest</artifactId>
-        </dependency>
-        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <version>${junit.version}</version>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/119c4982/examples/11-distributed/src/test/java/org/apache/tamaya/examples/distributed/DisplayContentTest.java
----------------------------------------------------------------------
diff --git a/examples/11-distributed/src/test/java/org/apache/tamaya/examples/distributed/DisplayContentTest.java
b/examples/11-distributed/src/test/java/org/apache/tamaya/examples/distributed/DisplayContentTest.java
index bf92e88..0be7974 100644
--- a/examples/11-distributed/src/test/java/org/apache/tamaya/examples/distributed/DisplayContentTest.java
+++ b/examples/11-distributed/src/test/java/org/apache/tamaya/examples/distributed/DisplayContentTest.java
@@ -21,7 +21,7 @@ package org.apache.tamaya.examples.distributed;
 
 import io.vertx.core.json.Json;
 
-import static org.junit.Assert.*;
+import static org.assertj.core.api.Assertions.*;
 
 /**
  * Created by atsticks on 13.11.16.
@@ -41,8 +41,8 @@ public class DisplayContentTest {
         content.content.put("content", "myContent");
         String val = Json.encode(content);
         DisplayContent decoded = Json.decodeValue(val, DisplayContent.class);
-        assertNotNull(decoded);
-        assertEquals(content, decoded);
+        assertThat(decoded).isNotNull();
+        assertThat(decoded).isEqualTo(content);
     }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/119c4982/examples/11-distributed/src/test/java/org/apache/tamaya/examples/distributed/DisplayRegistrationTest.java
----------------------------------------------------------------------
diff --git a/examples/11-distributed/src/test/java/org/apache/tamaya/examples/distributed/DisplayRegistrationTest.java
b/examples/11-distributed/src/test/java/org/apache/tamaya/examples/distributed/DisplayRegistrationTest.java
index c23728d..8aae49c 100644
--- a/examples/11-distributed/src/test/java/org/apache/tamaya/examples/distributed/DisplayRegistrationTest.java
+++ b/examples/11-distributed/src/test/java/org/apache/tamaya/examples/distributed/DisplayRegistrationTest.java
@@ -22,7 +22,7 @@ package org.apache.tamaya.examples.distributed;
 import io.vertx.core.json.Json;
 import org.junit.Test;
 
-import static org.junit.Assert.*;
+import static org.assertj.core.api.Assertions.*;
 
 /**
  * Created by atsticks on 13.11.16.
@@ -63,8 +63,8 @@ public class DisplayRegistrationTest {
         DisplayRegistration reg = new DisplayRegistration("myDisplay", "VT100");
         String val = Json.encode(reg);
         DisplayRegistration decoded = Json.decodeValue(val, DisplayRegistration.class);
-        assertNotNull(decoded);
-        assertEquals(reg, decoded);
+        assertThat(decoded).isNotNull();
+        assertThat(decoded).isEqualTo(reg);
     }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/119c4982/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6a8c947..6955913 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,7 +60,6 @@
         <enforcer.version>1.4.1</enforcer.version>
         <gem.plugin>1.0.7</gem.plugin>
         <sources.plugin>3.0.1</sources.plugin>
-        <hamcrest.version>2.0.0.0</hamcrest.version>
         <javadoc.version>3.0.0</javadoc.version>
         <!-- Must/should match the JRuby version used by AsciidoctorJ -->
         <jruby.version>1.7.26</jruby.version>
@@ -220,12 +219,6 @@
                 <artifactId>mockito-core</artifactId>
                 <version>${mockito.version}</version>
                 <scope>test</scope>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.hamcrest</groupId>
-                        <artifactId>hamcrest-core</artifactId>
-                    </exclusion>
-                </exclusions>
             </dependency>
             <dependency>
                 <groupId>commons-io</groupId>
@@ -238,18 +231,6 @@
                 <artifactId>junit</artifactId>
                 <version>${junit.version}</version>
                 <scope>test</scope>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.hamcrest</groupId>
-                        <artifactId>hamcrest-core</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>org.hamcrest</groupId>
-                <artifactId>java-hamcrest</artifactId>
-                <version>${hamcrest.version}</version>
-                <scope>test</scope>
             </dependency>
             <!-- quality gates -->
             <dependency>


Mime
View raw message