java-powermock-fix-tests.patch
1 | From 09f037e0fbb55e9a1f3762c64cad4bf72d14d971 Mon Sep 17 00:00:00 2001 |
2 | From: Julien Lepiller <julien@lepiller.eu> |
3 | Date: Tue, 22 Aug 2017 20:40:27 +0200 |
4 | Subject: [PATCH] Fix tests. |
5 | |
6 | --- |
7 | .../java/org/powermock/reflect/WhiteBoxTest.java | 30 +++++++++++----------- |
8 | .../reflect/internal/proxy/ClassFactory.java | 6 ++--- |
9 | 2 files changed, 18 insertions(+), 18 deletions(-) |
10 | |
11 | diff --git a/powermock-reflect/src/test/java/org/powermock/reflect/WhiteBoxTest.java b/powermock-reflect/src/test/java/org/powermock/reflect/WhiteBoxTest.java |
12 | index bf1e2e3..0d60487 100644 |
13 | --- a/powermock-reflect/src/test/java/org/powermock/reflect/WhiteBoxTest.java |
14 | +++ b/powermock-reflect/src/test/java/org/powermock/reflect/WhiteBoxTest.java |
15 | @@ -248,7 +248,7 @@ public class WhiteBoxTest { |
16 | |
17 | @Test |
18 | public void testMethodWithPrimitiveAndWrappedInt_primtive_wrapped() throws Exception { |
19 | - assertEquals(17, Whitebox.invokeMethod(new ClassWithPrivateMethods(), "methodWithPrimitiveAndWrappedInt", |
20 | + assertEquals((Integer)17, Whitebox.invokeMethod(new ClassWithPrivateMethods(), "methodWithPrimitiveAndWrappedInt", |
21 | new Class[]{int.class, Integer.class}, 9, Integer.valueOf(8))); |
22 | } |
23 | |
24 | @@ -257,7 +257,7 @@ public class WhiteBoxTest { |
25 | int expected = 123; |
26 | Whitebox.setInternalState(ClassWithInternalState.class, "staticState", expected); |
27 | assertEquals(expected, ClassWithInternalState.getStaticState()); |
28 | - assertEquals(expected, Whitebox.getInternalState(ClassWithInternalState.class, "staticState")); |
29 | + assertEquals(expected, (int)Whitebox.getInternalState(ClassWithInternalState.class, "staticState")); |
30 | } |
31 | |
32 | @Test |
33 | @@ -334,25 +334,25 @@ public class WhiteBoxTest { |
34 | @Test |
35 | public void testInvokeVarArgsMethod_multipleValues() throws Exception { |
36 | ClassWithPrivateMethods tested = new ClassWithPrivateMethods(); |
37 | - assertEquals(6, Whitebox.invokeMethod(tested, "varArgsMethod", 1, 2, 3)); |
38 | + assertEquals(6, (int)Whitebox.invokeMethod(tested, "varArgsMethod", 1, 2, 3)); |
39 | } |
40 | |
41 | @Test |
42 | public void testInvokeVarArgsMethod_noArguments() throws Exception { |
43 | ClassWithPrivateMethods tested = new ClassWithPrivateMethods(); |
44 | - assertEquals(0, Whitebox.invokeMethod(tested, "varArgsMethod")); |
45 | + assertEquals(0, (int)Whitebox.invokeMethod(tested, "varArgsMethod")); |
46 | } |
47 | |
48 | @Test |
49 | public void testInvokeVarArgsMethod_oneArgument() throws Exception { |
50 | ClassWithPrivateMethods tested = new ClassWithPrivateMethods(); |
51 | - assertEquals(4, Whitebox.invokeMethod(tested, "varArgsMethod", 2)); |
52 | + assertEquals(4, (int)Whitebox.invokeMethod(tested, "varArgsMethod", 2)); |
53 | } |
54 | |
55 | @Test |
56 | public void testInvokeVarArgsMethod_invokeVarArgsWithOneArgument() throws Exception { |
57 | ClassWithPrivateMethods tested = new ClassWithPrivateMethods(); |
58 | - assertEquals(1, Whitebox.invokeMethod(tested, "varArgsMethod", new Class<?>[]{int[].class}, 1)); |
59 | + assertEquals(1, (int)Whitebox.invokeMethod(tested, "varArgsMethod", new Class<?>[]{int[].class}, 1)); |
60 | } |
61 | |
62 | @Test |
63 | @@ -376,7 +376,7 @@ public class WhiteBoxTest { |
64 | ClassWithChildThatHasInternalState tested = new ClassWithChildThatHasInternalState() { |
65 | }; |
66 | Whitebox.setInternalState(tested, fieldName, value); |
67 | - assertEquals(value, Whitebox.getInternalState(tested, fieldName)); |
68 | + assertEquals(value, (int)Whitebox.getInternalState(tested, fieldName)); |
69 | } |
70 | |
71 | @Test |
72 | @@ -387,8 +387,8 @@ public class WhiteBoxTest { |
73 | ClassWithChildThatHasInternalState tested = new ClassWithChildThatHasInternalState() { |
74 | }; |
75 | Whitebox.setInternalState(tested, fieldName, value); |
76 | - assertEquals(value, Whitebox.getInternalState(tested, fieldName)); |
77 | - assertEquals(-1, Whitebox.getInternalState(tested, fieldName, ClassWithInternalState.class)); |
78 | + assertEquals(value, (int)Whitebox.getInternalState(tested, fieldName)); |
79 | + assertEquals(-1, (int)Whitebox.getInternalState(tested, fieldName, ClassWithInternalState.class)); |
80 | } |
81 | |
82 | @Test(expected = IllegalArgumentException.class) |
83 | @@ -398,7 +398,7 @@ public class WhiteBoxTest { |
84 | ClassWithChildThatHasInternalState tested = new ClassWithChildThatHasInternalState() { |
85 | }; |
86 | Whitebox.setInternalState(tested, fieldName, new Object()); |
87 | - assertEquals(value, Whitebox.getInternalState(tested, fieldName)); |
88 | + assertEquals(value, (int)Whitebox.getInternalState(tested, fieldName)); |
89 | } |
90 | |
91 | @Test(expected = IllegalArgumentException.class) |
92 | @@ -408,7 +408,7 @@ public class WhiteBoxTest { |
93 | ClassWithChildThatHasInternalState tested = new ClassWithChildThatHasInternalState() { |
94 | }; |
95 | Whitebox.setInternalState(tested, fieldName, (Object) null); |
96 | - assertEquals(value, Whitebox.getInternalState(tested, fieldName)); |
97 | + assertEquals(value, (int)Whitebox.getInternalState(tested, fieldName)); |
98 | } |
99 | |
100 | @Test |
101 | @@ -417,8 +417,8 @@ public class WhiteBoxTest { |
102 | ClassWithChildThatHasInternalState tested = new ClassWithChildThatHasInternalState(); |
103 | Whitebox.setInternalState(tested, int.class, value); |
104 | assertEquals(value, (int) Whitebox.getInternalState(tested, int.class)); |
105 | - assertEquals(value, Whitebox.getInternalState(tested, "anotherInternalState")); |
106 | - assertEquals(value, Whitebox.getInternalState(tested, "anotherInternalState", |
107 | + assertEquals(value, (int)Whitebox.getInternalState(tested, "anotherInternalState")); |
108 | + assertEquals(value, (int)Whitebox.getInternalState(tested, "anotherInternalState", |
109 | ClassWithChildThatHasInternalState.class)); |
110 | } |
111 | |
112 | @@ -429,7 +429,7 @@ public class WhiteBoxTest { |
113 | Whitebox.setInternalState(tested, int.class, value, ClassWithInternalState.class); |
114 | assertEquals(42, (int) Whitebox.getInternalState(tested, int.class)); |
115 | assertEquals(value, (int) Whitebox.getInternalState(tested, int.class, ClassWithInternalState.class)); |
116 | - assertEquals(value, Whitebox.getInternalState(tested, "staticState", ClassWithInternalState.class)); |
117 | + assertEquals(value, (int)Whitebox.getInternalState(tested, "staticState", ClassWithInternalState.class)); |
118 | } |
119 | |
120 | @Test |
121 | @@ -619,7 +619,7 @@ public class WhiteBoxTest { |
122 | @Test |
123 | public void testInvokeMethodWithBothNormalAndVarArgsParameter() throws Exception { |
124 | ClassWithPrivateMethods tested = new ClassWithPrivateMethods(); |
125 | - assertEquals(4, Whitebox.invokeMethod(tested, "varArgsMethod2", 1, 2, 3)); |
126 | + assertEquals(4, (int)Whitebox.invokeMethod(tested, "varArgsMethod2", 1, 2, 3)); |
127 | } |
128 | |
129 | @Test |
130 | diff --git a/powermock-reflect/src/test/java/org/powermock/reflect/internal/proxy/ClassFactory.java b/powermock-reflect/src/test/java/org/powermock/reflect/internal/proxy/ClassFactory.java |
131 | index a5e5fda..14b8bbe 100644 |
132 | --- a/powermock-reflect/src/test/java/org/powermock/reflect/internal/proxy/ClassFactory.java |
133 | +++ b/powermock-reflect/src/test/java/org/powermock/reflect/internal/proxy/ClassFactory.java |
134 | @@ -1,8 +1,8 @@ |
135 | package org.powermock.reflect.internal.proxy; |
136 | |
137 | -import net.sf.cglib.asm.ClassWriter; |
138 | -import net.sf.cglib.asm.MethodVisitor; |
139 | -import net.sf.cglib.asm.Opcodes; |
140 | +import org.objectweb.asm.ClassWriter; |
141 | +import org.objectweb.asm.MethodVisitor; |
142 | +import org.objectweb.asm.Opcodes; |
143 | |
144 | class ClassFactory implements Opcodes { |
145 | |
146 | -- |
147 | 2.13.4 |
148 | |
149 |