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: UT fixes
Date Tue, 30 May 2017 18:21:57 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 9d6ad848a -> bc1576da4


UT fixes


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

Branch: refs/heads/master
Commit: bc1576da487bb948e8fac5858846e2ae146eb1b2
Parents: 9d6ad84
Author: apoorvnaik <apoorvnaik@apache.org>
Authored: Tue May 30 11:20:52 2017 -0700
Committer: apoorvnaik <apoorvnaik@apache.org>
Committed: Tue May 30 11:21:48 2017 -0700

----------------------------------------------------------------------
 .../apache/atlas/services/EntityDiscoveryServiceTest.java |  3 ---
 .../atlas/web/filters/AtlasCSRFPreventionFilterTest.java  | 10 +++++++++-
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/bc1576da/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 7305d7e..f8fb731 100644
--- a/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
@@ -17,7 +17,6 @@
  */
 package org.apache.atlas.services;
 
-import org.apache.atlas.TestModules.TestOnlyModule;
 import org.apache.atlas.discovery.EntityDiscoveryService;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.typedef.AtlasEntityDef;
@@ -25,14 +24,12 @@ 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.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 
-@Guice(modules = TestOnlyModule.class)
 public class EntityDiscoveryServiceTest {
 
     private final String TEST_TYPE                = "test";

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/bc1576da/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 fca2cc5..954364b 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
@@ -24,6 +24,7 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.io.PrintWriter;
 
 import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.verify;
@@ -42,13 +43,15 @@ public class AtlasCSRFPreventionFilterTest {
 
 		// Objects to verify interactions based on request
 		HttpServletResponse mockRes = Mockito.mock(HttpServletResponse.class);
+		PrintWriter mockWriter = Mockito.mock(PrintWriter.class);
+		Mockito.when(mockRes.getWriter()).thenReturn(mockWriter);
 		FilterChain mockChain = Mockito.mock(FilterChain.class);
 
 		// Object under test
 		AtlasCSRFPreventionFilter filter = new AtlasCSRFPreventionFilter();
 		filter.doFilter(mockReq, mockRes, mockChain);
 
-		verify(mockRes, atLeastOnce()).sendError(HttpServletResponse.SC_BAD_REQUEST, EXPECTED_MESSAGE);
+		verify(mockRes, atLeastOnce()).setStatus(HttpServletResponse.SC_BAD_REQUEST);
 		Mockito.verifyZeroInteractions(mockChain);
 	}
 	
@@ -96,6 +99,8 @@ public class AtlasCSRFPreventionFilterTest {
 
 		// Objects to verify interactions based on request
 		HttpServletResponse mockRes = Mockito.mock(HttpServletResponse.class);
+		PrintWriter mockWriter = Mockito.mock(PrintWriter.class);
+		Mockito.when(mockRes.getWriter()).thenReturn(mockWriter);
 		FilterChain mockChain = Mockito.mock(FilterChain.class);
 
 		// Object under test
@@ -137,6 +142,9 @@ public class AtlasCSRFPreventionFilterTest {
 
 		// Objects to verify interactions based on request
 		HttpServletResponse mockRes = Mockito.mock(HttpServletResponse.class);
+		PrintWriter mockWriter = Mockito.mock(PrintWriter.class);
+		Mockito.when(mockRes.getWriter()).thenReturn(mockWriter);
+
 		FilterChain mockChain = Mockito.mock(FilterChain.class);
 
 		// Object under test


Mime
View raw message