Changeset 547 for trunk/quest-core-events-test/src/test
- Timestamp:
- 08/16/12 12:34:24 (12 years ago)
- Location:
- trunk/quest-core-events-test/src/test/java/de/ugoe/cs/quest
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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.