package de.bmoth.app;

import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import org.junit.Test;

import static javafx.scene.input.KeyCode.ENTER;
import static org.testfx.api.FxAssert.verifyThat;
import static org.testfx.matcher.base.NodeMatchers.hasText;

public class ReplControllerTest extends HeadlessUITest {
    private String replId = "#replText";

    @Override
    public void start(Stage stage) throws Exception {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("repl.fxml"));
        Parent root = loader.load();
        Scene scene = new Scene(root, 500, 300);
        stage.setScene(scene);
        stage.show();
    }

    @Test
    public void replTypeSimplePredicateTest() {
        clickOn(replId).write("x = 5");
        verifyThat(replId, hasText("x = 5"));

        push(ENTER);
        verifyThat(replId, hasText("x = 5\n{x=5}\n"));
    }
}

@@ -932,11 +932,278 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void replTypeUnsatisfiablePredicateTest() %7B%0A        clickOn(replId).write(%22x = 5 & x = 6%22);%0A        verifyThat(replId, hasText(%22x = 5 & x = 6%22));%0A%0A        push(ENTER);%0A        verifyThat(replId, hasText(%22x = 5 & x = 6%5CnUNSATISFIABLE%5Cn%22));%0A    %7D
 %0A%7D%0A

extend repl test with unsatisfiable predicate