This is an automated email from the ASF dual-hosted git repository.

fpapon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shiro.git


The following commit(s) were added to refs/heads/master by this push:
     new 099c116  Remove old junit.framework imports
     new a40a8fe  Merge pull request #160 from coheigea/junit
099c116 is described below

commit 099c1164ca72c88d8b976d20710391d3f85ab541
Author: Colm O hEigeartaigh <[email protected]>
AuthorDate: Mon Jul 15 12:15:22 2019 +0100

    Remove old junit.framework imports
---
 .../shiro/authz/ModularRealmAuthorizerTest.java    | 11 ++--
 .../realm/ldap/DefaultLdapContextFactoryTest.java  |  4 --
 .../realm/ldap/JndiLdapContextFactoryTest.java     |  4 +-
 .../shiro/crypto/AesCipherServiceTest.groovy       |  4 +-
 .../shiro/crypto/BlowfishCipherServiceTest.groovy  |  2 +-
 .../aspectj/bank/SecureBankServiceTest.java        | 72 +++++++++++-----------
 .../config/WebIniSecurityManagerFactoryTest.java   |  4 +-
 .../authz/HttpMethodPermissionFilterTest.java      |  2 +-
 8 files changed, 50 insertions(+), 53 deletions(-)

diff --git 
a/core/src/test/java/org/apache/shiro/authz/ModularRealmAuthorizerTest.java 
b/core/src/test/java/org/apache/shiro/authz/ModularRealmAuthorizerTest.java
index edd046b..f8a5044 100644
--- a/core/src/test/java/org/apache/shiro/authz/ModularRealmAuthorizerTest.java
+++ b/core/src/test/java/org/apache/shiro/authz/ModularRealmAuthorizerTest.java
@@ -18,13 +18,12 @@
  */
 package org.apache.shiro.authz;
 
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import java.util.ArrayList;
 import java.util.Collection;
 
-import junit.framework.Assert;
-
 import org.apache.shiro.authc.AuthenticationException;
 import org.apache.shiro.authc.AuthenticationInfo;
 import org.apache.shiro.authc.AuthenticationToken;
@@ -48,7 +47,7 @@ public class ModularRealmAuthorizerTest
         // its null to start with
         for ( Realm realm : realms )
         {
-            Assert.assertNull( 
((AuthorizingRealm)realm).getRolePermissionResolver() );
+            assertNull( ((AuthorizingRealm)realm).getRolePermissionResolver() 
);
         }
         
         ModularRealmAuthorizer modRealmAuthz = new ModularRealmAuthorizer();
@@ -57,7 +56,7 @@ public class ModularRealmAuthorizerTest
         // make sure they are still null
         for ( Realm realm : realms )
         {
-            Assert.assertNull( 
((AuthorizingRealm)realm).getRolePermissionResolver() );
+            assertNull( ((AuthorizingRealm)realm).getRolePermissionResolver() 
);
         }
         
         // now set the RolePermissionResolver
@@ -74,7 +73,7 @@ public class ModularRealmAuthorizerTest
         for ( Realm realm : realms )
         {
             // check for same instance
-            Assert.assertTrue( 
((AuthorizingRealm)realm).getRolePermissionResolver() == rolePermissionResolver 
);
+            assertTrue( ((AuthorizingRealm)realm).getRolePermissionResolver() 
== rolePermissionResolver );
         }
         
         // add a new realm and make sure the RolePermissionResolver is set
@@ -89,7 +88,7 @@ public class ModularRealmAuthorizerTest
 //        modRealmAuthz.setRolePermissionResolver( null );
 //        for ( Realm realm : realms )
 //        {
-//            Assert.assertNull( 
((AuthorizingRealm)realm).getRolePermissionResolver() );
+//            assertNull( 
((AuthorizingRealm)realm).getRolePermissionResolver() );
 //        }
         
         
diff --git 
a/core/src/test/java/org/apache/shiro/realm/ldap/DefaultLdapContextFactoryTest.java
 
b/core/src/test/java/org/apache/shiro/realm/ldap/DefaultLdapContextFactoryTest.java
index 6c0f044..9a52a3b 100644
--- 
a/core/src/test/java/org/apache/shiro/realm/ldap/DefaultLdapContextFactoryTest.java
+++ 
b/core/src/test/java/org/apache/shiro/realm/ldap/DefaultLdapContextFactoryTest.java
@@ -22,15 +22,11 @@ import org.junit.Before;
 import org.junit.Test;
 
 import javax.naming.AuthenticationException;
-import javax.naming.Context;
 import javax.naming.NamingException;
 import javax.naming.ldap.LdapContext;
-import java.util.HashMap;
 import java.util.Hashtable;
-import java.util.Map;
 import java.util.UUID;
 
