package org.enoir.graphvizapi.test;

/**
 * Created by frank on 2014/11/21.
 */
public class TestGraphviz {

    


}

@@ -34,85 +34,1741 @@
 t;%0A%0A
-/**%0A * Created by frank on 2014/11/21.%0A */%0Apublic class TestGraphviz %7B%0A%0A    %0A
+import org.enoir.graphvizapi.*;%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0A%0Aimport java.io.File;%0Aimport java.security.MessageDigest;%0Aimport java.security.NoSuchAlgorithmException;%0A%0A/**%0A * Created by frank on 2014/11/21.%0A */%0Apublic class TestGraphviz %7B%0A%0A    @Test%0A    public void testGenImage() %7B%0A        Graphviz gz = new Graphviz(%22/usr/bin/dot%22,%22./%22);%0A                Graph graph = new Graph(%22g1%22, GraphType.DIGRAPH);%0A        graph.addAttributes(new Attributes(  %22rankdir%22,%22LR%22));%0A        Node n1 = new Node(%22N%22);%0A        n1.addAttributes(new Attributes(%22label%22,%22%5C%22 Node1 %5C%22%22));%0A        Node n2 = new Node(%22N2%22);%0A        Node n3 = new Node(%22N3%22);%0A%0A        graph.addNode(n1);%0A        graph.addNode(n2);%0A        graph.addNode(n3);%0A        graph.addEdge(new Edge(%22%22, n1, n2));%0A        graph.addEdge(new Edge(%22%22, n2, n3));%0A        graph.addEdge(new Edge(%22%22,n3,n1));%0A%0A        String type = %22png%22;%0A        byte%5B%5D bytearray = gz.getGraphByteArray(graph, type, %22100%22);%0A        String md5str = getByteArrayMd5(bytearray);%0A        Assert.assertEquals(md5str,%22ee8629a6a222af4601d506d005dade81%22);%0A    %7D%0A%0A    private String getByteArrayMd5(byte%5B%5D bytes)%7B%0A        String ret = null;%0A        try %7B%0A            MessageDigest md = MessageDigest.getInstance(%22MD5%22);%0A            md.update(bytes);%0A            ret = getChecksumString(md.digest());%0A        %7D catch (NoSuchAlgorithmException e) %7B%0A            e.printStackTrace();%0A            return null;%0A        %7D%0A        return ret;%0A    %7D%0A%0A    private String getChecksumString(byte%5B%5D mdbyte)%7B%0A        String result = %22%22;%0A        for (int i=0; i %3C mdbyte.length; i++) %7B%0A            result += Integer.toString( ( mdbyte%5Bi%5D & 0xff ) + 0x100, 16).substring( 1 );%0A        %7D%0A        return result;%0A    %7D
 %0A%0A%7D%0A

Add Sample Test .