package tourplaner.tests;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import tourplaner.object.Log;
import tourplaner.object.Tour;

import java.time.LocalDate;
import java.util.ArrayList;

import static org.junit.jupiter.api.Assertions.*;

class TourTest {

    private Log log1, log2, log3;
    private Tour tour;
    private final LocalDate date = LocalDate.now();

    @BeforeEach
    void setUp() {
        this.tour = new Tour("String name", "String dauer", "String mapJson", 2, "String start", "String ziel");
        this.log1 = new Log("1", 2, this.date, 3, "4", 5, 6, "7");
        this.log2 = new Log("2", 2, this.date, 3, "4", 5, 6, "7");
        this.log3 = new Log("3", 2, this.date, 3, "4", 5, 6, "7");
    }

    @Test
    void setGetLogs() {
        ArrayList<Log> logs = new ArrayList<>();
        logs.add(log1);
        logs.add(log2);
        logs.add(log3);

        tour.setLog(logs);
        assertEquals(this.tour.getLogs(), logs);
    }


    @Test
    void addLog() {
        this.tour.addLog(this.log1);
        assertEquals(this.tour.getLog("1"), this.log1);
    }

    @Test
    void delLog() {
        this.tour.addLog(this.log1);
        this.tour.delLog("1");
        assertEquals(this.tour.getLogs(), new ArrayList<>());
    }

    @Test
    void getDauer() {
        assertEquals(this.tour.getDauer(), "String dauer");
    }

    @Test
    void getStrecke() {
        assertEquals(this.tour.getStrecke(), 2);
    }

    @Test
    void getName() {
        assertEquals(this.tour.getName(), "String name");
    }

    @Test
    void getStart() {
        assertEquals(this.tour.getStart(), "String start");
    }

    @Test
    void getZiel() {
        assertEquals(this.tour.getZiel(), "String ziel");
    }
}