source: josm/trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateEntryTest.java@ 17442

Last change on this file since 17442 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.template_engine;
3
4import java.util.Set;
5
6import org.junit.Assert;
7import org.junit.jupiter.api.extension.RegisterExtension;
8import org.junit.jupiter.api.Test;
9import org.openstreetmap.josm.TestUtils;
10import org.openstreetmap.josm.testutils.JOSMTestRules;
11import org.openstreetmap.josm.tools.Logging;
12
13import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
14import nl.jqno.equalsverifier.EqualsVerifier;
15import nl.jqno.equalsverifier.Warning;
16
17/**
18 * Unit tests of {@link TemplateEntry} class.
19 */
20class TemplateEntryTest {
21
22 /**
23 * Setup rule.
24 */
25 @RegisterExtension
26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
27 public JOSMTestRules test = new JOSMTestRules();
28
29 /**
30 * Unit test of methods {@link TemplateEntry#equals} and {@link TemplateEntry#hashCode}, including all subclasses.
31 */
32 @Test
33 void testEqualsContract() {
34 TestUtils.assumeWorkingEqualsVerifier();
35 Set<Class<? extends TemplateEntry>> templates = TestUtils.getJosmSubtypes(TemplateEntry.class);
36 Assert.assertTrue(templates.size() >= 3); // if it finds less than 3 classes, something is broken
37 for (Class<?> c : templates) {
38 Logging.debug(c.toString());
39 EqualsVerifier.forClass(c).usingGetClass()
40 .suppress(Warning.NONFINAL_FIELDS, Warning.INHERITED_DIRECTLY_FROM_OBJECT)
41 .verify();
42 }
43 }
44}
Note: See TracBrowser for help on using the repository browser.