source: josm/trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactoryTest.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.gui.mappaint.mapcss;
3
4import org.junit.Rule;
5import org.junit.Test;
6import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Context;
7import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op;
8import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.PseudoClasses;
9import org.openstreetmap.josm.testutils.JOSMTestRules;
10
11import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
12import net.trajano.commons.testing.UtilityClassTestUtil;
13
14/**
15 * Unit tests of {@link ConditionFactory}.
16 */
17public class ConditionFactoryTest {
18
19 /**
20 * Setup rule
21 */
22 @Rule
23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
24 public JOSMTestRules test = new JOSMTestRules().preferences();
25
26 /**
27 * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/14368">#14368</a>.
28 * @throws Exception if an error occurs
29 */
30 @Test(expected = MapCSSException.class)
31 public void testTicket14368() throws Exception {
32 ConditionFactory.createKeyValueCondition("name", "Rodovia ([A-Z]{2,3}-[0-9]{2,4}", Op.REGEX, Context.PRIMITIVE, false);
33 }
34
35 /**
36 * Tests that {@code PseudoClasses} satisfies utility class criterias.
37 * @throws ReflectiveOperationException if an error occurs
38 */
39 @Test
40 public void testUtilityClass() throws ReflectiveOperationException {
41 UtilityClassTestUtil.assertUtilityClassWellDefined(PseudoClasses.class);
42 }
43}
Note: See TracBrowser for help on using the repository browser.