TAMAYA-340: Eliminate sysout from test

* Tried to understand ignored test case that initializes by sysproperties
but seems to ignore the given prefix.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/ab914033
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/ab914033
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/ab914033

Branch: refs/heads/master
Commit: ab914033ac5066a0577169a6859911299689ea9a
Parents: f33d454
Author: Phil Ottlinger <pottlin...@apache.org>
Authored: Tue Jun 5 21:50:10 2018 +0200
Committer: Phil Ottlinger <pottlin...@apache.org>
Committed: Tue Jun 5 21:50:10 2018 +0200

----------------------------------------------------------------------
 .../EnvironmentPropertySourceTest.java          | 23 ++++++++++++--------
 1 file changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ab914033/code/spi-support/src/test/java/org/apache/tamaya/spisupport/propertysource/EnvironmentPropertySourceTest.java
----------------------------------------------------------------------
diff --git 
a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/propertysource/EnvironmentPropertySourceTest.java
 
b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/propertysource/EnvironmentPropertySourceTest.java
index 10cb2fd..01e23ee 100644
--- 
a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/propertysource/EnvironmentPropertySourceTest.java
+++ 
b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/propertysource/EnvironmentPropertySourceTest.java
@@ -18,16 +18,16 @@
  */
 package org.apache.tamaya.spisupport.propertysource;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import java.io.IOException;
 import java.io.StringReader;
 import java.io.StringWriter;
-import org.apache.tamaya.spi.PropertyValue;
-import org.junit.Test;
-
 import java.util.Map;
 
-import static org.assertj.core.api.Assertions.*;
+import org.apache.tamaya.spi.PropertyValue;
 import org.junit.Ignore;
+import org.junit.Test;
 
 /**
  * Tests for {@link EnvironmentPropertySource}.
@@ -49,7 +49,7 @@ public class EnvironmentPropertySourceTest {
             System.setProperty("tamaya.envprops.prefix", "fakeprefix");
             System.setProperty("tamaya.envprops.disable", "true");
             localEnvironmentPropertySource = new EnvironmentPropertySource();
-            
//assertThat(environmentSource.getPrefix()).isEqualTo("fakeprefix");
+            assertThat(localEnvironmentPropertySource.getPrefix()).isNull(); 
// is not fakeprefix because disabled
             assertThat(localEnvironmentPropertySource.isDisabled()).isTrue();
             
assertThat(localEnvironmentPropertySource.get(System.getenv().entrySet().iterator().next().getKey())).isNull();
             
assertThat(localEnvironmentPropertySource.getName().contains("(disabled)")).isTrue();
@@ -103,12 +103,18 @@ public class EnvironmentPropertySourceTest {
         }
     }
     
-    @Ignore
+    @Ignore("Why is this test case disabled?")
     @Test
     public void testPrefixedGet() throws Exception {
-        EnvironmentPropertySource localEnvironmentPropertySource = new 
EnvironmentPropertySource("fancyprefix");
+       System.setProperty("tamaya.envprops.prefix", "fancyprefix");
+        System.setProperty("tamaya.envprops.disable", "false");
+        System.setProperty("tamaya.defaults.disable", "false");
+      // works: EnvironmentPropertySource localEnvironmentPropertySource = new 
EnvironmentPropertySource("fancyprefix");
+      EnvironmentPropertySource localEnvironmentPropertySource = new 
EnvironmentPropertySource();
+      System.out.println(localEnvironmentPropertySource);
+      
assertThat(localEnvironmentPropertySource.getPrefix()).isEqualTo("fancyprefix");
         localEnvironmentPropertySource.setPropertiesProvider(new 
MockedSystemPropertiesProvider());
-        
assertThat(localEnvironmentPropertySource.get("somekey").getValue()).isEqualTo("fancyprefix.somekey.value");
+        
assertThat(localEnvironmentPropertySource.get("somekey").getValue()).isEqualTo("somekey.value");
     }
 
     @Test
@@ -142,7 +148,6 @@ public class EnvironmentPropertySourceTest {
     private class MockedSystemPropertiesProvider extends 
EnvironmentPropertySource.SystemPropertiesProvider {
         @Override
         String getenv(String key) {
-            System.out.println("Called with key " + key);
             return key + ".value";
         }
     }

Reply via email to