continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From batkin...@apache.org
Subject svn commit: r1677510 - /continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/ViewBuildsReportActionTest.java
Date Mon, 04 May 2015 01:42:59 GMT
Author: batkinson
Date: Mon May  4 01:42:58 2015
New Revision: 1677510

URL: http://svn.apache.org/r1677510
Log:
Patched up broken build reports action test.

Modified:
    continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/ViewBuildsReportActionTest.java

Modified: continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/ViewBuildsReportActionTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/ViewBuildsReportActionTest.java?rev=1677510&r1=1677509&r2=1677510&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/ViewBuildsReportActionTest.java
(original)
+++ continuum/trunk/continuum-webapp/src/test/java/org/apache/continuum/web/action/ViewBuildsReportActionTest.java
Mon May  4 01:42:58 2015
@@ -20,7 +20,6 @@ package org.apache.continuum.web.action;
  */
 
 import com.opensymphony.xwork2.Action;
-import org.apache.commons.io.IOUtils;
 import org.apache.continuum.web.action.stub.ViewBuildsReportActionStub;
 import org.apache.maven.continuum.Continuum;
 import org.apache.maven.continuum.model.project.BuildResult;
@@ -29,6 +28,9 @@ import org.apache.maven.continuum.model.
 import org.junit.Before;
 import org.junit.Test;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
@@ -59,7 +61,6 @@ public class ViewBuildsReportActionTest
     @Test
     public void testInvalidRowCount()
     {
-        action.setRowCount( -1 );
         String result = action.execute();
 
         assertEquals( Action.INPUT, result );
@@ -136,6 +137,12 @@ public class ViewBuildsReportActionTest
 
         when( continuum.getBuildResultsInRange( anyCollection(), any( Date.class ), any(
Date.class ), anyInt(),
                                                 anyString(), anyInt(), anyInt() ) ).thenReturn(
results );
+
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        HttpServletResponse response = mock( HttpServletResponse.class );
+        when( response.getWriter() ).thenReturn( new PrintWriter( out ) );
+
+        action.setServletResponse( response );
         action.setProjectGroupId( 0 );
         action.setBuildStatus( 0 );
         action.setStartDate( "" );
@@ -144,8 +151,8 @@ public class ViewBuildsReportActionTest
 
         String result = action.downloadBuildsReport();
 
-        assertEquals( "send-file", result );
-        assertFileContentsEqual( IOUtils.toString( action.getInputStream() ), cal.getTime().toString()
);
+        assertNull( "result should be null", result );
+        assertFileContentsEqual( out.toString(), cal.getTime().toString() );
     }
 
     private void assertSuccessResult( String result )



Mime
View raw message