1 29 30 package nextapp.echo2.app.test; 31 32 import nextapp.echo2.app.Border; 33 import nextapp.echo2.app.Color; 34 import nextapp.echo2.app.Extent; 35 import junit.framework.TestCase; 36 37 41 public class BorderTest extends TestCase { 42 43 46 public void testConstructor() { 47 Border border = new Border(new Extent(5, Extent.PX), Color.BLUE, Border.STYLE_OUTSET); 48 assertEquals(new Extent(5, Extent.PX), border.getSize()); 49 assertEquals(Color.BLUE, border.getColor()); 50 assertEquals(Border.STYLE_OUTSET, border.getStyle()); 51 } 52 53 56 public void testEquals() { 57 Border border1 = new Border(new Extent(5, Extent.PX), Color.BLUE, Border.STYLE_OUTSET); 58 Border border2 = new Border(new Extent(5, Extent.PX), Color.BLUE, Border.STYLE_OUTSET); 59 Border border3 = new Border(new Extent(5, Extent.PX), Color.GREEN, Border.STYLE_OUTSET); 60 Border border4 = new Border(new Extent(5, Extent.PX), Color.BLUE, Border.STYLE_INSET); 61 Border border5 = new Border(new Extent(4, Extent.PX), Color.BLUE, Border.STYLE_OUTSET); 62 Border border6 = new Border(new Extent(5, Extent.PX), null, Border.STYLE_OUTSET); 63 Border border7 = new Border(null, Color.BLUE, Border.STYLE_INSET); 64 assertTrue(border1.equals(border1)); 65 assertTrue(border1.equals(border2)); 66 assertFalse(border1.equals(border3)); 67 assertFalse(border1.equals(border4)); 68 assertFalse(border1.equals(border5)); 69 assertFalse(border1.equals(border6)); 70 assertFalse(border1.equals(border7)); 71 assertFalse(border1.equals(null)); 72 assertFalse(border2.equals(border3)); 73 assertFalse(border2.equals(border4)); 74 assertFalse(border2.equals(border5)); 75 assertFalse(border2.equals(border6)); 76 assertFalse(border2.equals(border7)); 77 assertFalse(border3.equals(border4)); 78 assertFalse(border3.equals(border5)); 79 assertFalse(border3.equals(border6)); 80 assertFalse(border3.equals(border7)); 81 assertFalse(border4.equals(border3)); 82 assertFalse(border4.equals(border5)); 83 assertFalse(border4.equals(border6)); 84 assertFalse(border4.equals(border7)); 85 } 86 } 87 | Popular Tags |