Skip to content

Commit bbc4614

Browse files
authored
Merge pull request #4 from yoep/bugfix/spring-boot-3-autoconfiguration
Bugfix spring boot 3 autoconfiguration
2 parents 857348f + 37d8275 commit bbc4614

File tree

7 files changed

+101
-2
lines changed

7 files changed

+101
-2
lines changed

.github/workflows/maven-build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow will build a Java project with Maven
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
4+
name: Build
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
workflow_dispatch:
12+
inputs: {}
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- uses: actions-rs/toolchain@v1
21+
with:
22+
toolchain: stable
23+
- name: Set up JDK 17
24+
uses: actions/setup-java@v3
25+
with:
26+
distribution: 'adopt'
27+
java-version: 17
28+
cache: 'maven'
29+
- name: Maven test
30+
run: |
31+
mvn -B test

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@
128128
<version>${testfx.junit.version}</version>
129129
<scope>test</scope>
130130
</dependency>
131+
<dependency>
132+
<groupId>org.springframework.boot</groupId>
133+
<artifactId>spring-boot-starter-test</artifactId>
134+
<scope>test</scope>
135+
</dependency>
131136
</dependencies>
132137

133138
<build>

src/main/resources/META-INF/spring.factories

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
com.github.spring.boot.javafx.JavaFxAutoConfiguration
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.github.spring.boot.javafx;
2+
3+
import com.github.spring.boot.javafx.view.ViewLoader;
4+
import com.github.spring.boot.javafx.view.ViewManager;
5+
import org.junit.jupiter.api.Test;
6+
import org.springframework.beans.factory.annotation.Autowired;
7+
import org.springframework.boot.test.context.SpringBootTest;
8+
9+
import static org.junit.jupiter.api.Assertions.assertNotNull;
10+
11+
@SpringBootTest(
12+
classes = {
13+
JavaFxAutoConfiguration.class,
14+
TestConfiguration.class
15+
}
16+
)
17+
class JavaFxAutoConfigurationTest {
18+
@Autowired
19+
private ViewManager viewManager;
20+
@Autowired
21+
private ViewLoader viewLoader;
22+
23+
@Test
24+
void testAutoConfiguration() {
25+
assertNotNull(viewManager, "expected a view manager to have been created");
26+
assertNotNull(viewLoader, "expected a view loader to have been created");
27+
}
28+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.github.spring.boot.javafx;
2+
3+
import org.springframework.context.annotation.Bean;
4+
import org.springframework.context.annotation.Configuration;
5+
import org.springframework.context.support.ResourceBundleMessageSource;
6+
7+
@Configuration
8+
public class TestConfiguration {
9+
@Bean
10+
public ResourceBundleMessageSource resourceBundleMessageSource() {
11+
return new ResourceBundleMessageSource();
12+
}
13+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.github.spring.boot.javafx.font;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import static org.junit.jupiter.api.Assertions.assertNotNull;
6+
7+
class FontRegistryImplTest {
8+
@Test
9+
void testGetInstance() {
10+
var result = FontRegistryImpl.getInstance();
11+
12+
assertNotNull(result, "expected a font registry instance to have been returned");
13+
}
14+
15+
@Test
16+
void testLoadFont() {
17+
var registry = FontRegistryImpl.getInstance();
18+
19+
var font = registry.loadFont("fontawesome-regular.ttf");
20+
21+
assertNotNull(font, "expected a font to have been returned");
22+
}
23+
}

0 commit comments

Comments
 (0)