카테고리 없음

[junit5] spring 5, junit 5, mapper test

냐옴 2022. 10. 8. 09:01

 

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;

import static org.assertj.core.api.Assertions.assertThat;

@ExtendWith(SpringExtension.class)
@ContextConfiguration(locations = {
        "classpath:spring/root-context.xml",
        "classpath:spring/app-servlet-context.xml"
})
@WebAppConfiguration
class CodeServiceTest {

    @Autowired
    CodeMapper codeMapper;

    @Autowired
    CodeService codeService;

    @Test
    void notNull() {
        assertThat(codeMapper).isNotNull();
        assertThat(codeService).isNotNull();
    }
}