package guru.nidi.graphviz.engine;

import guru.nidi.graphviz.model.Graph;
import org.junit.Test;

import static guru.nidi.graphviz.model.Factory.graph;
import static guru.nidi.graphviz.model.Factory.node;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;


public class GraphvizTest {

    @Test
    public void scaleMethodChainCheck(){
        final Graph graph = graph().with(node("a").link("b"));

        final Graphviz graphviz = Graphviz.fromGraph(graph).height(20).width(30).scale(3);

        assertThat(graphviz.width, is(30) );
        assertThat(graphviz.height, is(20) );
        assertThat(graphviz.scale, is(3d ));
    }

    @Test
    public void heightMethodChainCheck(){
        final Graph graph = graph().with(node("a").link("b"));

        final Graphviz graphviz = Graphviz.fromGraph(graph).scale(3).width(30).height(20);

        assertThat(graphviz.width, is(30) );
        assertThat(graphviz.height, is(20) );
        assertThat(graphviz.scale, is(3d ));
    }

    @Test
    public void widthMethodChainCheck(){
        final Graph graph = graph().with(node("a").link("b"));

        final Graphviz graphviz = Graphviz.fromGraph(graph).scale(3).height(20).width(30);

        assertThat(graphviz.width, is(30) );
        assertThat(graphviz.height, is(20) );
        assertThat(graphviz.scale, is(3d ));
    }
}
@@ -1,100 +1,663 @@
-package guru.nidi.graphviz.engine;%0A%0Aimport guru.nidi.graphviz.model.Graph;%0Aimport org.junit.Test
+/*%0A * Copyright (C) 2015 Stefan Niederhauser (nidin@gmx.ch)%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *         http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage guru.nidi.graphviz.engine
 ;%0A%0Ai
@@ -836,11 +836,82 @@
 ert.
-*;%0A
+assertThat;%0A%0Aimport guru.nidi.graphviz.model.Graph;%0Aimport org.junit.Test;
 %0A%0Apu
@@ -1166,123 +1166,46 @@
 That
-(g
+G
 raphviz
-.width, is(30) );%0A        assertThat(graphviz.height, is(20) );%0A        assertThat(graphviz.scale, is(3d )
+HasFields(graphviz, 20, 30, 3d
 );%0A 
@@ -1440,123 +1440,46 @@
 That
-(g
+G
 raphviz
-.width, is(30) );%0A        assertThat(graphviz.height, is(20) );%0A        assertThat(graphviz.scale, is(3d )
+HasFields(graphviz, 20, 30, 3d
 );%0A 
@@ -1687,24 +1687,218 @@
 width(30);%0A%0A
+        assertThatGraphvizHasFields(graphviz, 20, 30, 3d);%0A    %7D%0A%0A    private void assertThatGraphvizHasFields(Graphviz graphviz, int expectedHeight, int expectedWidth, double expectedScale ) %7B%0A
         asse
@@ -1923,18 +1923,29 @@
 dth, is(
-30
+expectedWidth
 ) );%0A   
@@ -1980,18 +1980,30 @@
 ght, is(
-20
+expectedHeight
 ) );%0A   
@@ -2037,18 +2037,29 @@
 ale, is(
-3d
+expectedScale
  ));%0A   

fix code analyse issues