sleep();
// Create and Save Employee1 and Employee2 for Company1 in OSC1
String employeeFirstName1 = "Employee" + ERXRandomGUID.newGid();
String employeeLastName1 = "Jones";
Employee employee1_osc1 = Employee.createEmployee(editingContext_osc1, employeeFirstName1, employeeLastName1, Boolean.FALSE, company_osc1);
String employeeFirstName2 = "Employee" + ERXRandomGUID.newGid();
String employeeLastName2 = "Jones";
Employee employee2_osc1 = Employee.createEmployee(editingContext_osc1, employeeFirstName2, employeeLastName2, Boolean.FALSE, company_osc1);
editingContext_osc1.saveChanges();
sleep();
// Fetch employees for Company1 in OSC1
assertContainsExactlyEOs(new NSArray<Employee>(new Employee[] { employee1_osc1, employee2_osc1 }), company_osc1.employees());
// Fetch Company1 in OSC2
EOEditingContext editingContext_osc2 = ERXEC.newEditingContext(ERXObjectStoreCoordinatorPool._pool().nextObjectStore());
Company company_osc2 = Company.fetchCompany(editingContext_osc2, Company.NAME_KEY, companyName);
assertNotNull(company_osc2);
// Fetch and check employees for Company1 in OSC2
assertContainsExactlyEOs(new NSArray<Employee>(new Employee[] { employee1_osc1, employee2_osc1 }), company_osc2.employees());
// gonna break
NSArray employees_osc2 = company_osc2.employees();
Employee employee2_osc2 = (Employee) employees_osc2.objectAtIndex(0);
Employee employee1_osc2 = (Employee) employees_osc2.objectAtIndex(1);
Employee secondEmployee_osc2;
if (ERXEOControlUtilities.eoEquals(employee1_osc1, employee1_osc2)) {
secondEmployee_osc2 = employee2_osc2;
}
else {
secondEmployee_osc2 = employee1_osc2;