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:54:25 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/0.8-incubating 438925ed0 -> ca9a71493


ATLAS-1834: TestNG asserts over JUnit for consistency

(cherry picked from commit 1c3dcc0)


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

Branch: refs/heads/0.8-incubating
Commit: ca9a71493f009e142051852b3e1f2d8b03419c00
Parents: 438925e
Author: apoorvnaik <apoorvnaik@apache.org>
Authored: Fri May 26 08:49:29 2017 -0700
Committer: apoorvnaik <apoorvnaik@apache.org>
Committed: Fri May 26 08:54:19 2017 -0700

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


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ca9a7149/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 56c4ae6..553493c 100644
--- a/client/src/test/java/org/apache/atlas/AtlasClientTest.java
+++ b/client/src/test/java/org/apache/atlas/AtlasClientTest.java
@@ -21,7 +21,6 @@ import com.sun.jersey.api.client.Client;
 import com.sun.jersey.api.client.ClientHandlerException;
 import com.sun.jersey.api.client.ClientResponse;
 import com.sun.jersey.api.client.WebResource;
-
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.json.InstanceSerialization;
 import org.apache.commons.configuration.Configuration;
@@ -33,17 +32,14 @@ import org.mockito.MockitoAnnotations;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
 import java.net.ConnectException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.Arrays;
 import java.util.List;
 
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-
-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;
@@ -51,6 +47,8 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.fail;
 
 public class AtlasClientTest {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ca9a7149/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 81dbcef..f8fb731 100644
--- a/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
@@ -24,13 +24,11 @@ import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.commons.lang.StringUtils;
 import org.powermock.reflect.Whitebox;
 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;
 
 public class EntityDiscoveryServiceTest {
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ca9a7149/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/ca9a7149/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 c5cd3f6..254190b 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
@@ -24,7 +24,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.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -40,6 +39,8 @@ import org.mockito.MockitoAnnotations;
 import org.testng.annotations.BeforeMethod;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import static org.mockito.Mockito.when;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
 
 public class FileAuthenticationTest {
 
@@ -116,7 +117,7 @@ public class FileAuthenticationTest {
         Authentication auth = authProvider.authenticate(authentication);
         LOG.debug(" {}", auth);
 
-        Assert.assertTrue(auth.isAuthenticated());
+        assertTrue(auth.isAuthenticated());
     }
 
     @Test
@@ -129,7 +130,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());
         }
     }
 
@@ -142,7 +143,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."));
         }
     }
 
@@ -155,7 +156,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"));
         }
     }
 
@@ -169,7 +170,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"));
         }
     }
 
@@ -182,7 +183,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();
 
@@ -190,7 +191,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/ca9a7149/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