-import static junit.framework.Assert.*;
 import static org.easymock.EasyMock.createNiceMock;
 
 /**
diff --git 
a/core/src/test/java/org/apache/shiro/realm/ldap/JndiLdapContextFactoryTest.java
 
b/core/src/test/java/org/apache/shiro/realm/ldap/JndiLdapContextFactoryTest.java
index 48018db..87ce184 100644
--- 
a/core/src/test/java/org/apache/shiro/realm/ldap/JndiLdapContextFactoryTest.java
+++ 
b/core/src/test/java/org/apache/shiro/realm/ldap/JndiLdapContextFactoryTest.java
@@ -30,8 +30,10 @@ import java.util.Hashtable;
 import java.util.Map;
 import java.util.UUID;
 
-import static junit.framework.Assert.*;
 import static org.easymock.EasyMock.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 
 /**
  * Tests for the {@link JndiLdapContextFactory} class.
diff --git 
a/crypto/cipher/src/test/groovy/org/apache/shiro/crypto/AesCipherServiceTest.groovy
 
b/crypto/cipher/src/test/groovy/org/apache/shiro/crypto/AesCipherServiceTest.groovy
index f35751e..3551ee8 100644
--- 
a/crypto/cipher/src/test/groovy/org/apache/shiro/crypto/AesCipherServiceTest.groovy
+++ 
b/crypto/cipher/src/test/groovy/org/apache/shiro/crypto/AesCipherServiceTest.groovy
@@ -18,12 +18,12 @@
  */
 package org.apache.shiro.crypto
 
+import static org.junit.Assert.*;
+
 import org.apache.shiro.codec.CodecSupport
 import org.apache.shiro.util.ByteSource
 import org.junit.Test
 
-import static junit.framework.Assert.*
-
 /**
  * Test class for the AesCipherService class.
  *
diff --git 
a/crypto/cipher/src/test/groovy/org/apache/shiro/crypto/BlowfishCipherServiceTest.groovy
 
b/crypto/cipher/src/test/groovy/org/apache/shiro/crypto/BlowfishCipherServiceTest.groovy
index eaadf55..2e90b42 100644
--- 
a/crypto/cipher/src/test/groovy/org/apache/shiro/crypto/BlowfishCipherServiceTest.groovy
+++ 
b/crypto/cipher/src/test/groovy/org/apache/shiro/crypto/BlowfishCipherServiceTest.groovy
@@ -22,7 +22,7 @@ import org.apache.shiro.codec.CodecSupport
 import org.apache.shiro.util.ByteSource
 import org.junit.Test
 
-import static junit.framework.Assert.assertTrue
+import static org.junit.Assert.assertTrue
 
 /**
  * Test cases for the {@link BlowfishCipherService} class.
diff --git 
a/samples/aspectj/src/test/java/org/apache/shiro/samples/aspectj/bank/SecureBankServiceTest.java
 
b/samples/aspectj/src/test/java/org/apache/shiro/samples/aspectj/bank/SecureBankServiceTest.java
index d2893e1..266c6cd 100644
--- 
a/samples/aspectj/src/test/java/org/apache/shiro/samples/aspectj/bank/SecureBankServiceTest.java
+++ 
b/samples/aspectj/src/test/java/org/apache/shiro/samples/aspectj/bank/SecureBankServiceTest.java
@@ -18,7 +18,6 @@
  */
 package org.apache.shiro.samples.aspectj.bank;
 
-import junit.framework.Assert;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.authc.UsernamePasswordToken;
 import org.apache.shiro.authz.UnauthorizedException;
