Skip to content

TCK assertions wrong for Cache.invoke and wrapped exceptions #85

Description

@cruftex

TCK challange for:

  • CacheInvokeTest.noValueException()
  • CacheInvokeTest.removeException()
  • CacheInvokeTest.existingException()

The TCK entry processor in these tests produces the following exception:

javax.cache.processor.EntryProcessorException: java.lang.IllegalAccessError

and asserts that an exception will be thrown by invoke with cause java.lang.IllegalAccessError e.g. by:

try {
  cache.invoke(key, new ThrowExceptionEntryProcessor<Integer, String, Void>(IllegalAccessError.class));
  fail();
} catch (CacheException e) {
  assertTrue("expected IllegalAccessError; observed " + e.getCause(),
      e.getCause() instanceof IllegalAccessError);
}

The EntryProcessorException documentation states:

An implementation must wrap any {@link Exception} thrown by an
{@link EntryProcessor} in this exception.

This also applies to this type of exception itself.

Is the Spec enforcing that an EntryProcessorException must be passed on directly?

Proposed changes:

Change the TCK to test that an exception is wrapped by the cache implementation.

Change the TCK not to expect that the original exception is the immediate cause, but the root cause.

Any thoughts?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions