@@ -0,0 +1,2520 @@
+package com.yammer.stresstime.entities;%0A%0Aimport com.google.common.collect.ImmutableSet;%0Aimport com.yammer.stresstime.managers.AssignmentTypeManager;%0Aimport com.yammer.stresstime.managers.DayRestrictionManager;%0Aimport com.yammer.stresstime.test.DatabaseTest;%0Aimport org.joda.time.LocalDate;%0Aimport org.junit.Assert;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.util.Set;%0A%0Aimport static org.hamcrest.MatcherAssert.assertThat;%0Aimport static org.hamcrest.Matchers.hasItems;%0Aimport static org.hamcrest.collection.IsEmptyCollection.empty;%0Aimport static org.junit.Assert.assertNotNull;%0A%0Apublic class DayRestrictionTest extends DatabaseTest %7B%0A%0A    private DayRestrictionManager mDayRestrictionManager;%0A    private AssignmentTypeManager mAssignmentTypeManager;%0A%0A    @Before%0A    @Override%0A    public void setUp() throws Exception %7B%0A        super.setUp();%0A        mDayRestrictionManager = new DayRestrictionManager(getSessionFactory());%0A        mAssignmentTypeManager = new AssignmentTypeManager(getSessionFactory());%0A    %7D%0A%0A    @Test%0A    public void testHasEmptyAssignmentTypesAfterInstantiated() %7B%0A        DayRestriction restriction = new DayRestriction();%0A%0A        assertNotNull(restriction.getAssignmentTypes());%0A        assertThat(restriction.getAssignmentTypes(), empty());%0A    %7D%0A%0A    @Test%0A    public void testHasEmptyAssignmentTypesAfterRetrievedFromDb() %7B%0A        DayRestriction restriction = new DayRestriction();%0A        restriction.setDate(new LocalDate(2015, 3, 23));%0A        mDayRestrictionManager.save(restriction);%0A        refresh(restriction);%0A%0A        assertNotNull(restriction.getAssignmentTypes());%0A        assertThat(restriction.getAssignmentTypes(), empty());%0A%0A        mDayRestrictionManager.delete(restriction);%0A    %7D%0A%0A    @Test%0A    public void testRetrieveAssignmentTypeAfterBeingAdded() %7B%0A        AssignmentType type = new AssignmentType();%0A        type.setName(%22Primary%22);%0A        mAssignmentTypeManager.save(type);%0A%0A        DayRestriction restriction = new DayRestriction();%0A        restriction.setDate(new LocalDate(2015, 3, 23));%0A        Set%3CAssignmentType%3E assignmentTypes = new ImmutableSet.Builder%3CAssignmentType%3E()%0A                .addAll(restriction.getAssignmentTypes())%0A                .add(type).build();%0A        restriction.setAssignmentTypes(assignmentTypes);%0A        mDayRestrictionManager.save(restriction);%0A%0A        refresh(type, restriction);%0A%0A        Set%3CAssignmentType%3E types = restriction.getAssignmentTypes();%0A        Assert.assertThat(types, hasItems(type));%0A    %7D%0A%7D%0A

Add test for DayRestriction