ExpectNewDemo tested = new ExpectNewDemo();
expectNew(DataInputStream.class, new Object[] { null }).andThrow(new RuntimeException("error"));
replay(ExpectNewDemo.class, DataInputStream.class);
InputStream stream = tested.alternativePath();
verify(ExpectNewDemo.class, DataInputStream.class);
assertNotNull("The returned inputstream should not be null.", stream);
assertTrue("The returned inputstream should be an instance of ByteArrayInputStream.", stream instanceof ByteArrayInputStream);