1
1
import java .io .*;
2
2
import java .util .*;
3
- import org .python .core .PyList ;
4
- import org . python . core . PyDictionary ;
3
+ import org .python .core .* ;
4
+
5
5
6
6
public class JavaAttributeVerifyingListener {
7
7
public static final String ROBOT_LISTENER_API_VERSION = "2" ;
@@ -10,7 +10,7 @@ public class JavaAttributeVerifyingListener {
10
10
11
11
public JavaAttributeVerifyingListener () throws IOException {
12
12
createOutputFile ();
13
- createExcpectedTypes ();
13
+ createExpectedTypes ();
14
14
}
15
15
16
16
public void createOutputFile () throws IOException {
@@ -20,7 +20,7 @@ public void createOutputFile() throws IOException {
20
20
outfile = new BufferedWriter (new FileWriter (outpath ));
21
21
}
22
22
23
- public void createExcpectedTypes () {
23
+ public void createExpectedTypes () {
24
24
expectedTypes = new HashMap <String , Class >() {{
25
25
put ("elapsedtime" , Integer .class );
26
26
put ("tags" , PyList .class );
@@ -45,12 +45,12 @@ public void endSuite(String name, Map attrs) {
45
45
46
46
public void startTest (String name , Map attrs ) {
47
47
verifyAttributes ("START TEST" , attrs ,
48
- new String [] {"id" , "doc" , "starttime" , "longname" , "tags" , "critical" , "template" });
48
+ new String [] {"id" , "doc" , "starttime" , "longname" , "origname" , " tags" , "critical" , "template" });
49
49
}
50
50
51
51
public void endTest (String name , Map attrs ) {
52
52
verifyAttributes ("END TEST" , attrs ,
53
- new String [] {"id" , "doc" , "starttime" , "longname" , "tags" , "critical" , "template" , "endtime" , "elapsedtime" , "status" , "message" });
53
+ new String [] {"id" , "doc" , "starttime" , "longname" , "origname" , " tags" , "critical" , "template" , "endtime" , "elapsedtime" , "status" , "message" });
54
54
}
55
55
56
56
public void startKeyword (String name , Map attrs ) {
@@ -72,18 +72,19 @@ private void verifyAttributes(String methodName, Map attrs, String[] names) {
72
72
outfile .write (methodName + "\n " );
73
73
if (attrs .size () != names .length ) {
74
74
outfile .write ("FAILED: wrong number of attributes\n " );
75
- outfile .write ("Expected: " + names + "\n " + "Actual: " + attrs .keySet () + "\n " );
75
+ outfile .write ("Expected: " + Arrays . toString ( names ) + "\n " + "Actual: " + attrs .keySet () + "\n " );
76
76
}
77
77
else {
78
78
for (String name : names ) {
79
+ if (name .equals ("origname" ))
80
+ continue ;
79
81
Object attr = attrs .get (name );
80
82
String status = "PASSED" ;
81
83
Class expectedClass = Class .forName ("java.lang.String" );
82
84
if (expectedTypes .containsKey (name ))
83
85
expectedClass = (Class )expectedTypes .get (name );
84
- if (!(attr .getClass ()).equals (expectedClass )) {
86
+ if (!(attr .getClass ()).equals (expectedClass ))
85
87
status = "FAILED" ;
86
- }
87
88
outfile .write (status + " | " + name + ": " + attr .getClass () + "\n " );
88
89
}
89
90
}
0 commit comments