Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.horstmann.violet.product.diagram.deployment;
- import com.horstmann.violet.product.diagram.abstracts.node.INode;
- import com.horstmann.violet.product.diagram.common.PointNode;
- import org.junit.Test;
- import javax.print.Doc;
- import javax.swing.text.Document;
- import java.awt.geom.Point2D;
- import java.awt.geom.Rectangle2D;
- import static org.junit.Assert.*;
- /**
- * Created by Admin on 2016-02-10.
- */
- public class DocumentNodeTest {
- @org.junit.Test
- public void testGetBounds() throws Exception {
- Rectangle2D testObj = new Rectangle2D.Double(0, 0, 80, 60);
- DocumentNode documentNode = new DocumentNode();
- assertEquals(testObj, documentNode.getBounds());
- }
- @org.junit.Test
- public void testLocation() throws Exception {
- DocumentNode documentNode = new DocumentNode();
- for(int x=0; x < 1000; x++)
- for (int y=0; y < 1000; y++)
- {
- documentNode.setLocation(new Point2D.Double(x,y));
- assertEquals(new Point2D.Double(x,y), documentNode.getLocation());
- }
- }
- @org.junit.Test
- public void testAddChild() throws Exception {
- INode[] testChildren = {new DataBase(), new DocumentNode(), new DeviceNode()};
- DocumentNode documentNode = new DocumentNode();
- for (INode child: testChildren) {
- assertFalse(documentNode.addChild(child, new Point2D.Double(0,0)));
- }
- assertTrue(documentNode.addChild(new PointNode(), new Point2D.Double(0,0)));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement