You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2017/11/19 23:42:47 UTC
incubator-tamaya git commit: TAMAYA-318 Fixed invalid tests. Null is
allowed as default value.
Repository: incubator-tamaya
Updated Branches:
refs/heads/master a53c1bf58 -> f255aa9b9
TAMAYA-318 Fixed invalid tests. Null is allowed as default value.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/f255aa9b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/f255aa9b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/f255aa9b
Branch: refs/heads/master
Commit: f255aa9b9ea51e439ff3d79495d03d457a2c88c5
Parents: a53c1bf
Author: Anatole Tresch <an...@apache.org>
Authored: Mon Nov 20 00:42:38 2017 +0100
Committer: Anatole Tresch <an...@apache.org>
Committed: Mon Nov 20 00:42:38 2017 +0100
----------------------------------------------------------------------
.../spisupport/DefaultConfigurationTest.java | 22 +++++++++++---------
1 file changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/f255aa9b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationTest.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationTest.java b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationTest.java
index 6e3dc5b..27eeda1 100644
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationTest.java
+++ b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationTest.java
@@ -22,10 +22,12 @@ import org.apache.tamaya.TypeLiteral;
import org.apache.tamaya.spi.*;
import org.junit.Test;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
public class DefaultConfigurationTest {
@@ -70,11 +72,11 @@ public class DefaultConfigurationTest {
c.getOrDefault(null, String.class, "ok");
}
- @Test(expected = NullPointerException.class)
- public void getOrDefaultDoesNotAcceptNullAsDefaultValueForThreeParameterVariant() {
+ @Test
+ public void getOrDefaultDoesAcceptNullAsDefaultValueForThreeParameterVariant() {
DefaultConfiguration c = new DefaultConfiguration(new DummyConfigurationContext());
- c.getOrDefault("a", String.class, null);
+ assertNull(c.getOrDefault("a", String.class, null));
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@@ -95,11 +97,11 @@ public class DefaultConfigurationTest {
c.getOrDefault(null, TypeLiteral.of(String.class), "ok");
}
- @Test(expected = NullPointerException.class)
- public void getOrDefaultDoesNotAcceptNullAsDefaultValueForThreeParameterVariantSecondIsTypeLiteral() {
+ @Test
+ public void getOrDefaultDoesAcceptNullAsDefaultValueForThreeParameterVariantSecondIsTypeLiteral() {
DefaultConfiguration c = new DefaultConfiguration(new DummyConfigurationContext());
- c.getOrDefault("a", TypeLiteral.of(String.class), null);
+ assertNull(c.getOrDefault("a", TypeLiteral.of(String.class), null));
}
@Test(expected = NullPointerException.class)
@@ -160,7 +162,7 @@ public class DefaultConfigurationTest {
@Override
public List<PropertySource> getPropertySources() {
- throw new RuntimeException("Method should be never called in this test");
+ return Collections.emptyList();
}
@Override
@@ -175,17 +177,17 @@ public class DefaultConfigurationTest {
@Override
public Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters() {
- throw new RuntimeException("Method should be never called in this test");
+ return Collections.emptyMap();
}
@Override
public <T> List<PropertyConverter<T>> getPropertyConverters(TypeLiteral<T> type) {
- throw new RuntimeException("Method should be never called in this test");
+ return Collections.emptyList();
}
@Override
public List<PropertyFilter> getPropertyFilters() {
- throw new RuntimeException("Method should be never called in this test");
+ return Collections.emptyList();
}
@Override