下面对各个用例进行详细分析
增加雇员
增加雇员采用命令模式(适用于数据库事务操作)
增加雇员将雇员的支付薪水时间表和他们的支付薪水类别关联起来
现在采用测试优先的方法去编写代码:由于是增量迭代的过程,所以代码只是部分片段,完整代码后期会上传至github以及csdn上
package salary;
import implement.classification.CommissionedClassification;
import implement.classification.HourlyClassification;
import implement.classification.SalariedClassification;
import implement.database.PayrollDatabase;
import implement.transaction.AddCommissionedEmployee;
import implement.transaction.AddHourlyEmployee;
import implement.entity.Employee;
import implement.method.HoldMethod;
import implement.schedule.MonthlySchedule;
import implement.transaction.AddSalariedEmployee;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* 1.增加雇员测试
* Created by ZD on 2017/10/24.
*/
public class AddEmployTransactionTest {
PayrollDatabase payrollDatabase = PayrollDatabase.getPayrollDatabase();
/*
*增加正常雇员
*/
@Test
public void testaddSalariedEmployee(){
int empId = 1;
String name = "Bob";
String address = "Bob.home";
double monthlyPay