atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apoorvn...@apache.org
Subject incubator-atlas git commit: ATLAS-1834: TestNG asserts over JUnit for consistency
Date Fri, 26 May 2017 15:50:59 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master e75984c48 -> 1c3dcc07e


ATLAS-1834: TestNG asserts over JUnit for consistency


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

Branch: refs/heads/master
Commit: 1c3dcc07e6d042a04cb34d06204c5aa511bfb83b
Parents: e75984c
Author: apoorvnaik <apoorvnaik@apache.org>
Authored: Fri May 26 08:49:29 2017 -0700
Committer: apoorvnaik <apoorvnaik@apache.org>
Committed: Fri May 26 08:50:22 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/atlas/AtlasClientTest.java     |  4 ++--
 .../atlas/services/EntityDiscoveryServiceTest.java |  4 ++--
 .../web/filters/AtlasCSRFPreventionFilterTest.java |  7 +++----
 .../atlas/web/security/FileAuthenticationTest.java | 17 +++++++++--------
 .../org/apache/atlas/web/security/UserDaoTest.java | 14 ++++++++------
 5 files changed, 24 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1c3dcc07/client/src/test/java/org/apache/atlas/AtlasClientTest.java
----------------------------------------------------------------------
diff --git a/client/src/test/java/org/apache/atlas/AtlasClientTest.java b/client/src/test/java/org/apache/atlas/AtlasClientTest.java
index 0c78916..4dfd43a 100644
--- a/client/src/test/java/org/apache/atlas/AtlasClientTest.java
+++ b/client/src/test/java/org/apache/atlas/AtlasClientTest.java
@@ -41,15 +41,15 @@ import java.net.URISyntaxException;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
 
 public class AtlasClientTest {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1c3dcc07/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
b/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
index d490083..7305d7e 100644
--- a/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
@@ -28,9 +28,9 @@ import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
 
 @Guice(modules = TestOnlyModule.class)
 public class EntityDiscoveryServiceTest {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1c3dcc07/webapp/src/test/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilterTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilterTest.java
b/webapp/src/test/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilterTest.java
index a742dd5..fca2cc5 100644
--- a/webapp/src/test/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilterTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilterTest.java
@@ -16,15 +16,14 @@
  */
 package org.apache.atlas.web.filters;
 
-import java.io.IOException;
+import org.mockito.Mockito;
+import org.testng.annotations.Test;
 
 import javax.servlet.FilterChain;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
-import org.junit.Test;
-import org.mockito.Mockito;
+import java.io.IOException;
 
 import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.verify;

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1c3dcc07/webapp/src/test/java/org/apache/atlas/web/security/FileAuthenticationTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/security/FileAuthenticationTest.java
b/webapp/src/test/java/org/apache/atlas/web/security/FileAuthenticationTest.java
index 84346ce..fe2060a 100644
--- a/webapp/src/test/java/org/apache/atlas/web/security/FileAuthenticationTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/security/FileAuthenticationTest.java
@@ -22,7 +22,6 @@ import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.web.TestUtils;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.slf4j.Logger;
@@ -42,6 +41,8 @@ import java.io.File;
 import java.util.Collection;
 
 import static org.mockito.Mockito.when;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
 
 public class FileAuthenticationTest {
 
@@ -118,7 +119,7 @@ public class FileAuthenticationTest {
         Authentication auth = authProvider.authenticate(authentication);
         LOG.debug(" {}", auth);
 
-        Assert.assertTrue(auth.isAuthenticated());
+        assertTrue(auth.isAuthenticated());
     }
 
     @Test
@@ -131,7 +132,7 @@ public class FileAuthenticationTest {
             Authentication auth = authProvider.authenticate(authentication);
            LOG.debug(" {}", auth);
         } catch (BadCredentialsException bcExp) {
-            Assert.assertEquals("Wrong password", bcExp.getMessage());
+            assertEquals("Wrong password", bcExp.getMessage());
         }
     }
 
@@ -144,7 +145,7 @@ public class FileAuthenticationTest {
             Authentication auth = authProvider.authenticate(authentication);
           LOG.debug(" {}", auth);
         } catch (UsernameNotFoundException uExp) {
-            Assert.assertTrue(uExp.getMessage().contains("Username not found."));
+            assertTrue(uExp.getMessage().contains("Username not found."));
         }
     }
 
@@ -157,7 +158,7 @@ public class FileAuthenticationTest {
             Authentication auth = authProvider.authenticate(authentication);
             LOG.debug(" {}", auth);
         } catch (AtlasAuthenticationException uExp) {
-            Assert.assertTrue(uExp.getMessage().startsWith("User role credentials is not
set properly for"));
+            assertTrue(uExp.getMessage().startsWith("User role credentials is not set properly
for"));
         }
     }
 
@@ -171,7 +172,7 @@ public class FileAuthenticationTest {
             Authentication auth = authProvider.authenticate(authentication);
             LOG.debug(" {}", auth);
         } catch (UsernameNotFoundException uExp) {
-            Assert.assertTrue(uExp.getMessage().startsWith("Username not found"));
+            assertTrue(uExp.getMessage().startsWith("Username not found"));
         }
     }
 
@@ -184,7 +185,7 @@ public class FileAuthenticationTest {
         Authentication auth = authProvider.authenticate(authentication);
         LOG.debug(" {}", auth);
 
-        Assert.assertTrue(auth.isAuthenticated());
+        assertTrue(auth.isAuthenticated());
 
         Collection<? extends GrantedAuthority> authorities = auth.getAuthorities();
 
@@ -192,7 +193,7 @@ public class FileAuthenticationTest {
         for (GrantedAuthority gauth : authorities) {
             role = gauth.getAuthority();
         }
-        Assert.assertTrue("ADMIN".equals(role));
+        assertTrue("ADMIN".equals(role));
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1c3dcc07/webapp/src/test/java/org/apache/atlas/web/security/UserDaoTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/security/UserDaoTest.java b/webapp/src/test/java/org/apache/atlas/web/security/UserDaoTest.java
index 2648ca7..519be80 100644
--- a/webapp/src/test/java/org/apache/atlas/web/security/UserDaoTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/security/UserDaoTest.java
@@ -16,15 +16,17 @@
  */
 package org.apache.atlas.web.security;
 
-import java.util.Collection;
-import java.util.Properties;
 import org.apache.atlas.web.dao.UserDao;
 import org.apache.atlas.web.model.User;
-import org.junit.Assert;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import org.testng.annotations.Test;
 
+import java.util.Collection;
+import java.util.Properties;
+
+import static org.testng.Assert.assertTrue;
+
 public class UserDaoTest {
 
     @Test
@@ -36,14 +38,14 @@ public class UserDaoTest {
         UserDao user = new UserDao();
         user.setUserLogins(userLogins);
         User userBean = user.loadUserByUsername("admin");
-        Assert.assertTrue(userBean.getPassword().equals("admin123"));
+        assertTrue(userBean.getPassword().equals("admin123"));
 
         Collection<? extends GrantedAuthority> authorities = userBean.getAuthorities();
         String role = "";
         for (GrantedAuthority gauth : authorities) {
             role = gauth.getAuthority();
         }
-        Assert.assertTrue("ADMIN".equals(role));
+        assertTrue("ADMIN".equals(role));
     }
 
     @Test
@@ -60,7 +62,7 @@ public class UserDaoTest {
         } catch (UsernameNotFoundException uex) {
             hadException = true;
         }
-        Assert.assertTrue(hadException);
+        assertTrue(hadException);
     }
 
 }
\ No newline at end of file


Mime
View raw message