package be.iminds.ilabt.jfed.experimenter_gui.slice;

import be.iminds.ilabt.jfed.experiment.Experiment;
import be.iminds.ilabt.jfed.experiment.SfaExperimentPart;
import com.google.common.collect.Lists;
import javafx.application.Application;
import javafx.stage.Stage;
import org.testng.Assert;

import java.util.List;
import java.util.Optional;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
 * User: twalcari
 * Date: 1/11/2016
 * Time: 14:00
 */
public class QoeDialogTest extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {

        Experiment experiment = mock(Experiment.class);
        when(experiment.getName()).thenReturn("myexp1");

        SfaExperimentPart experimentPart = mock(SfaExperimentPart.class);
        when(experimentPart.getName())
                .thenReturn("Test authority");
        SfaExperimentPart experimentPart2 = mock(SfaExperimentPart.class);
        when(experimentPart2.getName())
                .thenReturn("Test authority 2");
        SfaExperimentPart experimentPart3 = mock(SfaExperimentPart.class);
        when(experimentPart3.getName())
                .thenReturn("Test authority 3");
        SfaExperimentPart experimentPart4 = mock(SfaExperimentPart.class);
        when(experimentPart4.getName())
                .thenReturn("Test authority 4");



        QoeDialog dialog = new QoeDialog(experiment, Lists.asList(experimentPart, new SfaExperimentPart[] {experimentPart2, experimentPart3, experimentPart4}));

        Optional<List<QoeDialog.QoeReply>> result = dialog.showAndWait();



        Assert.assertTrue(result.isPresent());
        Assert.assertEquals(result.get().size(), 2);

    }
}