package com.gurkensalat.osm.repository;

import com.gurkensalat.osm.entity.DitibPlace;
import org.junit.Before;
import org.junit.Test;
import org.mockito.MockitoAnnotations;

import java.io.File;
import java.io.IOException;
import java.util.List;

import static org.junit.Assert.assertNotNull;

public class DitibRepositoryImplTest
{
    DitibRepositoryImpl testable;

    @Before
    public void setUp()
    {
        MockitoAnnotations.initMocks(this);
        testable = new DitibRepositoryImpl();
    }

    @Test
    public void parseGermeringData() throws IOException
    {
        File file = new File("src/test/resources/ditib-germering.html");

        List<DitibPlace> result = testable.parse(file);

        assertNotNull(result);
    }

    @Test
    public void prettifyGermeringData() throws IOException
    {
        File file = new File("src/test/resources/ditib-germering.html");

        testable.prettify(new File("target"), file);
    }
}

@@ -241,16 +241,61 @@
 .List;%0A%0A
+import static org.junit.Assert.assertEquals;%0A
 import s
@@ -780,16 +780,186 @@
 esult);%0A
+        assertEquals(1, result.size());%0A%0A        DitibPlace place = result.get(0);%0A        assertNotNull(place);%0A        assertEquals(%22GERMERING%22, place.getDitibCode());%0A
     %7D%0A%0A 

Validate parsed results