What steps will reproduce the problem?
// the following code is free to modify and copy
private static class PrivateBean2 {
public String getFoo() {
return "foo";
}
}
@Test(expected=InvocationException.class)
public void testThatHavingHideAccessViolationProblems(){
PrivateBean2 bean = new PrivateBean2();
Matcher matcher = having(on(PrivateBean2.class).getFoo(), equalTo("foo"));
matcher.matches(bean); // this will cause access to a private class from
// the caller (which is HasArgumentWithValue).
}
What is the expected output? What do you see instead?
As stated in the test I expected an InvocationException.
What version of the product are you using? On what operating system?
sources from the trunk.
Please provide any additional information below.
I think that the problem is in HasArgumentWithValue#matches() which ignores any
exception returning false.
// from HasArgumentWithValue.java
public boolean matches(Object item) {
if (argument == null) return false;
try {
return value.matches(argument.evaluate(item));
} catch (Exception e) {
return false;
}
}
Original issue reported on code.google.com by andrea.f...@gmail.com on 27 Aug 2009 at 4:23
Original issue reported on code.google.com by
andrea.f...@gmail.com
on 27 Aug 2009 at 4:23