mardi 28 mars 2017

JaCoCo Tests Not working (Ant task or JaCoCo Agent failed)

this is my test class. the problem i am having is when i try to run the code with Test with JaCoCoverage im getting a bug. Bug window anyone know how to solve this bug? im using netbeans 8.2 and JaCoCo 0.7.5

public class HuffmanTests {

    private long start, end;
    private Map map, map2;
    private Node node;

    public HuffmanTests() {
    }

    @Before
    public void setUp() {
        map = Operations.getInstance().getFrequentieOperator().getCharFrequency("Hallo");
        node = Operations.getInstance().getTreeOperator().buildTree(map);
        map2 = Operations.getInstance().getCodeOperator().generateCodes(node);
    }

    @Test
    public void frequentieTest() throws Exception {
        start = System.currentTimeMillis();
        Map m = Operations.getInstance().getFrequentieOperator().getCharFrequency("Hallo");
        end = System.currentTimeMillis();
        System.out.println(end-start);
        assertEquals(4, m.size());   
    }

    @Test
    public void buildTreeTest() throws Exception {
        start = System.currentTimeMillis();
        Node n = Operations.getInstance().getTreeOperator().buildTree(map);
        end = System.currentTimeMillis();
        System.out.println(end-start);
        assertEquals(4, n.frequency);   
    }

    @Test
    public void generateCodeTest() throws Exception {
        start = System.currentTimeMillis();
        Map m = Operations.getInstance().getCodeOperator().generateCodes(node);
        end = System.currentTimeMillis();
        System.out.println(end-start);
        assertEquals(4, m.size());   
    }

    @Test
    public void encodeMessageTest() throws Exception {
        start = System.currentTimeMillis();
        String s = Operations.getInstance().getCodeOperator().encodeMessage(map2, "Hallo");
        end = System.currentTimeMillis();
        System.out.println(end-start);
        assertEquals(s, "1011000111");

    }

    @Test
    public void testHuffman() throws Exception {
        start = System.currentTimeMillis();
        Operations.getInstance().getHuffmanOperator().compress("some");
        end = System.currentTimeMillis();
        System.out.println(end-start);
        assertEquals("some", Operations.getInstance().getHuffmanOperator().expand());
    }

    @Test
    public void testOddNumberOfCharacters() throws Exception {
        start = System.currentTimeMillis();
        Operations.getInstance().getHuffmanOperator().compress("someday");
        end = System.currentTimeMillis();
        System.out.println(end-start);
        assertEquals("someday", Operations.getInstance().getHuffmanOperator().expand()); 
    }

    @Test
    public void testRepeatingEvenNumberOfCharactersAndSpaceAndNonAsciiCharacters() throws Exception {
        start = System.currentTimeMillis();
        Operations.getInstance().getHuffmanOperator().compress("some some#");
        end = System.currentTimeMillis();
        System.out.println(end-start);
        assertEquals("some some#", Operations.getInstance().getHuffmanOperator().expand());
    }

    @Test
    public void testOddNumberOfCharactersAndSpaceAndNonAscii() throws Exception {
        start = System.currentTimeMillis();
        Operations.getInstance().getHuffmanOperator().compress("someday someday&");
        end = System.currentTimeMillis();
        System.out.println(end-start);
        assertEquals("someday someday&", Operations.getInstance().getHuffmanOperator().expand());
    }
}

Aucun commentaire:

Enregistrer un commentaire