package com.heibaiying.dao;

import com.heibaiying.bean.Relation;
import com.heibaiying.config.DispatcherServletInitializer;
import com.heibaiying.config.ServletConfig;
import com.heibaiying.dao.impl.MysqlDao;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

/**
 * @author : heibaiying
 * @description :
 */

@RunWith(SpringRunner.class)
@ContextConfiguration(classes = {DispatcherServletInitializer.class, ServletConfig.class})
public class MysqlDaoTest {

    @Autowired
    private MysqlDao mysqlDao;

    @Test
    public void get() {
        List<Relation> relations = mysqlDao.get();
        if (relations != null) {
            for (Relation relation : relations) {
                System.out.println(relation.getId() + " " + relation.getName());
            }
        }
    }
}
