Spring 프로젝트

Spring test Ex1

테라시아 2025. 1. 26. 21:41

Spring에서 test를 통해 작동을 테스트해볼수 있다.

 

Mapper Test

 

☆ Code

import com.KoreaItAcdemy.OurNotion.util.MyUtil;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
@Slf4j
public class TimeMapperTest {

    @Autowired
    private TimeMapper mapper;

    @Test
    public void testGetTime1() {
        log.info("------------------------------");
        log.info("Current Time 1 : " + MyUtil.BOLD + mapper.getTime1() + MyUtil.END);
        log.info("------------------------------");
    }

    @Test
    public void testGetTime2() {
        log.info("------------------------------");
        log.info("Current Time 2 : " + MyUtil.BOLD + mapper.getTime2() + MyUtil.END);
        log.info("------------------------------");
    }
}