Mybatis UnitTesting

공부는 혼자하는 거·2021년 9월 4일
0

Spring Tip

목록 보기
9/52

https://www.codetd.com/en/article/6835684 //multi datasource 일 경우

https://e2e2e2.tistory.com/12

http://mybatis.org/spring-boot-starter/mybatis-spring-boot-test-autoconfigure/

https://kjh95.tistory.com/343

package  ~~;

import java.util.List;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import lombok.extern.slf4j.Slf4j;
import net.lunalabs.central.domain.mysql.measuredata.MeasureData;
import net.lunalabs.central.domain.mysql.patient.Patient;
import net.lunalabs.central.mapper.mysql.MeasureDataMapper;
import net.lunalabs.central.mapper.mysql.PatientMapper;

@Slf4j
@ExtendWith(SpringExtension.class)
@SpringBootTest
public class IntegTest {

	@Qualifier("MysqlPatientMapper")
	@Autowired
	private PatientMapper patientMapper;
	
	@Qualifier("MysqlMeasureDataMapper")
	@Autowired
	private MeasureDataMapper mapper;

	
	
	@Test
    public void contextLoads() {
        List<Patient> list = patientMapper.findAll();
        System.out.println("확인:" + list);
    }	
	
	
	@Test
	public void findByContainIdTest() {
		List<Patient> list = patientMapper.findByContainId(7);
		
		log.info("findbyContainedIdList check: " + list);
				
		for (int i = 0; i < list.size(); i++) { 
				log.info(list.get(i).toString());
															
		}		
	}
	
	
	
	@Test
	public void findParamTest() {
		List<MeasureData> latestParames = mapper.findLatestParame();
		
		log.info("lastestParames: " + latestParames);
		
		List<MeasureData> rvsParames = mapper.findRvsAll();
		
		log.info("rvsParames: " + rvsParames);
	
	}
	
}
profile
시간대비효율

0개의 댓글