use of org.powermock.reflect.testclasses.ClassWithPrivateMethods in project powermock by powermock.
the class WhiteBoxTest method testInvokeVarArgsMethod_multipleValues.
@Test
public void testInvokeVarArgsMethod_multipleValues() throws Exception {
ClassWithPrivateMethods tested = new ClassWithPrivateMethods();
assertEquals(6, Whitebox.invokeMethod(tested, "varArgsMethod", 1, 2, 3));
}
use of org.powermock.reflect.testclasses.ClassWithPrivateMethods in project powermock by powermock.
the class WhiteBoxTest method testInvokeVarArgsMethod_invokeVarArgsWithOneArgument.
@Test
public void testInvokeVarArgsMethod_invokeVarArgsWithOneArgument() throws Exception {
ClassWithPrivateMethods tested = new ClassWithPrivateMethods();
assertEquals(1, Whitebox.invokeMethod(tested, "varArgsMethod", new Class<?>[] { int[].class }, 1));
}
use of org.powermock.reflect.testclasses.ClassWithPrivateMethods in project powermock by powermock.
the class WhiteBoxTest method testInvokeVarArgsMethod_oneArgument.
@Test
public void testInvokeVarArgsMethod_oneArgument() throws Exception {
ClassWithPrivateMethods tested = new ClassWithPrivateMethods();
assertEquals(4, Whitebox.invokeMethod(tested, "varArgsMethod", 2));
}
use of org.powermock.reflect.testclasses.ClassWithPrivateMethods in project powermock by powermock.
the class WhiteBoxTest method testInvokeMethodWithBothNormalAndVarArgsParameter.
/**
* Asserts that <a
* href="http://code.google.com/p/powermock/issues/detail?id=118">issue
* 118</a> is fixed. Thanks to cemcatik for finding this.
*/
@Test
public void testInvokeMethodWithBothNormalAndVarArgsParameter() throws Exception {
ClassWithPrivateMethods tested = new ClassWithPrivateMethods();
assertEquals(4, Whitebox.invokeMethod(tested, "varArgsMethod2", 1, 2, 3));
}
use of org.powermock.reflect.testclasses.ClassWithPrivateMethods in project powermock by powermock.
the class WhiteBoxTest method testSetInternalStateBasedOnObjectSubClassType.
@Test
public void testSetInternalStateBasedOnObjectSubClassType() throws Exception {
final ClassWithPrivateMethods value = new ClassWithPrivateMethods() {
};
ClassWithChildThatHasInternalState tested = new ClassWithChildThatHasInternalState() {
};
Whitebox.setInternalState(tested, value);
assertSame(value, tested.getClassWithPrivateMethods());
}
Aggregations