/**
 * Copyright (c) 2014 Chiral Behaviors, LLC, all rights reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.chiralbehaviors.ultrastructure.calendar.workspace;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.time.Instant;

import org.junit.BeforeClass;
import org.junit.Test;

import com.chiralbehaviors.CoRE.attribute.Attribute;
import com.chiralbehaviors.CoRE.attribute.ValueType;
import com.chiralbehaviors.CoRE.attribute.unit.Unit;
import com.chiralbehaviors.CoRE.meta.models.AbstractModelTest;
import com.chiralbehaviors.CoRE.time.Interval;
import com.chiralbehaviors.ultrastructure.calendar.archetype.Event;

/**
 * @author hparry
 *
 */
public class CalendarTranslationTest extends AbstractModelTest {

    private static CalendarWorkspaceBootstrap calWs;

    @BeforeClass
    public static void init() {
        calWs = new CalendarWorkspaceBootstrap(model);
        calWs.createWorkspace();
    }

    @Test
    public void testStartDate() {
        em.getTransaction().begin();
        Instant now = Instant.now();
        Event surviveThisMeeting = new Event("Survive this meeting",
                                             "christ it will never end", now,
                                             calWs, model);
        em.getTransaction().commit();

        em.getTransaction().begin();
        Instant later = Instant.ofEpochMilli(now.getEpochSecond() + 20);
        surviveThisMeeting.setEndDate(later);
        em.getTransaction().commit();

        assertEquals(later.toEpochMilli(),
                     surviveThisMeeting.getInterval().getStart().longValue()
                             + surviveThisMeeting.getInterval().getDuration().longValue());

    }

}

@@ -734,88 +734,8 @@
 als;
-%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;
 %0A%0Aim
@@ -817,167 +817,8 @@
 t;%0A%0A
-import com.chiralbehaviors.CoRE.attribute.Attribute;%0Aimport com.chiralbehaviors.CoRE.attribute.ValueType;%0Aimport com.chiralbehaviors.CoRE.attribute.unit.Unit;%0A
 impo
@@ -880,55 +880,8 @@
 st;%0A
-import com.chiralbehaviors.CoRE.time.Interval;%0A
 impo

Fix test