[ 
https://issues.apache.org/jira/browse/IGNITE-10176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16718914#comment-16718914
 ] 

Oleg Ignatenko commented on IGNITE-10176:
-----------------------------------------

(!) need to remove (if there are any) all {{@Before}} and {{@After}} 
annotations in methods that override {{beforeTest}} and {{afterTest}} from 
{{GridAbstractTest}}. Under JUnit 3 these were useless because ignored (but at 
least harmless), but under JUnit 4 there will be real harm because these will 
cause annotated methods be invoked twice.

I tried below code snippet to see how it breaks things: {code}
import org.junit.Before;
import org.junit.Test;

public class InappropriateAnnotationTest {

    public static class Child extends Parent {
        @Before
        @Override public void beforeTest() {
            System.out.println("beforeTest");
        }

        @Test
        public void someTest() {
            System.out.println("some test");
        }
    }

    public static class Parent {
        void beforeTest() {}

        @Before
        public void setUp() {
            System.out.println("setUp");
            beforeTest();
            System.out.println("setUp done");
        }
    }
}{code}

and when {{someTest}} is executed the output clearly shows that {{beforeTest}} 
is invoked twice: {noformat}
setUp
beforeTest
setUp done
beforeTest
some test
{noformat}

> migrate non-core modules tests from Junit 3 to 4
> ------------------------------------------------
>
>                 Key: IGNITE-10176
>                 URL: https://issues.apache.org/jira/browse/IGNITE-10176
>             Project: Ignite
>          Issue Type: Sub-task
>            Reporter: Oleg Ignatenko
>            Assignee: Oleg Ignatenko
>            Priority: Major
>
> If needed, refer parent task for more details.
> Migrate using new API introduced and tested at prior step.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to