dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08135
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2421: Changed PdfServiceTest to write to memory rather than file. Same effect as we are only asserting ...
------------------------------------------------------------
revno: 2421
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2010-10-22 17:59:04 +0200
message:
Changed PdfServiceTest to write to memory rather than file. Same effect as we are only asserting that file is not null, a bit ugly to have files written to filesystem during unit testing
modified:
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/pdf/PdfServiceTest.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/pdf/PdfServiceTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/pdf/PdfServiceTest.java 2010-10-22 07:10:17 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/pdf/PdfServiceTest.java 2010-10-22 15:59:04 +0000
@@ -29,8 +29,7 @@
import static org.junit.Assert.assertNotNull;
-import java.io.BufferedOutputStream;
-import java.io.FileOutputStream;
+import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import org.hisp.dhis.DhisSpringTest;
@@ -44,8 +43,7 @@
import org.junit.Test;
/**
- * @author Lars Helge Overland
- * @version $Id$
+ * @author Hieu
*/
public class PdfServiceTest
extends DhisSpringTest
@@ -95,18 +93,21 @@
organisationUnitService.addOrganisationUnit( createOrganisationUnit( 'A' ) );
organisationUnitService.addOrganisationUnit( createOrganisationUnit( 'B' ) );
organisationUnitService.addOrganisationUnit( createOrganisationUnit( 'C' ) );
-
}
// -------------------------------------------------------------------------
// Tests
+ //
+ // Change to
+ // new BufferedOutputStream( new FileOutputStream( "file.pdf" ) )
+ // to verify output visually
// -------------------------------------------------------------------------
@Test
public void testWriteAllDataElements()
throws Exception
{
- OutputStream outputStreamA = new BufferedOutputStream( new FileOutputStream( "dataElementsTest.pdf" ) );
+ OutputStream outputStreamA = new ByteArrayOutputStream();
pdfService.writeAllDataElements( outputStreamA, i18n );
@@ -119,7 +120,7 @@
public void testWriteAllIndicators()
throws Exception
{
- OutputStream outputStreamB = new BufferedOutputStream( new FileOutputStream( "indicatorsTest.pdf" ) );
+ OutputStream outputStreamB = new ByteArrayOutputStream();
pdfService.writeAllIndicators( outputStreamB, i18n );
@@ -132,7 +133,7 @@
public void testWriteAllOrganisationUnits()
throws Exception
{
- OutputStream outputStreamC = new BufferedOutputStream( new FileOutputStream( "organisationUnitsTest.pdf" ) );
+ OutputStream outputStreamC = new ByteArrayOutputStream();
pdfService.writeAllOrganisationUnits( outputStreamC, i18n );