@BeforeClass
์ฃผ์ javadoc์ ๋ช
๋ น๋ฌธ๊ณผ ๋ฐ๋๋ก:
/** The <strong i="7">@BeforeClass</strong> methods of superclasses will be run before those the current class. */
@BeforeClass
์ด๋
ธํ
์ด์
์ด ๋ถ์ ์ํผํด๋์ค ๋ฉ์๋๋ ๋ค๋ฅธ @BeforeClass
๊ฐ ์๋ธํด๋์ค์ธ ๊ฒฝ์ฐ ํธ์ถ๋์ง ์์ต๋๋ค.
public abstract class SuperTest {
<strong i="13">@BeforeClass</strong>
public static void beforeClass() throws Exception {
fail("why don't you call me ?"); // never fails
}
}
public class MyTestA extends SuperTest {
<strong i="14">@BeforeClass</strong>
public static void beforeClass() {
fail("Thanks for calling"); // fails here
}
<strong i="15">@Test</strong>
public void test() {
fail("Failure expected from MyTestA.beforeClass()");
}
}
public class MyTestB extends SuperTest {
<strong i="16">@BeforeClass</strong>
public static void beforeClass() {
}
<strong i="17">@Test</strong>
public void test() {
fail("Failure expected from SuperTest.beforeClass()"); // fails here
}
}
์์ ํด๋์ค์ ๋ฉ์๋๋ ํ์ ํด๋์ค์ ๋์ผํ ์ด๋ฆ์ ๊ฐ์ง ๋ฉ์๋์ ์ํด ๊ฐ๋ ค์ง๋๋ค. @BeforeClass ๋ฉ์๋์ ๋ค๋ฅธ ์ด๋ฆ์ ์ง์ ํ๋ฉด ์ฌ๋ฐ๋ฅธ ์์๋ก ์คํ๋ฉ๋๋ค.
taral ๋๋ถ์ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค. @BeforeClass ์ javadoc์์ ์ฝ๊ฐ์ ์ธ๊ธ์ด ๋์์ด ๋ ์ ์์ต๋๋ค.
๊ฐ์ ๊ฒ์ ์ด์ฌํ ๋ฐฐ์ ์ต๋๋ค. @gonzen ์ด ๋งํ๋ฏ์ด javadoc์์ ์ฝ๊ฐ์ ์ธ๊ธ์ ์ํฉ์ ์์ ํ ํผํ๋ ๋ฐ ๋์์ด ๋ ์ ์์ต๋๋ค. ์๋ฏธ๊ฐ ์๋ค๋ฉด javadoc์ ์ถ๊ฐํ๊ณ ํจ์น๋ฅผ ์ ์ถํ ์ ์์ต๋๋ค.
@amalakar , javadoc ํจ์น๋ ํ์คํ ๊ฐ์ฌํ๊ฒ ์ต๋๋ค!
๋ค์์ ํ ๋ฆฌํ์คํธ์ ๋๋ค: https://github.com/KentBeck/junit/pull/504
๋๋.
: ๋๊ณผ์ ๋ช ๊ฐ์ง ํฐ ์ฐธ๊ณ ๊ฐ ์์๋ค http://junit.sourceforge.net/javadoc/org/junit/Before.html ๋น์ ์ด ๋ณผํด์ผํ๋ค๋ http://junit.org/javadoc/latest/ ๋์ , + ๋งํฌ ์ฝ์ด๋ณด๊ธฐ์์ ์ ๋ฌธ์๋ก ์ด๋ํฉ๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์์ ํด๋์ค์ ๋ฉ์๋๋ ํ์ ํด๋์ค์ ๋์ผํ ์ด๋ฆ์ ๊ฐ์ง ๋ฉ์๋์ ์ํด ๊ฐ๋ ค์ง๋๋ค. @BeforeClass ๋ฉ์๋์ ๋ค๋ฅธ ์ด๋ฆ์ ์ง์ ํ๋ฉด ์ฌ๋ฐ๋ฅธ ์์๋ก ์คํ๋ฉ๋๋ค.