下面对各个用例进行详细分析
增加雇员
增加雇员采用命令模式(适用于数据库事务操作)
增加雇员将雇员的支付薪水时间表和他们的支付薪水类别关联起来
现在采用测试优先的方法去编写代码:由于是增量迭代的过程,所以代码只是部分片段,完整代码后期会上传至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 =

本文详细分析了薪水支付系统的用例,重点介绍了如何使用命令模式处理增加雇员的数据库事务操作,并通过测试优先的方法进行代码编写。文章中提到了PayrollDatabase类作为Facade模式的应用,存储Employee和Member对象。此外,还应用了Template模式来增加雇员,并展示了部分源代码,包括AddHourlyEmployee的实现。
最低0.47元/天 解锁文章
1411

被折叠的 条评论
为什么被折叠?



