package moe.tristan.easyfxml.model.fxml;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import moe.tristan.easyfxml.spring.application.FxSpringContext;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import static org.assertj.core.api.Assertions.assertThat;

@SpringBootTest
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = FxSpringContext.class)
public class FxmlLoaderTest {

    @Autowired
    private ApplicationContext context;

    private int succ = 0;
    private int fail = 0;
    private FxmlLoader fxmlLoader;

    @Before
    public void setUp() {
        fxmlLoader = new FxmlLoader(context);
        fxmlLoader.setOnSuccess(n -> succ++);
        fxmlLoader.setOnFailure(e -> fail++);
    }

    @Test
    public void onSuccess() {
        fxmlLoader.onSuccess(null);
        assertThat(succ).isEqualTo(1);
        assertThat(fail).isEqualTo(0);
    }

    @Test
    public void onFailure() {
        fxmlLoader.onFailure(null);
        assertThat(succ).isEqualTo(0);
        assertThat(fail).isEqualTo(1);
    }
}

@@ -483,16 +483,77 @@
 nWith;%0A%0A
+import java.net.MalformedURLException;%0Aimport java.net.URL;%0A%0A
 import s
@@ -1382,10 +1382,341 @@
 ;%0A    %7D%0A
+%0A    @Test%0A    public void eqHashCode() throws MalformedURLException %7B%0A        final FxmlLoader fl1 = new FxmlLoader(context);%0A        final FxmlLoader fl2 = new FxmlLoader(context);%0A%0A        final URL testURL = new URL(%22https://www.example.com%22);%0A%0A        assertThat(fl1).isEqualTo(fl2);%0A%0A%0A        assertThat(fl1.equals())%0A    %7D%0A%0A
 %7D%0A

Add some testing to the hashCode/equals override for FxmlLoader