[419] | 1 | package de.ugoe.cs.eventbench.windows.data;
|
---|
| 2 |
|
---|
| 3 | import org.junit.*;
|
---|
| 4 |
|
---|
| 5 | import static org.junit.Assert.*;
|
---|
| 6 |
|
---|
| 7 | /**
|
---|
| 8 | * The class <code>WindowsEventTest</code> contains tests for the class <code>{@link WindowsEvent}</code>.
|
---|
| 9 | *
|
---|
| 10 | * @author Steffen Herbold
|
---|
| 11 | * @version 1.0
|
---|
| 12 | */
|
---|
| 13 | public class WindowsEventTest {
|
---|
| 14 |
|
---|
| 15 | @Test
|
---|
| 16 | public void testTargetEquals_1() throws Exception {
|
---|
| 17 | WindowsEvent event = new WindowsEvent("type");
|
---|
| 18 | String target1 = "<window name=\"name1\" class=\"class1\" resourceId=\"id1\" isModal=\"modal1\" hwnd=\"111\"/>";
|
---|
| 19 | String target2 = "<window name=\"name1\" class=\"class1\" resourceId=\"id1\" isModal=\"modal1\" hwnd=\"111\"/>";
|
---|
| 20 | event.setTarget(target1);
|
---|
| 21 | boolean expected = true;
|
---|
| 22 |
|
---|
| 23 | boolean result = event.targetEquals(target2);
|
---|
| 24 |
|
---|
| 25 | assertEquals(expected, result);
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | @Test
|
---|
| 29 | public void testTargetEquals_2() throws Exception {
|
---|
| 30 | WindowsEvent event = new WindowsEvent("type");
|
---|
| 31 | String target1 = "<window name=\"Messplatz\" class=\"#32770\" resourceId=\"0\" isModal=\"true\" hwnd=\"1770138\"/><window name=\"Messplatz im Einstellmodus\" class=\"#32770\" resourceId=\"0\" isModal=\"true\" hwnd=\"2032262\"/><window name=\"\" class=\"#32770\" resourceId=\"0\" isModal=\"false\" hwnd=\"459658\"/><window name=\"\" class=\"SysTabControl32\" resourceId=\"12320\" isModal=\"false\" hwnd=\"983734\"/>";
|
---|
| 32 | String target2 = "<window name=\"Messplatz\" class=\"#32770\" resourceId=\"0\" isModal=\"true\" hwnd=\"1770138\"/><window name=\"Messplatz im Einstellmodus\" class=\"#32770\" resourceId=\"0\" isModal=\"true\" hwnd=\"2032262\"/><window name=\"\" class=\"#32770\" resourceId=\"0\" isModal=\"false\" hwnd=\"459658\"/><window name=\"\" class=\"SysTabControl32\" resourceId=\"12320\" isModal=\"false\" hwnd=\"983734\"/>";
|
---|
| 33 | event.setTarget(target1);
|
---|
| 34 | boolean expected = true;
|
---|
| 35 |
|
---|
| 36 | boolean result = event.targetEquals(target2);
|
---|
| 37 |
|
---|
| 38 | assertEquals(expected, result);
|
---|
| 39 |
|
---|
| 40 | MFCTargetComparator.setMutable(false);
|
---|
| 41 |
|
---|
| 42 | result = event.targetEquals(target2);
|
---|
| 43 |
|
---|
| 44 | assertEquals(expected, result);
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | }
|
---|