commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <>
Subject Re: svn commit: r1479663 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/exception/
Date Tue, 07 May 2013 07:09:57 GMT
Hi Benedikt,

Benedikt Ritter wrote:

> I have reverted the commit and commented why we use an anonymous subclass
> of DefaultExpectionContext. But to be honest I don't really see the point.
> Since the signature of the constructor is
> public ContextedRuntimeException(final String message, final Throwable
> cause, ExceptionContext context)
> every class that implements ExceptionContext can be passed in. Surely all
> subclasses of DefaultExceptionContext implement ExceptionContext. This is
> just how the language works...
> What am I missing here?

The constructor code does:

if (expectionContext == null) {
  exceptionContext = new DefaultExceptionContext();

Therefore the difference of passing "null" or "new 
DefaultExceptionContext()" is moot ... however passing "null" is tested 
implicitly by all other constructors.

Basically I admit, that the test could really be improved to show that the 
implementation can use an arbitrary ExceptionContext implementation (e.g. by 
using a mock), but that's currently all we have ;-)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message