[
https://issues.apache.org/jira/browse/IGNITE-10179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16750329#comment-16750329
]
Oleg Ignatenko commented on IGNITE-10179:
-----------------------------------------
(i) per my preliminary testing, the right way to fix things would be to use
custom runner with GridAbstractTest instead of RunRule:
{code:java}
/** */
public static class HelperRunner extends BlockJUnit4ClassRunner {
/** */
public HelperRunner(Class<?> klass) throws InitializationError {
super(klass);
}
/** {@inheritDoc} */
@Override protected Statement methodInvoker(final FrameworkMethod mtd,
Object test) {
return super.methodInvoker(new FrameworkMethod(mtd.getMethod()){
/** */
@Override public Object invokeExplosively(Object target,
Object... params) throws Throwable {
System.out.println(">>> from HelperRunner methodInvoker
invokeExplosively: "
+ (target instanceof GridAbstractTest));
//todo find a way to wrap below invokation into
GridAbstractTest magic
return super.invokeExplosively(target, params); // this is
invoked after @Before and prior to @After
}
}, test);
}
}{code}
This solution, however, appears to depend on merge of IGNITE-10758 which
removes scaffolding annotations {{RunWith(JUnit4.class)}} from subclasses
because otherwise these annotations would break above custom runner.
> Change new tests root to use @BeforeClass and @AfterClass instead of
> isFirstTest() and isLastTest()
> ---------------------------------------------------------------------------------------------------
>
> Key: IGNITE-10179
> URL: https://issues.apache.org/jira/browse/IGNITE-10179
> Project: Ignite
> Issue Type: Sub-task
> Reporter: Oleg Ignatenko
> Assignee: Oleg Ignatenko
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> If needed, refer parent task for more details.
> isFirstTest() and isLastTest() homebrew methods seem to be in
> GridAbstractTest only because Junit 3 lacked necessary functionality; after
> migration to Junit 4 these would better changed to use standard API of this
> framework.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)