james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rouaz...@apache.org
Subject [3/6] james-project git commit: MAILET-99 Use assertj in MailetUtilTest
Date Mon, 29 Aug 2016 13:38:06 GMT
MAILET-99 Use assertj in MailetUtilTest


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/fc95390f
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/fc95390f
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/fc95390f

Branch: refs/heads/master
Commit: fc95390f747080d7d406678c37c4419b7212cb26
Parents: 38ba938
Author: Antoine Duprat <aduprat@linagora.com>
Authored: Thu Aug 25 15:04:26 2016 +0200
Committer: Antoine Duprat <aduprat@linagora.com>
Committed: Mon Aug 29 14:54:33 2016 +0200

----------------------------------------------------------------------
 .../org/apache/mailet/base/MailetUtilTest.java  | 66 +++++++++++---------
 1 file changed, 38 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/fc95390f/mailet/base/src/test/java/org/apache/mailet/base/MailetUtilTest.java
----------------------------------------------------------------------
diff --git a/mailet/base/src/test/java/org/apache/mailet/base/MailetUtilTest.java b/mailet/base/src/test/java/org/apache/mailet/base/MailetUtilTest.java
index 1063f51..fa3eaee 100644
--- a/mailet/base/src/test/java/org/apache/mailet/base/MailetUtilTest.java
+++ b/mailet/base/src/test/java/org/apache/mailet/base/MailetUtilTest.java
@@ -19,9 +19,9 @@
 
 package org.apache.mailet.base;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import org.apache.mailet.base.test.FakeMailetConfig;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -37,41 +37,51 @@ public class MailetUtilTest {
     }
 
     @Test
-    public void testGetInitParameterParameterIsTrue() {
-        assertTrue(getParameterValued("true", true));
-        assertTrue(getParameterValued("true", false));
-        assertTrue(getParameterValued("TRUE", true));
-        assertTrue(getParameterValued("TRUE", false));
-        assertTrue(getParameterValued("trUE", true));
-        assertTrue(getParameterValued("trUE", false));
+    public void getInitParameterShouldReturnTrueWhenIsValueTrueLowerCase() {
+        assertThat(getParameterValued("true", false)).isTrue();
+    }
+
+    @Test
+    public void getInitParameterShouldReturnTrueWhenIsValueTrueUpperCase() {
+        assertThat(getParameterValued("TRUE", false)).isTrue();
+    }
+
+    @Test
+    public void getInitParameterShouldReturnTrueWhenIsValueTrueMixedCase() {
+        assertThat(getParameterValued("trUE", false)).isTrue();
+    }
+
+    @Test
+    public void getInitParameterShouldReturnFalseWhenIsValueFalseLowerCase() {
+        assertThat(getParameterValued("false", true)).isFalse();
+    }
+
+    @Test
+    public void getInitParameterShouldReturnFalseWhenIsValueFalseUpperCase() {
+        assertThat(getParameterValued("FALSE", true)).isFalse();
     }
 
     @Test
-    public void testGetInitParameterParameterIsFalse() {
-        assertFalse(getParameterValued("false", true));
-        assertFalse(getParameterValued("false", false));
-        assertFalse(getParameterValued("FALSE", true));
-        assertFalse(getParameterValued("FALSE", false));
-        assertFalse(getParameterValued("fALSe", true));
-        assertFalse(getParameterValued("fALSe", false));
+    public void getInitParameterShouldReturnFalseWhenIsValueFalseMixedCase() {
+        assertThat(getParameterValued("fALSe", true)).isFalse();
     }
 
     @Test
-    public void testGetInitParameterParameterDefaultsToTrue() {
-        assertTrue(getParameterValued("fals", true));
-        assertTrue(getParameterValued("TRU", true));
-        assertTrue(getParameterValued("FALSEest", true));
-        assertTrue(getParameterValued("", true));
-        assertTrue(getParameterValued("gubbins", true));
+    public void getInitParameterShouldReturnDefaultValueAsTrueWhenBadValue() {
+        assertThat(getParameterValued("fals", true)).isTrue();
+        assertThat(getParameterValued("TRU", true)).isTrue();
+        assertThat(getParameterValued("FALSEest", true)).isTrue();
+        assertThat(getParameterValued("", true)).isTrue();
+        assertThat(getParameterValued("gubbins", true)).isTrue();
     }
 
     @Test
-    public void testGetInitParameterParameterDefaultsToFalse() {
-        assertFalse(getParameterValued("fals", false));
-        assertFalse(getParameterValued("TRU", false));
-        assertFalse(getParameterValued("FALSEest", false));
-        assertFalse(getParameterValued("", false));
-        assertFalse(getParameterValued("gubbins", false));
+    public void getInitParameterShouldReturnDefaultValueAsFalseWhenBadValue() {
+        assertThat(getParameterValued("fals", false)).isFalse();
+        assertThat(getParameterValued("TRU", false)).isFalse();
+        assertThat(getParameterValued("FALSEest", false)).isFalse();
+        assertThat(getParameterValued("", false)).isFalse();
+        assertThat(getParameterValued("gubbins", false)).isFalse();
     }
 
     private boolean getParameterValued(String value, boolean defaultValue) {


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message