source: josm/trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactoryTest.java@ 17531

Last change on this file since 17531 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.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.mappaint.mapcss;
3
4import static org.junit.jupiter.api.Assertions.assertThrows;
5
6import org.junit.jupiter.api.Test;
7import org.junit.jupiter.api.extension.RegisterExtension;
8import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Context;
9import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op;
10import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.PseudoClasses;
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 ConditionFactory}.
18 */
19class ConditionFactoryTest {
20
21 /**
22 * Setup rule
23 */
24 @RegisterExtension
25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
26 public JOSMTestRules test = new JOSMTestRules().preferences();
27
28 /**
29 * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/14368">#14368</a>.
30 */
31 @Test
32 void testTicket14368() {
33 assertThrows(MapCSSException.class,
34 () -> ConditionFactory.createKeyValueCondition("name", "Rodovia ([A-Z]{2,3}-[0-9]{2,4}", Op.REGEX, Context.PRIMITIVE, false));
35 }
36
37 /**
38 * Tests that {@code PseudoClasses} satisfies utility class criteria.
39 * @throws ReflectiveOperationException if an error occurs
40 */
41 @Test
42 void testUtilityClass() throws ReflectiveOperationException {
43 UtilityClassTestUtil.assertUtilityClassWellDefined(PseudoClasses.class);
44 }
45}
Note: See TracBrowser for help on using the repository browser.