Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.54 KB | None | 0 0
  1. package com.horstmann.violet.product.diagram.deployment;
  2.  
  3. import com.horstmann.violet.product.diagram.abstracts.node.INode;
  4. import com.horstmann.violet.product.diagram.common.PointNode;
  5. import org.junit.Test;
  6.  
  7. import javax.print.Doc;
  8. import javax.swing.text.Document;
  9. import java.awt.geom.Point2D;
  10. import java.awt.geom.Rectangle2D;
  11.  
  12. import static org.junit.Assert.*;
  13.  
  14. /**
  15.  * Created by Admin on 2016-02-10.
  16.  */
  17. public class DocumentNodeTest {
  18.  
  19.     @org.junit.Test
  20.     public void testGetBounds() throws Exception {
  21.         Rectangle2D testObj = new Rectangle2D.Double(0, 0, 80, 60);
  22.         DocumentNode documentNode = new DocumentNode();
  23.         assertEquals(testObj, documentNode.getBounds());
  24.     }
  25.  
  26.     @org.junit.Test
  27.     public void testLocation() throws Exception {
  28.         DocumentNode documentNode = new DocumentNode();
  29.  
  30.         for(int x=0; x < 1000; x++)
  31.             for (int y=0; y < 1000; y++)
  32.             {
  33.                 documentNode.setLocation(new Point2D.Double(x,y));
  34.                 assertEquals(new Point2D.Double(x,y), documentNode.getLocation());
  35.             }
  36.     }
  37.  
  38.     @org.junit.Test
  39.     public void testAddChild() throws Exception {
  40.         INode[] testChildren = {new DataBase(), new DocumentNode(), new DeviceNode()};
  41.         DocumentNode documentNode = new DocumentNode();
  42.  
  43.         for (INode child: testChildren) {
  44.             assertFalse(documentNode.addChild(child, new Point2D.Double(0,0)));
  45.         }
  46.  
  47.         assertTrue(documentNode.addChild(new PointNode(), new Point2D.Double(0,0)));
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement