Package org.dddlib.organisation.domain

Source Code of org.dddlib.organisation.domain.AccountabilityTest

package org.dddlib.organisation.domain;

import org.dayatang.utils.DateUtils;
import org.dddlib.organisation.utils.OrganisationUtils;
import org.junit.Test;

import java.util.Date;
import java.util.List;

import static org.junit.Assert.assertTrue;

public class AccountabilityTest extends AbstractIntegrationTest {

    @SuppressWarnings("rawtypes")
    @Test
    public final void testFindAccountabilities() {
        OrganisationUtils organisationUtils = new OrganisationUtils();
        Date date = DateUtils.date(2012, 1, 3);
        Company company = organisationUtils.createCompany("总公司", date);
        Department financial = organisationUtils.createDepartment("财务部", company, date);
        Person person = organisationUtils.createPerson("Martin", "Fowler");
        Employee employee = organisationUtils.createEmployee(person, date);
        Employment employment = new Employment(company, employee, date);
        employment.save();
        List<Accountability> results = Accountability.findAccountabilities(Accountability.class, date);
        // 断言找到所有的子类实例。
        OrgLineMgmt lineMgmt = OrgLineMgmt.getByResponsible(financial, date);
        assertTrue(results.contains(lineMgmt));
        assertTrue(results.contains(employment));
    }

}
TOP

Related Classes of org.dddlib.organisation.domain.AccountabilityTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.