Skip to content

Commit

Permalink
#1158: FontTest
Browse files Browse the repository at this point in the history
- Added beforeAll() and registered the directories before all tests.
  • Loading branch information
Claudio Clemens authored and Claudio Clemens committed May 27, 2024
1 parent 013c2b3 commit 20359e0
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Map;
import java.util.Set;
import java.util.function.Predicate;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
Expand Down Expand Up @@ -44,6 +45,11 @@ private static Set<Integer> getStyles() {
return STYLES_TO_TEST_METHOD.keySet();
}

@BeforeAll
static void beforeAll() {
FontFactory.registerDirectories();
}

/**
* Checks if style property value is preserved during font construction through
* {@link FontFactory#getFont(String, float, int)} method by getting raw property value.
Expand All @@ -53,7 +59,6 @@ private static Set<Integer> getStyles() {
@ParameterizedTest(name = "Style {0}")
@MethodSource("getStyles")
void testStyleSettingByValue(int style) {
FontFactory.registerDirectories();
// TODO: complement tests after adding enum with font styles
final Font font = FontFactory.getFont(FONT_NAME_WITHOUT_STYLES, DEFAULT_FONT_SIZE, style);
assertEquals(font.getStyle(), style);
Expand Down

0 comments on commit 20359e0

Please sign in to comment.