use of samples.expectnew.SimpleVarArgsConstructorDemo in project powermock by powermock.
the class WhenNewCases method testNewWithArrayVarArgsWhenAllArgumentsAreNull.
@Test
public void testNewWithArrayVarArgsWhenAllArgumentsAreNull() throws Exception {
ExpectNewDemo tested = new ExpectNewDemo();
SimpleVarArgsConstructorDemo varArgsConstructorDemoMock = mock(SimpleVarArgsConstructorDemo.class);
final byte[] byteArrayOne = null;
final byte[] byteArrayTwo = null;
whenNew(SimpleVarArgsConstructorDemo.class).withArguments(byteArrayOne, byteArrayTwo).thenReturn(varArgsConstructorDemoMock);
when(varArgsConstructorDemoMock.getByteArrays()).thenReturn(new byte[][] { byteArrayTwo });
byte[][] varArgs = tested.newSimpleVarArgs(byteArrayOne, byteArrayTwo);
assertEquals(1, varArgs.length);
assertSame(byteArrayTwo, varArgs[0]);
verifyNew(SimpleVarArgsConstructorDemo.class).withArguments(byteArrayOne, byteArrayTwo);
}
Aggregations