package urchin.domain.repository;

import org.junit.Before;
import org.junit.Test;
import urchin.domain.model.Group;
import urchin.domain.model.GroupId;
import urchin.testutil.TestApplication;

import java.time.LocalDateTime;
import java.util.Optional;

import static org.junit.Assert.*;

public class GroupRepositoryIT extends TestApplication {

    private GroupRepository groupRepository;

    @Before
    public void setup() {
        groupRepository = new GroupRepository(jdbcTemplate);
    }

    @Test
    public void crd() {
        LocalDateTime now = LocalDateTime.now();
        Group group = new Group("groupname");

        GroupId groupId = groupRepository.saveGroup(group);
        Optional<Group> groupOptional = groupRepository.getGroup(groupId);

        assertTrue(groupOptional.isPresent());
        Group readGroup = groupOptional.get();
        assertEquals(group.getName(), readGroup.getName());
        assertTrue(now.isBefore(readGroup.getCreated()));

        groupRepository.removeGroup(groupId);

        assertFalse(groupRepository.getGroup(groupId).isPresent());
    }
}
@@ -930,19 +930,20 @@
 sert
-Tru
+Fals
 e(now.is
 Befo
@@ -938,22 +938,21 @@
 e(now.is
-Before
+After
 (readGro

fix for time dependent test