tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acob...@apache.org
Subject [incubator-tamaya] 01/01: TAMAYA-277: Add test assertions
Date Thu, 02 May 2019 19:38:00 GMT
This is an automated email from the ASF dual-hosted git repository.

acoburn pushed a commit to branch TAMAYA-277-add-test-assertions
in repository https://gitbox.apache.org/repos/asf/incubator-tamaya.git

commit c554c3992d4d114618e5eb9c4ea4c90c8bcca6fb
Author: Aaron Coburn <acoburn@apache.org>
AuthorDate: Thu May 2 15:33:02 2019 -0400

    TAMAYA-277: Add test assertions
    
    This adds assertions to tests that lacked any.
---
 .../apache/tamaya/core/internal/CoreConfigurationProviderTest.java | 7 ++++---
 .../org/apache/tamaya/core/internal/CoreConfigurationTest.java     | 1 +
 .../apache/tamaya/spisupport/DefaultConfigurationBuilderTest.java  | 3 ++-
 .../apache/tamaya/spisupport/DefaultConfigurationSnapshotTest.java | 1 +
 .../org/apache/tamaya/spisupport/DefaultMetaDataProviderTest.java  | 7 +++++--
 .../apache/tamaya/spisupport/PropertySourceChangeSupportTest.java  | 3 ++-
 6 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/CoreConfigurationProviderTest.java
b/code/core/src/test/java/org/apache/tamaya/core/internal/CoreConfigurationProviderTest.java
index d3f8174..e9d1cfb 100644
--- a/code/core/src/test/java/org/apache/tamaya/core/internal/CoreConfigurationProviderTest.java
+++ b/code/core/src/test/java/org/apache/tamaya/core/internal/CoreConfigurationProviderTest.java
@@ -22,6 +22,7 @@ import org.apache.tamaya.Configuration;
 import org.junit.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
 
 /**
  * Created by atsticks on 11.09.16.
@@ -30,7 +31,7 @@ public class CoreConfigurationProviderTest {
 
     @Test
     public void testInstantiation() throws Exception {
-        new CoreConfigurationProvider();
+        assertThatCode(() -> new CoreConfigurationProvider()).doesNotThrowAnyException();
     }
 
     @Test
@@ -53,11 +54,11 @@ public class CoreConfigurationProviderTest {
     @SuppressWarnings("deprecation")
     @Test
     public void setConfiguration() throws Exception {
-        new CoreConfigurationProvider()
+        assertThatCode(() -> new CoreConfigurationProvider()
                 .setConfiguration(new CoreConfigurationProvider().getConfiguration(
                         getClass().getClassLoader()),
                         getClass().getClassLoader()
-                );
+                )).doesNotThrowAnyException();
     }
 
     @SuppressWarnings("deprecation")
diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/CoreConfigurationTest.java
b/code/core/src/test/java/org/apache/tamaya/core/internal/CoreConfigurationTest.java
index 0075784..3d707eb 100644
--- a/code/core/src/test/java/org/apache/tamaya/core/internal/CoreConfigurationTest.java
+++ b/code/core/src/test/java/org/apache/tamaya/core/internal/CoreConfigurationTest.java
@@ -48,6 +48,7 @@ public class CoreConfigurationTest {
     @Test
     public void testToString() throws Exception {
         String toString = Configuration.current().getContext().toString();
+        assertThat(toString).contains("Property Filters").contains("Property Converters");
     }
 
     @Test
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationBuilderTest.java
b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationBuilderTest.java
index 9289bff..4fca8f3 100644
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationBuilderTest.java
+++ b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationBuilderTest.java
@@ -32,6 +32,7 @@ import org.apache.tamaya.spi.PropertyValue;
 import org.junit.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
 
 /**
  * Tests for {@link  DefaultConfigurationBuilder} by atsticks on 06.09.16.
@@ -358,7 +359,7 @@ public class DefaultConfigurationBuilderTest {
     @Test
     public void bla() throws Exception {
         ConfigurationBuilder builder = ConfigurationProvider.getConfigurationBuilder();
-        builder.addDefaultPropertyConverters();
+        assertThatCode(() -> builder.addDefaultPropertyConverters()).doesNotThrowAnyException();
     }
 
     private static class TestPropertySource implements PropertySource {
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationSnapshotTest.java
b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationSnapshotTest.java
index 1538d44..4169b4a 100644
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationSnapshotTest.java
+++ b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationSnapshotTest.java
@@ -45,6 +45,7 @@ public class DefaultConfigurationSnapshotTest {
         Configuration config = Configuration.current();
         DefaultConfigurationSnapshot snapshot = new DefaultConfigurationSnapshot(config,
                 Arrays.asList("confkey1", "confkey2", "confkey3"));
+        assertThat(snapshot).isNotNull();
     }
 
     @Test
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultMetaDataProviderTest.java
b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultMetaDataProviderTest.java
index a3a9846..c6aca71 100644
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultMetaDataProviderTest.java
+++ b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultMetaDataProviderTest.java
@@ -25,6 +25,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
 
 /**
  * Tests for {@link DefaultMetaDataProvider}.
@@ -33,7 +34,7 @@ public class DefaultMetaDataProviderTest {
 
     @Test
     public void cretion() {
-        new DefaultMetaDataProvider();
+        assertThatCode(() -> new DefaultMetaDataProvider()).doesNotThrowAnyException();
     }
 
     @Test
@@ -85,8 +86,10 @@ public class DefaultMetaDataProviderTest {
         assertThat(provider.getMetaData("foo")).isNotNull().isEmpty();
     }
 
-
     @Test
     public void testToString() {
+        DefaultMetaDataProvider provider = new DefaultMetaDataProvider();
+        assertThat(provider.init(ConfigurationContext.EMPTY).toString())
+            .isEqualTo("DefaultMetaDataProvider[additionalProperties = {}, context = ConfigurationContext.EMPTY]");
     }
 }
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/PropertySourceChangeSupportTest.java
b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/PropertySourceChangeSupportTest.java
index c6ce987..ddbe8a1 100644
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/PropertySourceChangeSupportTest.java
+++ b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/PropertySourceChangeSupportTest.java
@@ -30,6 +30,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.function.BiConsumer;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
@@ -115,7 +116,7 @@ public class PropertySourceChangeSupportTest {
     public void update() {
         PropertySource ps = BuildablePropertySource.builder().withName("test").build();
         PropertySourceChangeSupport support = new PropertySourceChangeSupport(ChangeSupport.IMMUTABLE,
ps);
-        support.load(Collections.emptyMap());
+        assertThatCode(() -> support.load(Collections.emptyMap())).doesNotThrowAnyException();
     }
 
     @Test


Mime
View raw message