1 33 34 72 73 package edu.rice.cs.drjava.model.debug; 74 75 import edu.rice.cs.drjava.DrJavaTestCase; 76 77 81 public final class DebugWatchDataTest extends DrJavaTestCase { 82 83 86 public void testFirstCreation() { 87 DebugWatchData data = new DebugWatchData("foo"); 88 assertEquals("should have a name on startUp", 89 "foo", data.getName()); 90 assertEquals("should have no value on startUp", 91 "", data.getValue()); 92 assertEquals("should have no type on startUp", 93 "", data.getType()); 94 assertTrue("should not be changed on startUp", !data.isChanged()); 95 } 96 97 102 public void testInScopeThenCleared() { 103 DebugWatchData data = new DebugWatchData("foo"); 104 105 data.setValue(new Integer (7)); 107 data.setType("java.lang.Integer"); 108 assertEquals("should have a value", "7", data.getValue()); 109 assertEquals("should have a type", "java.lang.Integer", data.getType()); 110 assertTrue("should be changed", data.isChanged()); 111 112 data.hideValueAndType(); 114 assertEquals("should have no value after hide", 115 "", data.getValue()); 116 assertEquals("should have no type after hide", 117 "", data.getType()); 118 assertTrue("should not be changed after hide", !data.isChanged()); 119 120 data.setValue(new Integer (7)); 122 assertTrue("should not be changed after setting same value", 123 !data.isChanged()); 124 125 data.setValue(new Integer (8)); 127 assertTrue("should be changed after setting different value", 128 data.isChanged()); 129 } 130 131 134 public void testNotInScope() { 135 DebugWatchData data = new DebugWatchData("bar"); 136 data.setNoValue(); 137 data.setNoType(); 138 139 assertEquals("should not be in scope", 140 DebugWatchData.NO_VALUE, data.getValue()); 141 assertEquals("should not have a type", 142 DebugWatchData.NO_TYPE, data.getType()); 143 assertTrue("should not appear changed", !data.isChanged()); 144 } 145 146 147 } | Popular Tags |