https://www.codetd.com/en/article/6835684 //multi datasource 일 경우
http://mybatis.org/spring-boot-starter/mybatis-spring-boot-test-autoconfigure/
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);
}
}