Clover coverage report - Maven Clover report
Coverage timestamp: Sun Mar 18 2007 17:43:17 CET
file stats: LOC: 72   Methods: 7
NCLOC: 57   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
TestStructureStreamBuilder.java - 82.4% 85.7% 83.3%
coverage coverage
 1    package com.agical.rdoc.core.model.test.builder;
 2   
 3    import java.io.IOException;
 4    import java.io.ObjectOutputStream;
 5    import java.io.OutputStream;
 6   
 7    import com.agical.rdoc.core.exception.RDocOutputException;
 8    import com.agical.rdoc.core.model.test.TestCaseBuilder;
 9    import com.agical.rdoc.core.model.test.TestStructure;
 10    import com.agical.rdoc.core.model.test.TestSuiteBuilder;
 11    import com.agical.rdoc.core.model.test.TestSuiteFactory;
 12    import com.agical.rdoc.core.model.test.impl.TestCaseImpl;
 13    import com.agical.rdoc.core.model.test.impl.TestStructureImpl;
 14   
 15    public class TestStructureStreamBuilder implements com.agical.rdoc.core.model.test.TestStructureBuilder {
 16    private TestStructure testStructure;
 17    private TestSuite currentRootSuite;
 18    private final OutputStream stream;
 19    private TestSuiteFactory testSuiteFactory = new TestSuiteFactoryImpl();
 20   
 21  9 public TestStructureStreamBuilder(OutputStream stream) {
 22  9 this.stream = stream;
 23    }
 24   
 25  8 public void begin(String name) {
 26  8 testStructure = new TestStructureImpl(name);
 27    }
 28   
 29  9 public TestSuiteBuilder beginSuite(Object suite, String name) {
 30  9 currentRootSuite = testSuiteFactory.create(suite, name);
 31  9 testStructure.addRoot(currentRootSuite);
 32  9 return new TestSuiteBuilderImpl(this, currentRootSuite);
 33    }
 34   
 35  1 public TestCaseBuilder beginTestCase(Class clazz) {
 36  1 return new TestCaseBuilderImpl( new TestCaseImpl( clazz ) );
 37    }
 38   
 39  0 public TestSuiteBuilder endSuite() {
 40  0 return null;
 41    }
 42   
 43  8 public void end() {
 44  8 try {
 45  8 ObjectOutputStream objectOutputStream = new ObjectOutputStream(stream);
 46  8 try {
 47  8 objectOutputStream.writeObject(testStructure);
 48    }
 49    finally {
 50  8 objectOutputStream.close();
 51    }
 52    } catch (IOException e) {
 53  0 throw new RDocOutputException("failed to create the test structure object stream!", stream, e);
 54    }
 55    finally {
 56  8 closeStream();
 57    }
 58    }
 59   
 60  8 private void closeStream() {
 61  8 try {
 62  8 stream.close();
 63    } catch (IOException e) {
 64  0 throw new RDocOutputException("failed to close the test structure stream!", stream, e);
 65    }
 66    }
 67   
 68   
 69   
 70   
 71   
 72    }