source: josm/trunk/test/unit/org/openstreetmap/josm/tools/FontsManagerTest.java@ 17360

Last change on this file since 17360 was 17275, checked in by Don-vip, 3 years ago

see #16567 - upgrade almost all tests to JUnit 5, except those depending on WiremockRule

See https://github.com/tomakehurst/wiremock/issues/684

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.tools;
3
4import static org.junit.jupiter.api.Assertions.fail;
5
6import java.awt.Font;
7import java.awt.GraphicsEnvironment;
8
9import org.junit.jupiter.api.extension.RegisterExtension;
10import org.junit.jupiter.api.Test;
11import org.openstreetmap.josm.testutils.JOSMTestRules;
12
13import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
14import net.trajano.commons.testing.UtilityClassTestUtil;
15
16/**
17 * Unit tests of {@link FontsManager} class.
18 */
19class FontsManagerTest {
20
21 /**
22 * Setup test.
23 */
24 @RegisterExtension
25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
26 public JOSMTestRules test = new JOSMTestRules();
27
28 /**
29 * Test method for {@code FontsManager#initialize}
30 */
31 @Test
32 void testFontsManager() {
33 FontsManager.initialize();
34 boolean found = false;
35 for (Font f : GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts()) {
36 if (f.getName().contains("Droid")) {
37 System.out.println(f);
38 found = true;
39 }
40 }
41 if (!found) {
42 fail("DroidSans font not found");
43 }
44 }
45
46 /**
47 * Tests that {@code FontsManager} satisfies utility class criteria.
48 * @throws ReflectiveOperationException if an error occurs
49 */
50 @Test
51 void testUtilityClass() throws ReflectiveOperationException {
52 UtilityClassTestUtil.assertUtilityClassWellDefined(FontsManager.class);
53 }
54}
Note: See TracBrowser for help on using the repository browser.