Skip to content

Commit

Permalink
Merge pull request #4 from yoep/bugfix/spring-boot-3-autoconfiguration
Browse files Browse the repository at this point in the history
Bugfix spring boot 3 autoconfiguration
  • Loading branch information
yoep authored Dec 21, 2023
2 parents 857348f + 37d8275 commit bbc4614
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 2 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
inputs: {}

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 17
cache: 'maven'
- name: Maven test
run: |
mvn -B test
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@
<version>${testfx.junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/META-INF/spring.factories

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.github.spring.boot.javafx.JavaFxAutoConfiguration
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.github.spring.boot.javafx;

import com.github.spring.boot.javafx.view.ViewLoader;
import com.github.spring.boot.javafx.view.ViewManager;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import static org.junit.jupiter.api.Assertions.assertNotNull;

@SpringBootTest(
classes = {
JavaFxAutoConfiguration.class,
TestConfiguration.class
}
)
class JavaFxAutoConfigurationTest {
@Autowired
private ViewManager viewManager;
@Autowired
private ViewLoader viewLoader;

@Test
void testAutoConfiguration() {
assertNotNull(viewManager, "expected a view manager to have been created");
assertNotNull(viewLoader, "expected a view loader to have been created");
}
}
13 changes: 13 additions & 0 deletions src/test/java/com/github/spring/boot/javafx/TestConfiguration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.github.spring.boot.javafx;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;

@Configuration
public class TestConfiguration {
@Bean
public ResourceBundleMessageSource resourceBundleMessageSource() {
return new ResourceBundleMessageSource();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.github.spring.boot.javafx.font;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertNotNull;

class FontRegistryImplTest {
@Test
void testGetInstance() {
var result = FontRegistryImpl.getInstance();

assertNotNull(result, "expected a font registry instance to have been returned");
}

@Test
void testLoadFont() {
var registry = FontRegistryImpl.getInstance();

var font = registry.loadFont("fontawesome-regular.ttf");

assertNotNull(font, "expected a font to have been returned");
}
}

0 comments on commit bbc4614

Please sign in to comment.