@@ -28,6 +27,7 @@ import org.apache.shiro.subject.Subject;
 import org.apache.shiro.util.Factory;
 import org.junit.After;
 import org.junit.AfterClass;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -106,61 +106,61 @@ public class SecureBankServiceTest {
     public void testDepositInto_singleTx() throws Exception {
         loginAsUser();
         long accountId = createAndValidateAccountFor("Joe Smith");
-        makeDepositAndValidateAccount(accountId, 250.00d, "Joe Smith");
+        makeDepositAndValidateAccount(accountId, 250, "Joe Smith");
     }
 
     @Test
     public void testDepositInto_multiTxs() throws Exception {
         loginAsUser();
         long accountId = createAndValidateAccountFor("Everett Smith");
-        makeDepositAndValidateAccount(accountId, 50.00d, "Everett Smith");
-        makeDepositAndValidateAccount(accountId, 300.00d, "Everett Smith");
-        makeDepositAndValidateAccount(accountId, 85.00d, "Everett Smith");
-        assertAccount("Everett Smith", true, 435.00d, 3, accountId);
+        makeDepositAndValidateAccount(accountId, 50, "Everett Smith");
+        makeDepositAndValidateAccount(accountId, 300, "Everett Smith");
+        makeDepositAndValidateAccount(accountId, 85, "Everett Smith");
+        assertAccount("Everett Smith", true, 435, 3, accountId);
     }
 
     @Test(expected = NotEnoughFundsException.class)
     public void testWithdrawFrom_emptyAccount() throws Exception {
         loginAsUser();
         long accountId = createAndValidateAccountFor("Wally Smith");
-        service.withdrawFrom(accountId, 100.00d);
+        service.withdrawFrom(accountId, 100);
     }
 
     @Test(expected = NotEnoughFundsException.class)
     public void testWithdrawFrom_notEnoughFunds() throws Exception {
         loginAsUser();
         long accountId = createAndValidateAccountFor("Frank Smith");
-        makeDepositAndValidateAccount(accountId, 50.00d, "Frank Smith");
-        service.withdrawFrom(accountId, 100.00d);
+        makeDepositAndValidateAccount(accountId, 50, "Frank Smith");
+        service.withdrawFrom(accountId, 100);
     }
 
     @Test
     public void testWithdrawFrom_singleTx() throws Exception {
         loginAsUser();
         long accountId = createAndValidateAccountFor("Al Smith");
-        makeDepositAndValidateAccount(accountId, 500.00d, "Al Smith");
-        makeWithdrawalAndValidateAccount(accountId, 100.00d, "Al Smith");
-        assertAccount("Al Smith", true, 400.00d, 2, accountId);
+        makeDepositAndValidateAccount(accountId, 500, "Al Smith");
+        makeWithdrawalAndValidateAccount(accountId, 100, "Al Smith");
+        assertAccount("Al Smith", true, 400, 2, accountId);
     }
 
     @Test
     public void testWithdrawFrom_manyTxs() throws Exception {
         loginAsUser();
         long accountId = createAndValidateAccountFor("Zoe Smith");
-        makeDepositAndValidateAccount(accountId, 500.00d, "Zoe Smith");
-        makeWithdrawalAndValidateAccount(accountId, 100.00d, "Zoe Smith");
-        makeWithdrawalAndValidateAccount(accountId, 75.00d, "Zoe Smith");
-        makeWithdrawalAndValidateAccount(accountId, 125.00d, "Zoe Smith");
-        assertAccount("Zoe Smith", true, 200.00d, 4, accountId);
+        makeDepositAndValidateAccount(accountId, 500, "Zoe Smith");
+        makeWithdrawalAndValidateAccount(accountId, 100, "Zoe Smith");
+        makeWithdrawalAndValidateAccount(accountId, 75, "Zoe Smith");
+        makeWithdrawalAndValidateAccount(accountId, 125, "Zoe Smith");
+        assertAccount("Zoe Smith", true, 200, 4, accountId);
     }
 
     @Test
     public void testWithdrawFrom_upToZero() throws Exception {
         loginAsUser();
         long accountId = createAndValidateAccountFor("Zoe Smith");
-        makeDepositAndValidateAccount(accountId, 500.00d, "Zoe Smith");
-        makeWithdrawalAndValidateAccount(accountId, 500.00d, "Zoe Smith");
-        assertAccount("Zoe Smith", true, 0.00d, 2, accountId);
+        makeDepositAndValidateAccount(accountId, 500, "Zoe Smith");
+        makeWithdrawalAndValidateAccount(accountId, 500, "Zoe Smith");
+        assertAccount("Zoe Smith", true, 0, 2, accountId);
     }
 
     @Test
@@ -171,21 +171,21 @@ public class SecureBankServiceTest {
         logoutCurrentSubject();
         loginAsSuperviser();
         double closingBalance = service.closeAccount(accountId);
-        Assert.assertEquals(0.00d, closingBalance);
-        assertAccount("Chris Smith", false, 0.00d, 1, accountId);
+        Assert.assertEquals(0, (int)closingBalance);
+        assertAccount("Chris Smith", false, 0, 1, accountId);
     }
 
     @Test
     public void testCloseAccount_withBalance() throws Exception {
         loginAsUser();
         long accountId = createAndValidateAccountFor("Gerry Smith");
-        makeDepositAndValidateAccount(accountId, 385.00d, "Gerry Smith");
+        makeDepositAndValidateAccount(accountId, 385, "Gerry Smith");
 
         logoutCurrentSubject();
         loginAsSuperviser();
         double closingBalance = service.closeAccount(accountId);
-        Assert.assertEquals(385.00d, closingBalance);
-        assertAccount("Gerry Smith", false, 0.00d, 2, accountId);
+        Assert.assertEquals(385, (int)closingBalance);
+        assertAccount("Gerry Smith", false, 0, 2, accountId);
     }
 
     @Test(expected = InactiveAccountException.class)
@@ -196,8 +196,8 @@ public class SecureBankServiceTest {
         logoutCurrentSubject();
         loginAsSuperviser();
         double closingBalance = service.closeAccount(accountId);
-        Assert.assertEquals(0.00d, closingBalance);
-        assertAccount("Chris Smith", false, 0.00d, 1, accountId);
+        Assert.assertEquals(0, (int)closingBalance);
+        assertAccount("Chris Smith", false, 0, 1, accountId);
         service.closeAccount(accountId);
     }
 
@@ -210,33 +210,33 @@ public class SecureBankServiceTest {
 
     protected long createAndValidateAccountFor(String anOwner) throws 
Exception {
         long createdId = service.createNewAccount(anOwner);
-        assertAccount(anOwner, true, 0.0d, 0, createdId);
+        assertAccount(anOwner, true, 0, 0, createdId);
         return createdId;
     }
 
-    protected double makeDepositAndValidateAccount(long anAccountId, double 
anAmount, String eOwnerName) throws Exception {
+    protected double makeDepositAndValidateAccount(long anAccountId, int 
anAmount, String eOwnerName) throws Exception {
         double previousBalance = service.getBalanceOf(anAccountId);
         int previousTxCount = service.getTxHistoryFor(anAccountId).length;
         double newBalance = service.depositInto(anAccountId, anAmount);
-        Assert.assertEquals(previousBalance + anAmount, newBalance);
-        assertAccount(eOwnerName, true, newBalance, 1 + previousTxCount, 
anAccountId);
+        Assert.assertEquals((int)previousBalance + anAmount, (int)newBalance);
+        assertAccount(eOwnerName, true, (int)newBalance, 1 + previousTxCount, 
anAccountId);
         return newBalance;
     }
 
-    protected double makeWithdrawalAndValidateAccount(long anAccountId, double 
anAmount, String eOwnerName) throws Exception {
+    protected double makeWithdrawalAndValidateAccount(long anAccountId, int 
anAmount, String eOwnerName) throws Exception {
         double previousBalance = service.getBalanceOf(anAccountId);
         int previousTxCount = service.getTxHistoryFor(anAccountId).length;
         double newBalance = service.withdrawFrom(anAccountId, anAmount);
-        Assert.assertEquals(previousBalance - anAmount, newBalance);
-        assertAccount(eOwnerName, true, newBalance, 1 + previousTxCount, 
anAccountId);
+        Assert.assertEquals((int)previousBalance - anAmount, (int)newBalance);
+        assertAccount(eOwnerName, true, (int)newBalance, 1 + previousTxCount, 
anAccountId);
         return newBalance;
     }
 
 
-    public static void assertAccount(String eOwnerName, boolean eIsActive, 
double eBalance, int eTxLogCount, long actualAccountId) throws Exception {
+    public static void assertAccount(String eOwnerName, boolean eIsActive, int 
eBalance, int eTxLogCount, long actualAccountId) throws Exception {
         Assert.assertEquals(eOwnerName, service.getOwnerOf(actualAccountId));
         Assert.assertEquals(eIsActive, 
service.isAccountActive(actualAccountId));
-        Assert.assertEquals(eBalance, service.getBalanceOf(actualAccountId));
+        Assert.assertEquals(eBalance, 
(int)service.getBalanceOf(actualAccountId));
         Assert.assertEquals(eTxLogCount, 
service.getTxHistoryFor(actualAccountId).length);
     }
 }
diff --git 
a/web/src/test/java/org/apache/shiro/web/config/WebIniSecurityManagerFactoryTest.java
 
b/web/src/test/java/org/apache/shiro/web/config/WebIniSecurityManagerFactoryTest.java
index 47370ef..152d788 100644
--- 
a/web/src/test/java/org/apache/shiro/web/config/WebIniSecurityManagerFactoryTest.java
+++ 
b/web/src/test/java/org/apache/shiro/web/config/WebIniSecurityManagerFactoryTest.java
@@ -27,8 +27,8 @@ import org.junit.Test;
 import javax.servlet.Filter;
 import java.util.Map;
 
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertTrue;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 /**
  * TODO - Class JavaDoc
diff --git 
a/web/src/test/java/org/apache/shiro/web/filter/authz/HttpMethodPermissionFilterTest.java
 
b/web/src/test/java/org/apache/shiro/web/filter/authz/HttpMethodPermissionFilterTest.java
index 1737b19..5c1003c 100644
--- 
a/web/src/test/java/org/apache/shiro/web/filter/authz/HttpMethodPermissionFilterTest.java
+++ 
b/web/src/test/java/org/apache/shiro/web/filter/authz/HttpMethodPermissionFilterTest.java
@@ -18,7 +18,7 @@
  */
 package org.apache.shiro.web.filter.authz;
 
-import junit.framework.Assert;
+import org.junit.Assert;
 import org.junit.Test;
 
 

Reply via email to