package org.bdxjug.api.infrastructure.sheet;

import org.bdxjug.api.domain.meetings.Location;
import org.bdxjug.api.domain.meetings.LocationID;
import org.bdxjug.api.domain.members.Member;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;

import java.time.LocalDate;
import java.util.Optional;

import static org.assertj.core.api.Assertions.assertThat;

@SpringBootTest
@RunWith(SpringRunner.class)
@ActiveProfiles("test")
public class SheetLocationRepositoryTest {

    @Autowired
    private SheetLocationRepository repository;

    @Test
    public void should_find_enseirb() {
        Optional<Location> enseirb = repository.all().stream().filter(l -> l.getId().equals(new LocationID("ENSEIRB_A"))).findFirst();

        assertThat(enseirb.isPresent()).isTrue();
        assertThat(enseirb.get().getName()).isEqualTo("ENSEIRB");
        assertThat(enseirb.get().getAddress()).startsWith("1");
        assertThat(enseirb.get().getRoom()).isEqualTo("Amphi A");
        assertThat(enseirb.get().getGeo()).isNotNull();
    }
}
@@ -37,17 +37,19 @@
 e.sheet;
-%0A
+%0D%0A%0D
 %0Aimport 
@@ -88,16 +88,17 @@
 ocation;
+%0D
 %0Aimport 
@@ -143,53 +143,9 @@
 nID;
-%0Aimport org.bdxjug.api.domain.members.Member;
+%0D
 %0Aimp
@@ -159,24 +159,25 @@
 .junit.Test;
+%0D
 %0Aimport org.
@@ -197,16 +197,17 @@
 RunWith;
+%0D
 %0Aimport 
@@ -261,16 +261,17 @@
 towired;
+%0D
 %0Aimport 
@@ -323,16 +323,17 @@
 ootTest;
+%0D
 %0Aimport 
@@ -380,16 +380,17 @@
 rofiles;
+%0D
 %0Aimport 
@@ -446,37 +446,11 @@
 ner;
-%0A%0Aimport java.time.LocalDate;
+%0D%0A%0D
 %0Aimp
@@ -472,17 +472,19 @@
 ptional;
-%0A
+%0D%0A%0D
 %0Aimport 
@@ -533,17 +533,19 @@
 ertThat;
-%0A
+%0D%0A%0D
 %0A@Spring
@@ -552,16 +552,17 @@
 BootTest
+%0D
 %0A@RunWit
@@ -582,16 +582,17 @@
 r.class)
+%0D
 %0A@Active
@@ -607,16 +607,17 @@
 (%22test%22)
+%0D
 %0Apublic 
@@ -651,17 +651,19 @@
 ryTest %7B
-%0A
+%0D%0A%0D
 %0A    @Au
@@ -669,16 +669,17 @@
 utowired
+%0D
 %0A    pri
@@ -718,17 +718,19 @@
 ository;
-%0A
+%0D%0A%0D
 %0A    @Te
@@ -731,16 +731,17 @@
    @Test
+%0D
 %0A    pub
@@ -772,16 +772,17 @@
 eirb() %7B
+%0D
 %0A       
@@ -908,17 +908,19 @@
 First();
-%0A
+%0D%0A%0D
 %0A       
@@ -961,16 +961,17 @@
 sTrue();
+%0D
 %0A       
@@ -1028,16 +1028,17 @@
 SEIRB%22);
+%0D
 %0A       
@@ -1093,16 +1093,17 @@
 th(%221%22);
+%0D
 %0A       
@@ -1160,16 +1160,17 @@
 phi A%22);
+%0D
 %0A       
@@ -1221,12 +1221,14 @@
 l();
+%0D
 %0A    %7D
+%0D
 %0A%7D

fix imports.