source: trunk/EventBenchConsoleTest/src/de/ugoe/cs/eventbench/windows/data/WindowsEventTest.java @ 420

Last change on this file since 420 was 419, checked in by sherbold, 12 years ago
  • added test cases for de.ugoe.cs.eventbench.windows.data.WindowsEvent?.equals()
  • Property svn:mime-type set to text/plain
File size: 2.0 KB
Line 
1package de.ugoe.cs.eventbench.windows.data;
2
3import org.junit.*;
4
5import 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 */
13public 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}
Note: See TracBrowser for help on using the repository browser.