package hudson.plugins.cobertura.targets;

import junit.framework.TestCase;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

/**
 * Created by IntelliJ IDEA.
 * User: stephen
 * Date: 21-Oct-2007
 * Time: 18:01:31
 * To change this template use File | Settings | File Templates.
 */
public class CoveragePaintTest extends TestCase {

    public CoveragePaintTest(String string) {
        super(string);
    }

    public void testSerializable() throws Exception {
        CoveragePaint instance = new CoveragePaint(CoverageElement.JAVA_FILE);
        instance.paint(5, 7, 4, 5);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(bos);
        oos.writeObject(instance);
        oos.flush();
        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bis);
        CoveragePaint copy = (CoveragePaint) ois.readObject();
        assertEquals(instance.getLineCoverage(), copy.getLineCoverage());
        assertEquals(instance.getConditionalCoverage(), copy.getConditionalCoverage());
    }
}

@@ -500,16 +500,368 @@
 %0A    %7D%0A%0A
+    public void testTotalLines() %7B%0A        CoveragePaint instance = new CoveragePaint(CoverageElement.JAVA_FILE);%0A        assertEquals(0, instance.getTotalLines());%0A        instance.setTotalLines(451);%0A        assertEquals(451, instance.getTotalLines());%0A        instance.setTotalLines(179);%0A        assertEquals(179, instance.getTotalLines());%0A    %7D%0A%0A
     publ
@@ -906,16 +906,16 @@
 ption %7B%0A
-
         
@@ -1021,16 +1021,53 @@
  4, 5);%0A
+        instance.setTotalLines(314);%0A
         
@@ -1514,24 +1514,24 @@
 overage());%0A
-
         asse
@@ -1602,20 +1602,69 @@
 overage());%0A
+        assertEquals(314, copy.getTotalLines());%0A
     %7D%0A%7D%0A

Add a test and some asserts to coverage paint total lines