1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.mappaint.mapcss;
|
---|
3 |
|
---|
4 | import org.junit.Rule;
|
---|
5 | import org.junit.Test;
|
---|
6 | import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Context;
|
---|
7 | import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op;
|
---|
8 | import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.PseudoClasses;
|
---|
9 | import org.openstreetmap.josm.testutils.JOSMTestRules;
|
---|
10 |
|
---|
11 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
---|
12 | import net.trajano.commons.testing.UtilityClassTestUtil;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Unit tests of {@link ConditionFactory}.
|
---|
16 | */
|
---|
17 | public 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 | }
|
---|