| 1 | /********************************************************************** |
| 2 | * Copyright (c) 2012 Ericsson |
| 3 | * |
| 4 | * All rights reserved. This program and the accompanying materials are |
| 5 | * made available under the terms of the Eclipse Public License v1.0 which |
| 6 | * accompanies this distribution, and is available at |
| 7 | * http://www.eclipse.org/legal/epl-v10.html |
| 8 | * |
| 9 | * Contributors: |
| 10 | * Bernd Hufmann - Initial API and implementation |
| 11 | **********************************************************************/ |
| 12 | package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl; |
| 13 | |
| 14 | import java.util.LinkedList; |
| 15 | import java.util.List; |
| 16 | |
| 17 | import junit.framework.TestCase; |
| 18 | |
| 19 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo; |
| 20 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.IFieldInfo; |
| 21 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEventType; |
| 22 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel; |
| 23 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.BaseEventInfo; |
| 24 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.FieldInfo; |
| 25 | |
| 26 | /** |
| 27 | * The class <code>BaseEventInfoTest</code> contains test for the class <code>{@link BaseEventInfo}</code>. |
| 28 | */ |
| 29 | @SuppressWarnings({"nls", "javadoc"}) |
| 30 | public class BaseEventInfoTest extends TestCase { |
| 31 | |
| 32 | // ------------------------------------------------------------------------ |
| 33 | // Test data |
| 34 | // ------------------------------------------------------------------------ |
| 35 | private IBaseEventInfo fEventInfo1 = null; |
| 36 | private IBaseEventInfo fEventInfo2 = null; |
| 37 | |
| 38 | // ------------------------------------------------------------------------ |
| 39 | // Housekeeping |
| 40 | // ------------------------------------------------------------------------ |
| 41 | /** |
| 42 | * Perform pre-test initialization. |
| 43 | * |
| 44 | * @throws Exception if the initialization fails for some reason |
| 45 | * |
| 46 | */ |
| 47 | @Override |
| 48 | public void setUp() throws Exception { |
| 49 | super.setUp(); |
| 50 | ModelImplFactory factory = new ModelImplFactory(); |
| 51 | fEventInfo1 = factory.getBaseEventInfo1(); |
| 52 | fEventInfo2 = factory.getBaseEventInfo2(); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Perform post-test clean-up. |
| 57 | * |
| 58 | * @throws Exception if the clean-up fails for some reason |
| 59 | * |
| 60 | */ |
| 61 | @Override |
| 62 | public void tearDown() throws Exception { |
| 63 | } |
| 64 | |
| 65 | // ------------------------------------------------------------------------ |
| 66 | // Tests |
| 67 | // ------------------------------------------------------------------------ |
| 68 | |
| 69 | /** |
| 70 | * Run the BaseEventInfo() constructor test. |
| 71 | * |
| 72 | */ |
| 73 | public void testBaseEventInfo() { |
| 74 | BaseEventInfo fixture = new BaseEventInfo("event"); |
| 75 | assertNotNull(fixture); |
| 76 | |
| 77 | TraceEventType result = fixture.getEventType(); |
| 78 | |
| 79 | assertEquals("event", fixture.getName()); |
| 80 | assertEquals("unknown", result.getInName()); |
| 81 | assertEquals("UNKNOWN", result.name()); |
| 82 | assertEquals("UNKNOWN", result.toString()); |
| 83 | assertEquals(3, result.ordinal()); |
| 84 | |
| 85 | TraceLogLevel level = fixture.getLogLevel(); |
| 86 | assertEquals("TRACE_DEBUG", level.getInName()); |
| 87 | assertEquals("TRACE_DEBUG", level.name()); |
| 88 | assertEquals("TRACE_DEBUG", level.toString()); |
| 89 | assertEquals(14, level.ordinal()); |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * Test Copy Constructor |
| 94 | */ |
| 95 | public void testEventInfoCopy() { |
| 96 | BaseEventInfo info = new BaseEventInfo((BaseEventInfo)fEventInfo1); |
| 97 | |
| 98 | assertEquals(fEventInfo1.getName(), info.getName()); |
| 99 | assertEquals(fEventInfo1.getEventType(), info.getEventType()); |
| 100 | assertEquals(fEventInfo1.getLogLevel(), info.getLogLevel()); |
| 101 | assertEquals(fEventInfo1.getFilterExpression(), info.getFilterExpression()); |
| 102 | |
| 103 | IFieldInfo[] orignalFields = fEventInfo1.getFields(); |
| 104 | IFieldInfo[] copiedFields = info.getFields(); |
| 105 | assertEquals(orignalFields.length, copiedFields.length); |
| 106 | |
| 107 | for (int i = 0; i < copiedFields.length; i++) { |
| 108 | assertEquals(orignalFields[i], copiedFields[i]); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Test Copy Constructor |
| 114 | */ |
| 115 | public void testEventCopy2() { |
| 116 | try { |
| 117 | BaseEventInfo info = null; |
| 118 | new BaseEventInfo(info); |
| 119 | fail("null copy"); |
| 120 | } |
| 121 | catch (IllegalArgumentException e) { |
| 122 | // Success |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Run the TraceEventType getEventType() method test. |
| 128 | * |
| 129 | * @throws Exception |
| 130 | * |
| 131 | */ |
| 132 | public void testGetEventType_1() { |
| 133 | BaseEventInfo fixture = new BaseEventInfo("event"); |
| 134 | fixture.setEventType("unknown"); |
| 135 | |
| 136 | TraceEventType result = fixture.getEventType(); |
| 137 | |
| 138 | assertNotNull(result); |
| 139 | assertEquals("unknown", result.getInName()); |
| 140 | assertEquals("UNKNOWN", result.name()); |
| 141 | assertEquals("UNKNOWN", result.toString()); |
| 142 | assertEquals(3, result.ordinal()); |
| 143 | |
| 144 | fixture.setEventType(""); |
| 145 | result = fixture.getEventType(); |
| 146 | assertEquals("unknown", result.getInName()); |
| 147 | assertEquals("UNKNOWN", result.name()); |
| 148 | assertEquals("UNKNOWN", result.toString()); |
| 149 | assertEquals(3, result.ordinal()); |
| 150 | |
| 151 | fixture.setEventType("tracepoint"); |
| 152 | result = fixture.getEventType(); |
| 153 | assertNotNull(result); |
| 154 | assertEquals("tracepoint", result.getInName()); |
| 155 | assertEquals("TRACEPOINT", result.name()); |
| 156 | assertEquals("TRACEPOINT", result.toString()); |
| 157 | assertEquals(0, result.ordinal()); |
| 158 | |
| 159 | fixture.setEventType("syscall"); |
| 160 | result = fixture.getEventType(); |
| 161 | assertNotNull(result); |
| 162 | assertEquals("syscall", result.getInName()); |
| 163 | assertEquals("SYSCALL", result.name()); |
| 164 | assertEquals("SYSCALL", result.toString()); |
| 165 | assertEquals(1, result.ordinal()); |
| 166 | |
| 167 | fixture.setEventType("probe"); |
| 168 | result = fixture.getEventType(); |
| 169 | assertNotNull(result); |
| 170 | assertEquals("probe", result.getInName()); |
| 171 | assertEquals("PROBE", result.name()); |
| 172 | assertEquals("PROBE", result.toString()); |
| 173 | assertEquals(2, result.ordinal()); |
| 174 | |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * Run the void setEventType(TraceEventType) method test. |
| 179 | * |
| 180 | */ |
| 181 | public void testSetEventType_2() { |
| 182 | BaseEventInfo fixture = new BaseEventInfo("event"); |
| 183 | fixture.setEventType(TraceEventType.TRACEPOINT); |
| 184 | |
| 185 | TraceEventType result = fixture.getEventType(); |
| 186 | |
| 187 | assertNotNull(result); |
| 188 | assertEquals("tracepoint", result.getInName()); |
| 189 | assertEquals("TRACEPOINT", result.name()); |
| 190 | assertEquals("TRACEPOINT", result.toString()); |
| 191 | assertEquals(0, result.ordinal()); |
| 192 | |
| 193 | fixture.setEventType(TraceEventType.UNKNOWN); |
| 194 | result = fixture.getEventType(); |
| 195 | |
| 196 | assertNotNull(result); |
| 197 | assertEquals("unknown", result.getInName()); |
| 198 | assertEquals("UNKNOWN", result.name()); |
| 199 | assertEquals("UNKNOWN", result.toString()); |
| 200 | assertEquals(3, result.ordinal()); |
| 201 | |
| 202 | fixture.setEventType(TraceEventType.SYSCALL); |
| 203 | result = fixture.getEventType(); |
| 204 | assertNotNull(result); |
| 205 | assertEquals("syscall", result.getInName()); |
| 206 | assertEquals("SYSCALL", result.name()); |
| 207 | assertEquals("SYSCALL", result.toString()); |
| 208 | assertEquals(1, result.ordinal()); |
| 209 | |
| 210 | fixture.setEventType(TraceEventType.PROBE); |
| 211 | result = fixture.getEventType(); |
| 212 | assertNotNull(result); |
| 213 | assertEquals("probe", result.getInName()); |
| 214 | assertEquals("PROBE", result.name()); |
| 215 | assertEquals("PROBE", result.toString()); |
| 216 | assertEquals(2, result.ordinal()); |
| 217 | |
| 218 | } |
| 219 | |
| 220 | /** |
| 221 | * Run the void setLogLevel(TraceLogLevel) method test. |
| 222 | * Run the TraceLogLevel getLogLevel() method test |
| 223 | * |
| 224 | */ |
| 225 | public void testSetLogLevel1() { |
| 226 | BaseEventInfo fixture = new BaseEventInfo("event"); |
| 227 | fixture.setEventType(TraceEventType.TRACEPOINT); |
| 228 | fixture.setLogLevel(TraceLogLevel.TRACE_CRIT); |
| 229 | |
| 230 | // 2 set/get-operations are enough to test the method |
| 231 | TraceLogLevel result = fixture.getLogLevel(); |
| 232 | assertNotNull(result); |
| 233 | assertEquals("TRACE_CRIT", result.getInName()); |
| 234 | assertEquals("TRACE_CRIT", result.name()); |
| 235 | assertEquals("TRACE_CRIT", result.toString()); |
| 236 | assertEquals(2, result.ordinal()); |
| 237 | |
| 238 | fixture.setLogLevel(TraceLogLevel.TRACE_DEBUG_FUNCTION); |
| 239 | |
| 240 | result = fixture.getLogLevel(); |
| 241 | assertNotNull(result); |
| 242 | assertEquals("TRACE_DEBUG_FUNCTION", result.getInName()); |
| 243 | assertEquals("TRACE_DEBUG_FUNCTION", result.name()); |
| 244 | assertEquals("TRACE_DEBUG_FUNCTION", result.toString()); |
| 245 | assertEquals(12, result.ordinal()); |
| 246 | } |
| 247 | |
| 248 | /** |
| 249 | * Run the void setLogLevel(String) method test. |
| 250 | * Run the TraceLogLevel getLogLevel() method test |
| 251 | * |
| 252 | */ |
| 253 | public void testSetLogLevel2() { |
| 254 | BaseEventInfo fixture = new BaseEventInfo("event"); |
| 255 | fixture.setEventType(TraceEventType.TRACEPOINT); |
| 256 | fixture.setLogLevel("TRACE_EMERG"); |
| 257 | |
| 258 | TraceLogLevel result = fixture.getLogLevel(); |
| 259 | assertNotNull(result); |
| 260 | assertEquals("TRACE_EMERG", result.getInName()); |
| 261 | assertEquals("TRACE_EMERG", result.name()); |
| 262 | assertEquals(0, result.ordinal()); |
| 263 | |
| 264 | //------------------------ |
| 265 | fixture.setLogLevel("TRACE_ALERT"); |
| 266 | |
| 267 | result = fixture.getLogLevel(); |
| 268 | assertNotNull(result); |
| 269 | assertEquals("TRACE_ALERT", result.getInName()); |
| 270 | assertEquals("TRACE_ALERT", result.name()); |
| 271 | assertEquals(1, result.ordinal()); |
| 272 | |
| 273 | //------------------------ |
| 274 | fixture.setLogLevel("TRACE_CRIT"); |
| 275 | |
| 276 | result = fixture.getLogLevel(); |
| 277 | assertNotNull(result); |
| 278 | assertEquals("TRACE_CRIT", result.getInName()); |
| 279 | assertEquals("TRACE_CRIT", result.name()); |
| 280 | assertEquals(2, result.ordinal()); |
| 281 | |
| 282 | //------------------------ |
| 283 | fixture.setLogLevel("TRACE_ERR"); |
| 284 | |
| 285 | result = fixture.getLogLevel(); |
| 286 | assertNotNull(result); |
| 287 | assertEquals("TRACE_ERR", result.getInName()); |
| 288 | assertEquals("TRACE_ERR", result.name()); |
| 289 | assertEquals(3, result.ordinal()); |
| 290 | |
| 291 | //------------------------ |
| 292 | fixture.setLogLevel("TRACE_WARNING"); |
| 293 | |
| 294 | result = fixture.getLogLevel(); |
| 295 | assertNotNull(result); |
| 296 | assertEquals("TRACE_WARNING", result.getInName()); |
| 297 | assertEquals("TRACE_WARNING", result.name()); |
| 298 | assertEquals(4, result.ordinal()); |
| 299 | |
| 300 | //------------------------ |
| 301 | fixture.setLogLevel("TRACE_NOTICE"); |
| 302 | |
| 303 | result = fixture.getLogLevel(); |
| 304 | assertNotNull(result); |
| 305 | assertEquals("TRACE_NOTICE", result.getInName()); |
| 306 | assertEquals("TRACE_NOTICE", result.name()); |
| 307 | assertEquals(5, result.ordinal()); |
| 308 | |
| 309 | //------------------------ |
| 310 | fixture.setLogLevel("TRACE_INFO"); |
| 311 | |
| 312 | result = fixture.getLogLevel(); |
| 313 | assertNotNull(result); |
| 314 | assertEquals("TRACE_INFO", result.getInName()); |
| 315 | assertEquals("TRACE_INFO", result.name()); |
| 316 | assertEquals(6, result.ordinal()); |
| 317 | |
| 318 | //------------------------ |
| 319 | fixture.setLogLevel("TRACE_DEBUG_SYSTEM"); |
| 320 | |
| 321 | result = fixture.getLogLevel(); |
| 322 | assertNotNull(result); |
| 323 | assertEquals("TRACE_DEBUG_SYSTEM", result.getInName()); |
| 324 | assertEquals("TRACE_DEBUG_SYSTEM", result.name()); |
| 325 | assertEquals(7, result.ordinal()); |
| 326 | |
| 327 | //------------------------ |
| 328 | fixture.setLogLevel("TRACE_DEBUG_PROGRAM"); |
| 329 | |
| 330 | result = fixture.getLogLevel(); |
| 331 | assertNotNull(result); |
| 332 | assertEquals("TRACE_DEBUG_PROGRAM", result.getInName()); |
| 333 | assertEquals("TRACE_DEBUG_PROGRAM", result.name()); |
| 334 | assertEquals(8, result.ordinal()); |
| 335 | |
| 336 | //------------------------ |
| 337 | fixture.setLogLevel("TRACE_DEBUG_PROCESS"); |
| 338 | |
| 339 | result = fixture.getLogLevel(); |
| 340 | assertNotNull(result); |
| 341 | assertEquals("TRACE_DEBUG_PROCESS", result.getInName()); |
| 342 | assertEquals("TRACE_DEBUG_PROCESS", result.name()); |
| 343 | assertEquals(9, result.ordinal()); |
| 344 | |
| 345 | //------------------------ |
| 346 | fixture.setLogLevel("TRACE_DEBUG_MODULE"); |
| 347 | |
| 348 | result = fixture.getLogLevel(); |
| 349 | assertNotNull(result); |
| 350 | assertEquals("TRACE_DEBUG_MODULE", result.getInName()); |
| 351 | assertEquals("TRACE_DEBUG_MODULE", result.name()); |
| 352 | assertEquals(10, result.ordinal()); |
| 353 | |
| 354 | //------------------------ |
| 355 | fixture.setLogLevel("TRACE_DEBUG_UNIT"); |
| 356 | |
| 357 | result = fixture.getLogLevel(); |
| 358 | assertNotNull(result); |
| 359 | assertEquals("TRACE_DEBUG_UNIT", result.getInName()); |
| 360 | assertEquals("TRACE_DEBUG_UNIT", result.name()); |
| 361 | assertEquals(11, result.ordinal()); |
| 362 | |
| 363 | //------------------------ |
| 364 | fixture.setLogLevel("TRACE_DEBUG_FUNCTION"); |
| 365 | |
| 366 | result = fixture.getLogLevel(); |
| 367 | assertNotNull(result); |
| 368 | assertEquals("TRACE_DEBUG_FUNCTION", result.getInName()); |
| 369 | assertEquals("TRACE_DEBUG_FUNCTION", result.name()); |
| 370 | assertEquals(12, result.ordinal()); |
| 371 | |
| 372 | //------------------------ |
| 373 | fixture.setLogLevel("TRACE_DEBUG_LINE"); |
| 374 | |
| 375 | result = fixture.getLogLevel(); |
| 376 | assertNotNull(result); |
| 377 | assertEquals("TRACE_DEBUG_LINE", result.getInName()); |
| 378 | assertEquals("TRACE_DEBUG_LINE", result.name()); |
| 379 | assertEquals(13, result.ordinal()); |
| 380 | |
| 381 | //------------------------ |
| 382 | fixture.setLogLevel("TRACE_DEBUG"); |
| 383 | |
| 384 | result = fixture.getLogLevel(); |
| 385 | assertNotNull(result); |
| 386 | assertEquals("TRACE_DEBUG", result.getInName()); |
| 387 | assertEquals("TRACE_DEBUG", result.name()); |
| 388 | assertEquals(14, result.ordinal()); |
| 389 | |
| 390 | //------------------------- |
| 391 | fixture.setLogLevel("LEVEL_UNKNOWN"); |
| 392 | |
| 393 | result = fixture.getLogLevel(); |
| 394 | assertNotNull(result); |
| 395 | assertEquals("LEVEL_UNKNOWN", result.getInName()); |
| 396 | assertEquals("LEVEL_UNKNOWN", result.name()); |
| 397 | assertEquals(15, result.ordinal()); |
| 398 | |
| 399 | fixture.setLogLevel("garbage"); |
| 400 | |
| 401 | result = fixture.getLogLevel(); |
| 402 | assertNotNull(result); |
| 403 | assertEquals("TRACE_DEBUG", result.getInName()); |
| 404 | assertEquals("TRACE_DEBUG", result.name()); |
| 405 | assertEquals(14, result.ordinal()); |
| 406 | } |
| 407 | |
| 408 | /** |
| 409 | * test filter expression |
| 410 | */ |
| 411 | public void testSetFields() { |
| 412 | BaseEventInfo info = new BaseEventInfo((BaseEventInfo)fEventInfo2); |
| 413 | info.setFilterExpression("stringfield==test"); |
| 414 | assertEquals("stringfield==test", info.getFilterExpression()); |
| 415 | } |
| 416 | |
| 417 | |
| 418 | /** |
| 419 | * test add field |
| 420 | */ |
| 421 | public void testAddField() { |
| 422 | BaseEventInfo info = new BaseEventInfo((BaseEventInfo)fEventInfo2); |
| 423 | |
| 424 | IFieldInfo field = new FieldInfo("intfield"); |
| 425 | field.setFieldType("int"); |
| 426 | |
| 427 | info.addField(field); |
| 428 | |
| 429 | // Verify the stored events |
| 430 | IFieldInfo[] result = info.getFields(); |
| 431 | |
| 432 | assertNotNull(result); |
| 433 | assertEquals(1, result.length); |
| 434 | assertNotNull(result[0]); |
| 435 | assertTrue(field.equals(result[0])); |
| 436 | } |
| 437 | |
| 438 | /** |
| 439 | * test set fields |
| 440 | */ |
| 441 | public void testFields() { |
| 442 | BaseEventInfo info = new BaseEventInfo((BaseEventInfo)fEventInfo2); |
| 443 | |
| 444 | IFieldInfo field1 = new FieldInfo("intfield"); |
| 445 | field1.setFieldType("int"); |
| 446 | |
| 447 | IFieldInfo field2 = new FieldInfo("stringfield"); |
| 448 | field2.setFieldType("string"); |
| 449 | |
| 450 | List<IFieldInfo> fields = new LinkedList<IFieldInfo>(); |
| 451 | fields.add(field1); |
| 452 | fields.add(field2); |
| 453 | info.setFields(fields); |
| 454 | |
| 455 | // Verify the stored events |
| 456 | IFieldInfo[] result = info.getFields(); |
| 457 | |
| 458 | assertNotNull(result); |
| 459 | assertEquals(2, result.length); |
| 460 | |
| 461 | for (int i = 0; i < result.length; i++) { |
| 462 | assertNotNull(result[i]); |
| 463 | assertTrue(fields.get(i).equals(result[i])); |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | /** |
| 468 | * Run the String toString() method test. |
| 469 | * |
| 470 | */ |
| 471 | public void testToString_1() { |
| 472 | BaseEventInfo fixture = new BaseEventInfo("event"); |
| 473 | fixture.setName("testName"); |
| 474 | fixture.setEventType(TraceEventType.TRACEPOINT); |
| 475 | fixture.setLogLevel(TraceLogLevel.TRACE_ERR); |
| 476 | |
| 477 | String result = fixture.toString(); |
| 478 | |
| 479 | // add additional test code here |
| 480 | assertEquals("[BaseEventInfo([TraceInfo(Name=testName)],type=TRACEPOINT,level=TRACE_ERR)]", result); |
| 481 | } |
| 482 | |
| 483 | // ------------------------------------------------------------------------ |
| 484 | // equals |
| 485 | // ------------------------------------------------------------------------ |
| 486 | |
| 487 | public void testEqualsReflexivity() { |
| 488 | assertTrue("equals", fEventInfo1.equals(fEventInfo1)); |
| 489 | assertTrue("equals", fEventInfo2.equals(fEventInfo2)); |
| 490 | |
| 491 | assertTrue("equals", !fEventInfo1.equals(fEventInfo2)); |
| 492 | assertTrue("equals", !fEventInfo2.equals(fEventInfo1)); |
| 493 | } |
| 494 | |
| 495 | public void testEqualsSymmetry() { |
| 496 | BaseEventInfo info1 = new BaseEventInfo((BaseEventInfo)fEventInfo1); |
| 497 | BaseEventInfo info2 = new BaseEventInfo((BaseEventInfo)fEventInfo2); |
| 498 | |
| 499 | assertTrue("equals", info1.equals(fEventInfo1)); |
| 500 | assertTrue("equals", fEventInfo1.equals(info1)); |
| 501 | |
| 502 | assertTrue("equals", info2.equals(fEventInfo2)); |
| 503 | assertTrue("equals", fEventInfo2.equals(info2)); |
| 504 | } |
| 505 | |
| 506 | public void testEqualsTransivity() { |
| 507 | BaseEventInfo info1 = new BaseEventInfo((BaseEventInfo)fEventInfo1); |
| 508 | BaseEventInfo info2 = new BaseEventInfo((BaseEventInfo)fEventInfo1); |
| 509 | BaseEventInfo info3 = new BaseEventInfo((BaseEventInfo)fEventInfo1); |
| 510 | |
| 511 | assertTrue("equals", info1.equals(info2)); |
| 512 | assertTrue("equals", info2.equals(info3)); |
| 513 | assertTrue("equals", info1.equals(info3)); |
| 514 | } |
| 515 | |
| 516 | public void testEqualsNull() { |
| 517 | assertTrue("equals", !fEventInfo1.equals(null)); |
| 518 | assertTrue("equals", !fEventInfo2.equals(null)); |
| 519 | } |
| 520 | |
| 521 | // ------------------------------------------------------------------------ |
| 522 | // hashCode |
| 523 | // ------------------------------------------------------------------------ |
| 524 | |
| 525 | public void testHashCode() { |
| 526 | BaseEventInfo info1 = new BaseEventInfo((BaseEventInfo)fEventInfo1); |
| 527 | BaseEventInfo info2 = new BaseEventInfo((BaseEventInfo)fEventInfo2); |
| 528 | |
| 529 | assertTrue("hashCode", fEventInfo1.hashCode() == info1.hashCode()); |
| 530 | assertTrue("hashCode", fEventInfo2.hashCode() == info2.hashCode()); |
| 531 | |
| 532 | assertTrue("hashCode", fEventInfo1.hashCode() != info2.hashCode()); |
| 533 | assertTrue("hashCode", fEventInfo2.hashCode() != info1.hashCode()); |
| 534 | } |
| 535 | } |