package moe.tristan.easyfxml.model.fxml;

import moe.tristan.easyfxml.api.FxmlController;
import io.vavr.control.Try;
import org.junit.Before;
import org.junit.Test;

import javafx.scene.Node;
import javafx.scene.layout.Pane;

import java.nio.file.Paths;

import static org.testfx.assertions.api.Assertions.assertThat;

public class FxmlLoadResultTest {

    private static final Node TEST_NODE = new Pane();
    private static final FxmlController TEST_CONTROLLER = () -> Paths.get("fakepath");

    private FxmlLoadResult<Node, FxmlController> fxmlLoadResult;

    @Before
    public void setUp() {
        fxmlLoadResult = new FxmlLoadResult<>(
            Try.of(() -> TEST_NODE),
            Try.of(() -> TEST_CONTROLLER)
        );
    }

    @Test
    public void getNode() {
        assertThat(fxmlLoadResult.getNode().get()).isEqualTo(TEST_NODE);
    }

    @Test
    public void getController() {
        assertThat(fxmlLoadResult.getController().get()).isEqualTo(TEST_CONTROLLER);
    }

    @Test
    public void arity() {
        assertThat(fxmlLoadResult.arity()).isEqualTo(2);
    }

    @Test
    public void toSeq() {
        assertThat(
            fxmlLoadResult.toSeq()
                          .map(Try.class::cast)
                          .map(Try::get)
                          .toJavaList()
        ).containsExactlyInAnyOrder(TEST_NODE, TEST_CONTROLLER);
    }
}

@@ -158,16 +158,67 @@
 it.Test;
+%0Aimport org.testfx.framework.junit.ApplicationTest;
 %0A%0Aimport
@@ -396,16 +396,40 @@
 ultTest 
+extends ApplicationTest 
 %7B%0A%0A    p
@@ -847,24 +847,24 @@
 getNode() %7B%0A
-
         asse
@@ -923,32 +923,371 @@
 T_NODE);%0A    %7D%0A%0A
+    @Test%0A    public void orExceptionPane() %7B%0A        final FxmlLoadResult%3CNode, FxmlController%3E loadResult = new FxmlLoadResult%3C%3E(%0A                Try.failure(new RuntimeException(%22TEST%22)),%0A                Try.failure(new RuntimeException(%22TEST%22))%0A        );%0A%0A        assertThat(loadResult.orExceptionPane().isSuccess()).isTrue();%0A    %7D%0A%0A
     @Test%0A    pu

Add testing for auto-recovery with exception pane on loading fxml node