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

Last change on this file since 11921 was 11921, checked in by Don-vip, 7 years ago

improve unit test coverage of utilities classes thanks to https://trajano.github.io/commons-testing

  • 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.Assert.fail;
5
6import java.awt.Font;
7import java.awt.GraphicsEnvironment;
8
9import org.junit.Rule;
10import org.junit.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 */
19public class FontsManagerTest {
20
21 /**
22 * Setup test.
23 */
24 @Rule
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 public 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 criterias.
48 * @throws ReflectiveOperationException if an error occurs
49 */
50 @Test
51 public void testUtilityClass() throws ReflectiveOperationException {
52 UtilityClassTestUtil.assertUtilityClassWellDefined(FontsManager.class);
53 }
54}
Note: See TracBrowser for help on using the repository browser.