assertEquals("HelloHello", actual);
}
@Test
public void whenNewAnyArgumentsWorksInClassesWithMultipleCtors() throws Exception {
ExpectNewWithMultipleCtorDemo mock1 = mock(ExpectNewWithMultipleCtorDemo.class);
Service mock2 = mock(Service.class);
whenNew(ExpectNewWithMultipleCtorDemo.class).withAnyArguments().thenReturn(mock1);
when(mock1.useService()).thenReturn("message");
// When
final String message1 = new ExpectNewWithMultipleCtorDemo(mock2).useService();
final String message2 = new ExpectNewWithMultipleCtorDemo(mock2, 5).useService();
assertEquals(message1, "message");
assertEquals(message2, "message");
}