[ 
https://issues.apache.org/jira/browse/HDDS-6729?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kaijie Chen updated HDDS-6729:
------------------------------
    Description: 
Use the following command to find all tests that are still using JUnit4.
{code:java}
grep -rlE "org.junit.[A-Z]" . --include '*.java'{code}
Use the following command to find all tests that are still using JUnit3 
components.
{code:java}
grep -rl "junit.framework" . --include '*.java'{code}
Script for the class substitution:
{code:bash}
sed -i $1 \
        -e 's/org.junit.After;/org.junit.jupiter.api.AfterEach;/' \
        -e 's/@After$/@AfterEach/' \
        -e 's/org.junit.AfterClass;/org.junit.jupiter.api.AfterAll;/' \
        -e 's/@AfterClass$/@AfterAll/' \
        -e 's/org.junit.Before;/org.junit.jupiter.api.BeforeEach;/' \
        -e 's/@Before$/@BeforeEach/' \
        -e 's/org.junit.BeforeClass;/org.junit.jupiter.api.BeforeAll;/' \
        -e 's/@BeforeClass$/@BeforeAll/' \
        -e 's/org.junit.Test/org.junit.jupiter.api.Test/' \
        -e 's/org.junit.Assert/org.junit.jupiter.api.Assertions/' \
        -e 's/junit.framework.TestCase/org.junit.jupiter.api.Assertions/' \
        -e 's/Assert\./Assertions./'
{code}

  was:
Use the following command to find all tests that are still using JUnit4.
{code:java}
grep -rl "org.junit.Test" . --include '*.java'{code}
Use the following command to find all tests that are still using JUnit3 
components.
{code:java}
grep -rl "junit.framework" . --include '*.java'{code}
Script for the class substitution:
{code:bash}
sed -i $1 \
        -e 's/org.junit.After;/org.junit.jupiter.api.AfterEach;/' \
        -e 's/@After$/@AfterEach/' \
        -e 's/org.junit.AfterClass;/org.junit.jupiter.api.AfterAll;/' \
        -e 's/@AfterClass$/@AfterAll/' \
        -e 's/org.junit.Before;/org.junit.jupiter.api.BeforeEach;/' \
        -e 's/@Before$/@BeforeEach/' \
        -e 's/org.junit.BeforeClass;/org.junit.jupiter.api.BeforeAll;/' \
        -e 's/@BeforeClass$/@BeforeAll/' \
        -e 's/org.junit.Test/org.junit.jupiter.api.Test/' \
        -e 's/org.junit.Assert/org.junit.jupiter.api.Assertions/' \
        -e 's/junit.framework.TestCase/org.junit.jupiter.api.Assertions/' \
        -e 's/Assert\./Assertions./'
{code}


> Migrate tests to JUnit5
> -----------------------
>
>                 Key: HDDS-6729
>                 URL: https://issues.apache.org/jira/browse/HDDS-6729
>             Project: Apache Ozone
>          Issue Type: Improvement
>          Components: test
>            Reporter: Kaijie Chen
>            Assignee: Kaijie Chen
>            Priority: Minor
>
> Use the following command to find all tests that are still using JUnit4.
> {code:java}
> grep -rlE "org.junit.[A-Z]" . --include '*.java'{code}
> Use the following command to find all tests that are still using JUnit3 
> components.
> {code:java}
> grep -rl "junit.framework" . --include '*.java'{code}
> Script for the class substitution:
> {code:bash}
> sed -i $1 \
>       -e 's/org.junit.After;/org.junit.jupiter.api.AfterEach;/' \
>       -e 's/@After$/@AfterEach/' \
>       -e 's/org.junit.AfterClass;/org.junit.jupiter.api.AfterAll;/' \
>       -e 's/@AfterClass$/@AfterAll/' \
>       -e 's/org.junit.Before;/org.junit.jupiter.api.BeforeEach;/' \
>       -e 's/@Before$/@BeforeEach/' \
>       -e 's/org.junit.BeforeClass;/org.junit.jupiter.api.BeforeAll;/' \
>       -e 's/@BeforeClass$/@BeforeAll/' \
>       -e 's/org.junit.Test/org.junit.jupiter.api.Test/' \
>       -e 's/org.junit.Assert/org.junit.jupiter.api.Assertions/' \
>       -e 's/junit.framework.TestCase/org.junit.jupiter.api.Assertions/' \
>       -e 's/Assert\./Assertions./'
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to