package br.gov.servicos.piwik;

import br.gov.servicos.Main;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import java.util.List;

import static org.junit.Assert.assertEquals;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Main.class)
@WebAppConfiguration
public class PiwikIntegrationTest {

    @Autowired
    PiwikClient piwikClient;

    @Test
    @Ignore("Configure o token em GDS_PIWIK_TOKEN")
    public void deveRetonarUrlsParaODia04042015() throws Exception {
        List<PiwikPage> pages = piwikClient.getPageUrls("day", "04-04-2015");

        assertEquals(pages.get(0).getPath(), "/");
        assertEquals(pages
                .stream()
                .filter(p -> p.getPath().get().equals("/repositorioServico/consulta-situacao-do-requerimento-de-beneficio"))
                .count(), 1);
    }

}
@@ -429,16 +429,56 @@
 .List;%0A%0A
+import static org.hamcrest.Matchers.is;%0A
 import s
@@ -506,22 +506,20 @@
 t.assert
-Equals
+That
 ;%0A%0A@RunW
@@ -930,30 +930,28 @@
       assert
-Equals
+That
 (pages.get(0
@@ -965,14 +965,24 @@
 th()
-, 
+.get(), is(
 %22/%22)
+)
 ;%0A  
@@ -997,14 +997,12 @@
 sert
-Equals
+That
 (pag
@@ -1181,17 +1181,21 @@
 ount(), 
-1
+is(1)
 );%0A    %7D
@@ -1197,8 +1197,9 @@
     %7D%0A%0A%7D
+%0A

Usa tipos Optional<String>