@@ -0,0 +1,2546 @@
+package com.yammer.stresstime.resources;%0A%0Aimport com.yammer.stresstime.entities.Employee;%0Aimport com.yammer.stresstime.entities.Group;%0Aimport com.yammer.stresstime.entities.Membership;%0Aimport com.yammer.stresstime.fixtures.EmployeesFixture;%0Aimport com.yammer.stresstime.fixtures.GroupsFixture;%0Aimport com.yammer.stresstime.fixtures.MembershipsFixture;%0Aimport com.yammer.stresstime.test.TestUtils;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.util.Arrays;%0Aimport java.util.List;%0Aimport java.util.stream.Collectors;%0A%0Aimport static org.hamcrest.MatcherAssert.assertThat;%0Aimport static org.hamcrest.core.IsEqual.equalTo;%0Aimport static org.hibernate.validator.internal.util.Contracts.assertNotNull;%0A%0Apublic class EmployeesResourceTest extends BaseResourceTest %7B%0A    private List%3CEmployee%3E employees;%0A    private List%3CMembership%3E memberships;%0A%0A    @Before%0A    public void setUp() throws Exception%7B%0A        super.setUp();%0A        EmployeesFixture employeesFixture = new EmployeesFixture();%0A        employeesFixture.save(getSessionFactory());%0A        employees = employeesFixture.getEmployees();%0A        GroupsFixture groupsFixture = new GroupsFixture();%0A        groupsFixture.save(getSessionFactory());%0A        MembershipsFixture membershipsFixture = new MembershipsFixture(employeesFixture, groupsFixture);%0A        membershipsFixture.save(getSessionFactory());%0A        memberships = membershipsFixture.getMemberships();%0A    %7D%0A%0A    @Test%0A    public void testGetEmployee() %7B%0A        employees.stream().forEach(e -%3E %7B%0A            Employee found = resource(String.format(%22/employees/%25s%22, e.getId())).get(Employee.class);%0A            assertNotNull(found);%0A            // Testing each parameter because method equals only tests id%0A            assertThat(found.getName(), equalTo(e.getName()));%0A            assertThat(found.getId(), equalTo(e.getId()));%0A            assertThat(found.getImageUrlTemplate(), equalTo(e.getImageUrlTemplate()));%0A        %7D);%0A    %7D%0A%0A    @Test%0A    public void testGetEmployeeGroups() %7B%0A        employees.stream().forEach(e -%3E %7B%0A            List%3CGroup%3E found =%0A                    Arrays.asList(resource(String.format(%22/employees/%25s/groups%22, e.getId())).get(Group%5B%5D.class));%0A            assertNotNull(found);%0A            List%3CGroup%3E expected = memberships.stream()%0A                    .filter(m -%3E m.getEmployee().equals(e))%0A                    .map(Membership::getGroup)%0A                    .collect(Collectors.toList());%0A            TestUtils.assertListOfEntitiesEqualsAnyOrder(found, expected);%0A        %7D);%0A    %7D%0A%7D%0A

Create EmployeesResourceTest