嘿嘿,JAVA里第一次运行单元测试成功,立存

按书上写的单元测试。

居然一次过,爽!!!

package org.smart4j.chapter2.test;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.smart4j.chapter2.model.Customer;
import org.smart4j.chapter2.service.CustomerService;
/**
 * Created by sahara on 2016/3/16.
 */
public class CustomerServiceTest {

    private final CustomerService customerService;

    public CustomerServiceTest() {
        customerService = new CustomerService();
    }

    @Before
    public void init() {
        // TODO
    }

    @Test
    public void getCutomerListTest() throws Exception {
        List<Customer> customerList = customerService.getCustomerList();
        Assert.assertEquals(2, customerList.size());
    }
}

嘿嘿,JAVA里第一次运行单元测试成功,立存