So I have a javaFX application with a controller (implements Initializable) with the following initialize method which sets the image of an ImageView.
@FXML
private ImageView logoIMG;
@Override
public void initialize(URL location, ResourceBundle resources) {
logoIMG.setImage(new Image(getClass().getResource("../../../../resources/main/main/Logo.png").toExternalForm()));
}
I also wrote a test for it to see if the image is actually set:
@Test
void initializeTest() {
SplashCtrl ctrl = new SplashCtrl(serverMock, mainMock); //also using mockito but that shouldn't be an issue here
assertEquals(new ImageView(new Image(SplashCtrl.class.getResource("../../../../resources/main/main/Logo.png").toExternalForm())),
ctrl.getLogoIMG());
}
However this is giving the following exception:
java.lang.RuntimeException: Internal graphics not initialized yet
Could somebody explain to me what's going on and give me a possible solution?