@@ -0,0 +1,2681 @@
+/*%0A * Copyright 2019 %22Masahiko Sakamoto%22 %3Csakamoto.gsyc.3s@gmail.com%3E%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage javasnack.junit;%0A%0Aimport static org.junit.jupiter.api.Assertions.assertEquals;%0A%0Aimport java.util.UUID;%0A%0Aimport org.junit.jupiter.api.AfterAll;%0Aimport org.junit.jupiter.api.AfterEach;%0Aimport org.junit.jupiter.api.BeforeAll;%0Aimport org.junit.jupiter.api.BeforeEach;%0Aimport org.junit.jupiter.api.RepeatedTest;%0Aimport org.junit.jupiter.api.Test;%0Aimport org.junit.jupiter.api.TestInstance;%0Aimport org.junit.jupiter.api.TestInstance.Lifecycle;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A/**%0A * @see https://junit.org/junit5/docs/current/user-guide/#writing-tests-test-instance-lifecycle%0A */%0A@TestInstance(Lifecycle.PER_CLASS)%0Apublic class TestJUni5PerClassLifecycle %7B%0A%0A    private static final Logger LOG = LoggerFactory.getLogger(TestJUni5PerClassLifecycle.class);%0A%0A    private static final String MYUUID = UUID.randomUUID().toString();%0A%0A    private final String instanceUUID = UUID.randomUUID().toString();%0A%0A    static %7B%0A        LOG.info(%22class loading static block, MYUUID=%7B%7D%22, MYUUID);%0A    %7D%0A%0A    public TestJUni5PerClassLifecycle() %7B%0A        LOG.info(%22constructor block, instanceUUID = %7B%7D%22, instanceUUID);%0A    %7D%0A%0A    @BeforeAll%0A    public static void beforeAll() throws Exception %7B%0A        LOG.info(%22beforeAll() called at %7B%7D%22, Thread.currentThread().getName());%0A    %7D%0A%0A    @AfterAll%0A    public static void afterAll() throws Exception %7B%0A        LOG.info(%22afterAll() called at %7B%7D%22, Thread.currentThread().getName());%0A    %7D%0A%0A    @BeforeEach%0A    public void beforeEach() throws Exception %7B%0A        LOG.info(%22beforeEach() called at %7B%7D%22, Thread.currentThread().getName());%0A    %7D%0A%0A    @AfterEach%0A    public void afterEach() throws Exception %7B%0A        LOG.info(%22afterEach() called at %7B%7D%22, Thread.currentThread().getName());%0A    %7D%0A%0A    @RepeatedTest(3)%0A    void repeatedTest() %7B%0A        LOG.info(%22repeatedTest() called.%22);%0A    %7D%0A%0A    @Test%0A    void assertDemo1() %7B%0A        final String expected = %22hello%22;%0A        final String actual = %22hello%22;%0A        assertEquals(expected, actual);%0A        LOG.info(%22assertDemo1() called.%22);%0A    %7D%0A%7D%0A

add @TestInstance(Lifecycle.PER_CLASS) sample.