@Test
public void testNewWithWrongArgument() throws Exception {
final int numberOfTimes = 2;
final String expected = "used";
ExpectNewDemo tested = new ExpectNewDemo();
ExpectNewServiceUser expectNewServiceImplMock = createMock(ExpectNewServiceUser.class);
Service serviceMock = createMock(Service.class);
expectNew(ExpectNewServiceUser.class, serviceMock, numberOfTimes).andReturn(expectNewServiceImplMock);
expect(expectNewServiceImplMock.useService()).andReturn(expected);
replayAll();
try {
assertEquals(expected, tested.newWithWrongArguments(serviceMock, numberOfTimes));
verifyAll();
fail("Should throw AssertionError!");
} catch (AssertionError e) {
assertEquals(
"\n Unexpected constructor call samples.expectnew.ExpectNewServiceUser(EasyMock for interface samples.Service, 4):"