Changeset 547 for trunk/quest-core-events-test
- Timestamp:
- 08/16/12 12:34:24 (12 years ago)
- Location:
- trunk/quest-core-events-test
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-core-events-test/pom.xml
r506 r547 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 2 <modelVersion>4.0.0</modelVersion> 3 <groupId>de.ugoe.cs.quest</groupId> 4 <artifactId>quest-core-events-test</artifactId> 5 <version>0.0.1-SNAPSHOT</version> 6 <name>quest-core-events-test</name> 7 <scm> 8 <url>https://quest.informatik.uni-goettingen.de/svn/quest/trunk/quest-core-events-test</url> 9 </scm> 10 <dependencies> 11 <dependency> 12 <groupId>de.ugoe.cs.quest</groupId> 13 <artifactId>quest-core-events</artifactId> 14 <version>0.0.1-SNAPSHOT</version> 15 <scope>test</scope> 16 </dependency> 17 <dependency> 18 <groupId>junit</groupId> 19 <artifactId>junit</artifactId> 20 <version>4.8.1</version> 21 <scope>test</scope> 22 </dependency> 23 <dependency> 24 <groupId>junit-addons</groupId> 25 <artifactId>junit-addons</artifactId> 26 <version>1.4</version> 27 </dependency> 28 <dependency> 29 <groupId>nl.jqno.equalsverifier</groupId> 30 <artifactId>equalsverifier</artifactId> 31 <version>1.1.3</version> 32 </dependency> 33 </dependencies> 34 <build> 35 <pluginManagement> 36 <plugins> 37 <plugin> 38 <groupId>org.eclipse.m2e</groupId> 39 <artifactId>lifecycle-mapping</artifactId> 40 <version>1.0.0</version> 41 <configuration> 42 <lifecycleMappingMetadata> 43 <pluginExecutions> 44 <pluginExecution> 45 <pluginExecutionFilter> 46 <groupId>org.apache.maven.plugins</groupId> 47 <artifactId>maven-dependency-plugin</artifactId> 48 <versionRange>[1.0.0,)</versionRange> 49 <goals> 50 <goal>unpack</goal> 51 </goals> 52 </pluginExecutionFilter> 53 <action> 54 <ignore/> 55 </action> 56 </pluginExecution> 57 <pluginExecution> 58 <pluginExecutionFilter> 59 <groupId>org.codehaus.mojo</groupId> 60 <artifactId>emma-maven-plugin</artifactId> 61 <versionRange>[1.0-alpha-3,)</versionRange> 62 <goals> 63 <goal>emma</goal> 64 </goals> 65 </pluginExecutionFilter> 66 <action> 67 <ignore/> 68 </action> 69 </pluginExecution> 70 </pluginExecutions> 71 </lifecycleMappingMetadata> 72 </configuration> 73 </plugin> 74 </plugins> 75 </pluginManagement> 76 <plugins> 77 <plugin> 78 <groupId>org.apache.maven.plugins</groupId> 79 <artifactId>maven-compiler-plugin</artifactId> 80 <version>2.3.2</version> 81 <configuration> 82 <source>1.6</source> 83 <target>1.6</target> 84 </configuration> 85 </plugin> 86 <plugin> 87 <groupId>org.apache.maven.plugins</groupId> 88 <artifactId>maven-dependency-plugin</artifactId> 89 <version>2.4</version> 90 <executions> 91 <execution> 92 <id>unpack</id> 93 <phase>process-classes</phase> 94 <goals> 95 <goal>unpack</goal> 96 </goals> 97 <configuration> 98 <artifactItems> 99 <artifactItem> 100 <groupId>de.ugoe.cs.quest</groupId> 101 <artifactId>quest-core-events</artifactId> 102 <version>0.0.1-SNAPSHOT</version> 103 <outputDirectory>${project.build.directory}/classes</outputDirectory> 104 </artifactItem> 105 </artifactItems> 106 </configuration> 107 </execution> 108 </executions> 109 </plugin> 110 <plugin> 111 <groupId>org.codehaus.mojo</groupId> 112 <artifactId>emma-maven-plugin</artifactId> 113 <version>1.0-alpha-3</version> 114 <inherited>true</inherited> 115 <executions> 116 <execution> 117 <phase>process-classes</phase> 118 <goals> 119 <goal>emma</goal> 120 </goals> 121 </execution> 122 </executions> 123 </plugin> 124 <plugin> 125 <groupId>org.apache.maven.plugins</groupId> 126 <artifactId>maven-jar-plugin</artifactId> 127 <version>2.3.2</version> 128 <executions> 129 <execution> 130 <goals> 131 <goal>test-jar</goal> 132 </goals> 133 </execution> 134 </executions> 135 </plugin> 136 </plugins> 137 </build> 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 3 <modelVersion>4.0.0</modelVersion> 4 <groupId>de.ugoe.cs.quest</groupId> 5 <artifactId>quest-core-events-test</artifactId> 6 <version>0.0.1-SNAPSHOT</version> 7 <name>quest-core-events-test</name> 8 <scm> 9 <url>https://quest.informatik.uni-goettingen.de/svn/quest/trunk/quest-core-events-test</url> 10 </scm> 11 <dependencies> 12 <dependency> 13 <groupId>de.ugoe.cs.quest</groupId> 14 <artifactId>quest-core-events</artifactId> 15 <version>0.0.1-SNAPSHOT</version> 16 <scope>test</scope> 17 </dependency> 18 <dependency> 19 <groupId>junit</groupId> 20 <artifactId>junit</artifactId> 21 <version>4.8.1</version> 22 <scope>test</scope> 23 </dependency> 24 <dependency> 25 <groupId>junit-addons</groupId> 26 <artifactId>junit-addons</artifactId> 27 <version>1.4</version> 28 </dependency> 29 <dependency> 30 <groupId>nl.jqno.equalsverifier</groupId> 31 <artifactId>equalsverifier</artifactId> 32 <version>1.1.3</version> 33 </dependency> 34 <dependency> 35 <groupId>org.mockito</groupId> 36 <artifactId>mockito-core</artifactId> 37 <version>1.9.0</version> 38 <scope>test</scope> 39 </dependency> 40 </dependencies> 41 <build> 42 <pluginManagement> 43 <plugins> 44 <plugin> 45 <groupId>org.eclipse.m2e</groupId> 46 <artifactId>lifecycle-mapping</artifactId> 47 <version>1.0.0</version> 48 <configuration> 49 <lifecycleMappingMetadata> 50 <pluginExecutions> 51 <pluginExecution> 52 <pluginExecutionFilter> 53 <groupId>org.apache.maven.plugins</groupId> 54 <artifactId>maven-dependency-plugin</artifactId> 55 <versionRange>[1.0.0,)</versionRange> 56 <goals> 57 <goal>unpack</goal> 58 </goals> 59 </pluginExecutionFilter> 60 <action> 61 <ignore /> 62 </action> 63 </pluginExecution> 64 <pluginExecution> 65 <pluginExecutionFilter> 66 <groupId>org.codehaus.mojo</groupId> 67 <artifactId>emma-maven-plugin</artifactId> 68 <versionRange>[1.0-alpha-3,)</versionRange> 69 <goals> 70 <goal>emma</goal> 71 </goals> 72 </pluginExecutionFilter> 73 <action> 74 <ignore /> 75 </action> 76 </pluginExecution> 77 </pluginExecutions> 78 </lifecycleMappingMetadata> 79 </configuration> 80 </plugin> 81 </plugins> 82 </pluginManagement> 83 <plugins> 84 <plugin> 85 <groupId>org.apache.maven.plugins</groupId> 86 <artifactId>maven-compiler-plugin</artifactId> 87 <version>2.3.2</version> 88 <configuration> 89 <source>1.6</source> 90 <target>1.6</target> 91 </configuration> 92 </plugin> 93 <plugin> 94 <groupId>org.apache.maven.plugins</groupId> 95 <artifactId>maven-dependency-plugin</artifactId> 96 <version>2.4</version> 97 <executions> 98 <execution> 99 <id>unpack</id> 100 <phase>process-classes</phase> 101 <goals> 102 <goal>unpack</goal> 103 </goals> 104 <configuration> 105 <artifactItems> 106 <artifactItem> 107 <groupId>de.ugoe.cs.quest</groupId> 108 <artifactId>quest-core-events</artifactId> 109 <version>0.0.1-SNAPSHOT</version> 110 <outputDirectory>${project.build.directory}/classes</outputDirectory> 111 </artifactItem> 112 </artifactItems> 113 </configuration> 114 </execution> 115 </executions> 116 </plugin> 117 <plugin> 118 <groupId>org.codehaus.mojo</groupId> 119 <artifactId>emma-maven-plugin</artifactId> 120 <version>1.0-alpha-3</version> 121 <inherited>true</inherited> 122 <executions> 123 <execution> 124 <phase>process-classes</phase> 125 <goals> 126 <goal>emma</goal> 127 </goals> 128 </execution> 129 </executions> 130 </plugin> 131 <plugin> 132 <groupId>org.apache.maven.plugins</groupId> 133 <artifactId>maven-jar-plugin</artifactId> 134 <version>2.3.2</version> 135 <executions> 136 <execution> 137 <goals> 138 <goal>test-jar</goal> 139 </goals> 140 </execution> 141 </executions> 142 </plugin> 143 </plugins> 144 </build> 138 145 </project> -
trunk/quest-core-events-test/src/test/java/de/ugoe/cs/quest/SequenceInstanceOfTest.java
r481 r547 25 25 @Test 26 26 public void TestIsCollectionOfSequences_1() throws Exception { 27 Collection<List< ? extends Event<?>>> sequences = new LinkedList<List<? extends Event<?>>>();28 List<Event <?>> sequence1 = new ArrayList<Event<?>>();27 Collection<List<Event>> sequences = new LinkedList<List<Event>>(); 28 List<Event> sequence1 = new ArrayList<Event>(); 29 29 sequence1.add(new Event<String>("a")); 30 30 sequences.add(sequence1); … … 36 36 @Test 37 37 public void TestIsCollectionOfSequences_2() throws Exception { 38 Collection<List< ? extends Event<?>>> sequences = new LinkedList<List<? extends Event<?>>>();39 List<Event <?>> sequence1 = new ArrayList<Event<?>>();38 Collection<List<Event>> sequences = new LinkedList<List<Event>>(); 39 List<Event> sequence1 = new ArrayList<Event>(); 40 40 sequences.add(sequence1); 41 41 … … 46 46 @Test 47 47 public void TestIsCollectionOfSequences_3() throws Exception { 48 Collection<List< ? extends Event<?>>> sequences = new LinkedList<List<? extends Event<?>>>();48 Collection<List<Event>> sequences = new LinkedList<List<Event>>(); 49 49 50 50 boolean result = SequenceInstanceOf.isCollectionOfSequences(sequences); … … 66 66 @Test 67 67 public void TestIsEventSequence_1() throws Exception { 68 List<Event <?>> sequence = new ArrayList<Event<?>>();68 List<Event> sequence = new ArrayList<Event>(); 69 69 sequence.add(new Event<String>("a")); 70 70 … … 75 75 @Test 76 76 public void TestIsEventSequence_2() throws Exception { 77 List<Event <?>> sequence = new ArrayList<Event<?>>();77 List<Event> sequence = new ArrayList<Event>(); 78 78 79 79 boolean result = SequenceInstanceOf.isEventSequence(sequence); -
trunk/quest-core-events-test/src/test/java/de/ugoe/cs/quest/eventcore/EventTest.java
r481 r547 1 1 2 package de.ugoe.cs.quest.eventcore; 2 3 3 import nl.jqno.equalsverifier.EqualsVerifier;4 import nl.jqno.equalsverifier.Warning;5 4 6 5 import org.junit.*; 7 6 8 7 import de.ugoe.cs.quest.eventcore.Event; 9 import de.ugoe.cs.quest.eventcore.ReplayableEvent;10 8 11 9 import static org.junit.Assert.*; 10 import static org.mockito.Mockito.*; 12 11 13 12 /** 14 * The class <code>EventTest</code> contains tests for the class 15 * <code>{@link Event}</code>. 13 * The class <code>EventTest</code> contains tests for the class <code>{@link Event}</code>. 16 14 * 17 15 * @author Steffen Herbold … … 20 18 public class EventTest { 21 19 22 @Test 23 public void testEvent_1() throws Exception { 24 String type = "typeString"; 25 26 Event<String> result = new Event<String>(type); 27 28 assertNotNull(result); 29 assertEquals(type, result.type); 30 assertNull(result.target); 31 assertNull(result.targetShort); 32 assertEquals("", result.idInfo); 33 } 34 35 @Test(expected = java.security.InvalidParameterException.class) 36 public void testEvent_2() throws Exception { 37 new Event<String>(null); 38 } 39 40 @Test 41 public void testEquals_1() throws Exception { 42 String type1 = "typeString"; 43 String type2 = "typeString"; 44 Event<String> fixture = new Event<String>(type1); 45 Event<String> other = new Event<String>(type2); 46 47 boolean result = fixture.equals(other); 48 49 assertTrue(result); 50 } 51 52 @Test 53 public void testEquals_2() throws Exception { 54 String type1 = "typeString1"; 55 String type2 = "typeString2"; 56 Event<String> fixture = new Event<String>(type1); 57 Event<String> other = new Event<String>(type2); 58 59 boolean result = fixture.equals(other); 60 61 assertFalse(result); 62 } 63 64 @Test 65 public void testEquals_3() throws Exception { 66 String type1 = "typeString"; 67 String type2 = "typeString"; 68 String target1 = "target"; 69 String target2 = "target"; 70 Event<String> fixture = new Event<String>(type1); 71 fixture.target = target1; 72 Event<String> other = new Event<String>(type2); 73 other.target = target2; 74 75 boolean result = fixture.equals(other); 76 77 assertTrue(result); 78 } 79 80 @Test 81 public void testEquals_4() throws Exception { 82 String type1 = "typeString1"; 83 String type2 = "typeString2"; 84 String target1 = "target"; 85 String target2 = "target"; 86 Event<String> fixture = new Event<String>(type1); 87 fixture.target = target1; 88 Event<String> other = new Event<String>(type2); 89 other.target = target2; 90 91 boolean result = fixture.equals(other); 92 93 assertFalse(result); 94 } 95 96 @Test 97 public void testEquals_5() throws Exception { 98 String type1 = "typeString"; 99 String type2 = "typeString"; 100 String target1 = "target1"; 101 String target2 = "target2"; 102 Event<String> fixture = new Event<String>(type1); 103 fixture.target = target1; 104 Event<String> other = new Event<String>(type2); 105 other.target = target2; 106 107 boolean result = fixture.equals(other); 108 109 assertFalse(result); 110 } 111 112 @Test 113 public void testEquals_6() throws Exception { 114 String type = "typeString"; 115 Event<String> fixture = new Event<String>(type); 116 117 boolean result = fixture.equals(fixture); 118 119 assertTrue(result); 120 } 121 122 @Test 123 public void testEqualsContract() throws Exception { 124 EqualsVerifier.forClass(Event.class) 125 .suppress(Warning.NONFINAL_FIELDS).withRedefinedSubclass(ReplayableEvent.class) 126 .verify(); 127 } 128 129 @Test 130 public void testGetIdInfo_fixture_1() throws Exception { 131 String type = "typeString"; 132 String idInfo = "idInfoString"; 133 Event<String> fixture = new Event<String>(type); 134 fixture.idInfo = idInfo; 135 136 String result = fixture.getIdInfo(); 137 138 assertEquals(idInfo, result); 139 } 140 141 @Test 142 public void testGetShortId_1() throws Exception { 143 String type = "typeString"; 144 String targetShort = "targetShortString"; 145 Event<String> fixture = new Event<String>(type); 146 fixture.targetShort = targetShort; 147 148 String result = fixture.getShortId(); 149 150 assertEquals("targetShortString.typeString", result); 151 } 152 153 @Test 154 public void testGetShortId_2() throws Exception { 155 String type = "typeString"; 156 String targetShort = "targetShortString"; 157 String idInfo = "idInfoString"; 158 Event<String> fixture = new Event<String>(type); 159 fixture.targetShort = targetShort; 160 fixture.idInfo = idInfo; 161 162 String result = fixture.getShortId(); 163 164 assertEquals("targetShortString.typeString.idInfoString", result); 165 } 166 167 @Test 168 public void testGetShortId_3() throws Exception { 169 String type = "typeString"; 170 String target = "targetString"; 171 Event<String> fixture = new Event<String>(type); 172 fixture.target = target; 173 174 String result = fixture.getShortId(); 175 176 assertEquals("targetString.typeString", result); 177 } 178 179 @Test 180 public void testGetStandardId_1() throws Exception { 181 String type = "typeString"; 182 String target = "targetString"; 183 Event<String> fixture = new Event<String>(type); 184 fixture.target = target; 185 186 String result = fixture.getStandardId(); 187 188 assertEquals("targetString.typeString", result); 189 } 190 191 @Test 192 public void testGetStandardId_2() throws Exception { 193 String type = "typeString"; 194 String target = "targetString"; 195 String idInfo = "idInfoString"; 196 Event<String> fixture = new Event<String>(type); 197 fixture.target = target; 198 fixture.idInfo = idInfo; 199 200 String result = fixture.getStandardId(); 201 202 assertEquals("targetString.typeString.idInfoString", result); 203 } 204 205 @Test 206 public void testGetStandardId_3() throws Exception { 207 String type = "typeString"; 208 Event<String> fixture = new Event<String>(type); 209 210 String result = fixture.getStandardId(); 211 212 assertEquals("typeString", result); 213 } 214 215 @Test 216 public void testGetStandardId_4() throws Exception { 217 String type = "typeString"; 218 String idInfo = "idInfoString"; 219 Event<String> fixture = new Event<String>(type); 220 fixture.idInfo = idInfo; 221 222 String result = fixture.getStandardId(); 223 224 assertEquals("typeString.idInfoString", result); 225 } 226 227 @Test 228 public void testGetTarget_1() throws Exception { 229 String type = "typeString"; 230 String target = "targetString"; 231 Event<String> fixture = new Event<String>(type); 232 fixture.target = target; 233 234 String result = fixture.getTarget(); 235 236 assertEquals(target, result); 237 } 238 239 @Test 240 public void testGetTarget_2() throws Exception { 241 String type = "typeString"; 242 Event<String> fixture = new Event<String>(type); 243 244 String result = fixture.getTarget(); 245 246 assertNull(result); 247 } 248 249 @Test 250 public void testGetTargetShort_1() throws Exception { 251 String type = "typeString"; 252 String targetShort = "targetShort"; 253 Event<String> fixture = new Event<String>(type); 254 fixture.targetShort = targetShort; 255 256 String result = fixture.getTargetShort(); 257 258 assertEquals(targetShort, result); 259 } 260 261 @Test 262 public void testGetTargetShort_2() throws Exception { 263 String type = "typeString"; 264 Event<String> fixture = new Event<String>(type); 265 266 String result = fixture.getTargetShort(); 267 268 assertNull(result); 269 } 270 271 @Test 272 public void testGetType_1() throws Exception { 273 String type = "typeString"; 274 Event<String> fixture = new Event<String>(type); 275 276 String result = fixture.getType(); 277 278 assertEquals(type, result); 279 } 280 281 @Test 282 public void testSetIdInfo_fixture_1() throws Exception { 283 String type = "typeString"; 284 String idInfo = "idInfoString"; 285 Event<String> fixture = new Event<String>(type); 286 287 fixture.setIdInfo(idInfo); 288 289 assertEquals(idInfo, fixture.idInfo); 290 } 291 292 @Test 293 public void testSetIdInfo_2() throws Exception { 294 String type = "typeString"; 295 String idInfo = null; 296 Event<String> fixture = new Event<String>(type); 297 298 fixture.setIdInfo(idInfo); 299 300 assertEquals(idInfo, fixture.idInfo); 301 } 302 303 @Test 304 public void testSetTarget_1() throws Exception { 305 String type = "typeString"; 306 String target = "targetString"; 307 Event<String> fixture = new Event<String>(type); 308 309 boolean result = fixture.setTarget(target); 310 311 assertTrue(result); 312 assertEquals(target, fixture.target); 313 } 314 315 @Test 316 public void testSetTarget_2() throws Exception { 317 String type = "typeString"; 318 String target1 = "targetString1"; 319 String target2 = "targetString2"; 320 Event<String> fixture = new Event<String>(type); 321 fixture.target = target1; 322 323 boolean result = fixture.setTarget(target2); 324 325 assertFalse(result); 326 assertEquals(target1, fixture.target); 327 } 328 329 @Test 330 public void testSetTargetShort_1() throws Exception { 331 String type = "typeString"; 332 String targetShort = "targetShortString"; 333 Event<String> fixture = new Event<String>(type); 334 335 boolean result = fixture.setTargetShort(targetShort); 336 337 assertTrue(result); 338 assertEquals(targetShort, fixture.targetShort); 339 } 340 341 @Test 342 public void testSetTargetShort_2() throws Exception { 343 String type = "typeString"; 344 String targetShort1 = "targetShortString1"; 345 String targetShort2 = "targetShortString2"; 346 Event<String> fixture = new Event<String>(type); 347 fixture.targetShort = targetShort1; 348 349 boolean result = fixture.setTargetShort(targetShort2); 350 351 assertFalse(result); 352 assertEquals(targetShort1, fixture.targetShort); 353 } 354 355 @Test 356 public void testToString_1() throws Exception { 357 String type = "typeString"; 358 String target = "targetString"; 359 Event<String> fixture = new Event<String>(type); 360 fixture.target = target; 361 362 String result = fixture.toString(); 363 364 assertEquals("targetString.typeString", result); 365 } 366 367 @Test 368 public void testToString_2() throws Exception { 369 String type = "typeString"; 370 String target = "targetString"; 371 String idInfo = "idInfoString"; 372 Event<String> fixture = new Event<String>(type); 373 fixture.target = target; 374 fixture.idInfo = idInfo; 375 376 String result = fixture.toString(); 377 378 assertEquals("targetString.typeString.idInfoString", result); 379 } 380 381 @Test 382 public void testToString_3() throws Exception { 383 String type = "typeString"; 384 Event<String> fixture = new Event<String>(type); 385 386 String result = fixture.toString(); 387 388 assertEquals("typeString", result); 389 } 390 391 @Test 392 public void testToString_4() throws Exception { 393 String type = "typeString"; 394 String idInfo = "idInfoString"; 395 Event<String> fixture = new Event<String>(type); 396 fixture.idInfo = idInfo; 397 398 String result = fixture.toString(); 399 400 assertEquals("typeString.idInfoString", result); 401 } 402 403 public static void main(String[] args) { 404 new org.junit.runner.JUnitCore().run(EventTest.class); 405 } 20 @Test 21 public void testEvent_1() throws Exception { 22 Event result = new Event(mock(IEventType.class)); 23 24 assertNotNull(result); 25 } 26 27 @Test(expected = java.security.InvalidParameterException.class) 28 public void testEvent_2() throws Exception { 29 new Event(null); 30 } 31 32 /* 33 @Test 34 public void testEquals_1() throws Exception { 35 IEventType type1 = mock(IEventType.class); 36 IEventType type2 = mock(IEventType.class); 37 // when(type1.equals(type2)).thenReturn(true); 38 Event fixture = new Event(type1); 39 Event other = new Event(type2); 40 41 boolean result = fixture.equals(other); 42 43 assertTrue(result); 44 } 45 46 @Test 47 public void testEquals_2() throws Exception { 48 String type1 = "typeString1"; 49 String type2 = "typeString2"; 50 Event fixture = new Event(type1); 51 Event other = new Event(type2); 52 53 boolean result = fixture.equals(other); 54 55 assertFalse(result); 56 } 57 58 @Test 59 public void testEquals_3() throws Exception { 60 String type1 = "typeString"; 61 String type2 = "typeString"; 62 String target1 = "target"; 63 String target2 = "target"; 64 Event fixture = new Event(type1); 65 fixture.target = target1; 66 Event other = new Event(type2); 67 other.target = target2; 68 69 boolean result = fixture.equals(other); 70 71 assertTrue(result); 72 } 73 74 @Test 75 public void testEquals_4() throws Exception { 76 String type1 = "typeString1"; 77 String type2 = "typeString2"; 78 String target1 = "target"; 79 String target2 = "target"; 80 Event fixture = new Event(type1); 81 fixture.target = target1; 82 Event other = new Event(type2); 83 other.target = target2; 84 85 boolean result = fixture.equals(other); 86 87 assertFalse(result); 88 } 89 90 @Test 91 public void testEquals_5() throws Exception { 92 String type1 = "typeString"; 93 String type2 = "typeString"; 94 String target1 = "target1"; 95 String target2 = "target2"; 96 Event fixture = new Event(type1); 97 fixture.target = target1; 98 Event other = new Event(type2); 99 other.target = target2; 100 101 boolean result = fixture.equals(other); 102 103 assertFalse(result); 104 } 105 106 @Test 107 public void testEquals_6() throws Exception { 108 String type = "typeString"; 109 Event fixture = new Event(type); 110 111 boolean result = fixture.equals(fixture); 112 113 assertTrue(result); 114 } 115 116 @Test 117 public void testEqualsContract() throws Exception { 118 EqualsVerifier.forClass(Event.class).suppress(Warning.NONFINAL_FIELDS) 119 .withRedefinedSubclass(ReplayableEvent.class).verify(); 120 } 121 */ 122 123 @Test 124 public void testGetTarget_1() throws Exception { 125 IEventType type = mock(IEventType.class); 126 IEventTarget target = mock(IEventTarget.class); 127 128 Event fixture = new Event(type); 129 fixture.setTarget(target); 130 131 IEventTarget result = fixture.getTarget(); 132 133 assertSame(target, result); 134 } 135 136 137 138 @Test 139 public void testGetTarget_2() throws Exception { 140 IEventType type = mock(IEventType.class); 141 IEventTarget target = mock(IEventTarget.class); 142 143 Event fixture = new Event(type, target); 144 145 IEventTarget result = fixture.getTarget(); 146 147 assertSame(target, result); 148 } 149 150 @Test 151 public void testGetTarget_3() throws Exception { 152 IEventType type = mock(IEventType.class); 153 154 Event fixture = new Event(type); 155 156 IEventTarget result = fixture.getTarget(); 157 158 assertNull(result); 159 } 160 161 @Test 162 public void testGetType_1() throws Exception { 163 IEventType type = mock(IEventType.class); 164 165 Event fixture = new Event(type); 166 167 IEventType result = fixture.getType(); 168 169 assertEquals(type, result); 170 } 171 172 @Test 173 public void testSetTarget_1() throws Exception { 174 IEventType type = mock(IEventType.class); 175 IEventTarget target = mock(IEventTarget.class); 176 177 Event fixture = new Event(type); 178 179 boolean result = fixture.setTarget(target); 180 181 assertTrue(result); 182 assertEquals(target, fixture.getTarget()); 183 } 184 185 @Test 186 public void testSetTarget_2() throws Exception { 187 IEventType type = mock(IEventType.class); 188 IEventTarget target1 = mock(IEventTarget.class); 189 IEventTarget target2 = mock(IEventTarget.class); 190 191 Event fixture = new Event(type); 192 193 fixture.setTarget(target1); 194 boolean result = fixture.setTarget(target2); 195 196 assertFalse(result); 197 assertEquals(target1, fixture.target); 198 } 199 200 @Test 201 public void testSetTarget_3() throws Exception { 202 IEventType type = mock(IEventType.class); 203 IEventTarget target1 = mock(IEventTarget.class); 204 IEventTarget target2 = mock(IEventTarget.class); 205 206 Event fixture = new Event(type, target1); 207 208 boolean result = fixture.setTarget(target2); 209 210 assertFalse(result); 211 assertEquals(target1, fixture.target); 212 } 213 214 @Test 215 public void testToString_1() throws Exception { 216 IEventType type = mock(IEventType.class); 217 when(type.toString()).thenReturn("typeString"); 218 IEventTarget target = mock(IEventTarget.class); 219 when(target.toString()).thenReturn("targetString"); 220 221 Event fixture = new Event(type, target); 222 223 String result = fixture.toString(); 224 225 assertEquals("(typeString;targetString)", result); 226 } 227 228 public static void main(String[] args) { 229 new org.junit.runner.JUnitCore().run(EventTest.class); 230 } 406 231 }
Note: See TracChangeset
for help on using the changeset viewer.