source: josm/trunk/test/unit/org/openstreetmap/josm/gui/io/SaveLayerInfoTest.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.7 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.io;
3
4import static org.junit.jupiter.api.Assertions.assertEquals;
5import static org.junit.jupiter.api.Assertions.assertNull;
6import static org.junit.jupiter.api.Assertions.assertThrows;
7
8import java.io.File;
9
10import org.junit.jupiter.api.Test;
11import org.junit.jupiter.api.extension.RegisterExtension;
12import org.openstreetmap.josm.data.osm.DataSet;
13import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer;
14import org.openstreetmap.josm.gui.layer.OsmDataLayer;
15import org.openstreetmap.josm.testutils.JOSMTestRules;
16
17import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
18
19/**
20 * Unit tests of {@link SaveLayerInfo} class.
21 */
22class SaveLayerInfoTest {
23 /**
24 * Setup test.
25 */
26 @RegisterExtension
27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
28 public JOSMTestRules test = new JOSMTestRules();
29
30 /**
31 * Test of {@link SaveLayerInfo} class - null case.
32 */
33 @Test
34 @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_NONVIRTUAL")
35 void testSaveLayerInfoNull() {
36 assertThrows(IllegalArgumentException.class, () -> new SaveLayerInfo(null));
37 }
38
39 /**
40 * Test of {@link SaveLayerInfo} class - nominal case.
41 */
42 @Test
43 void testSaveLayerInfoNominal() {
44 File file = new File("test");
45 String name = "layername";
46 AbstractModifiableLayer layer = new OsmDataLayer(new DataSet(), name, file);
47 SaveLayerInfo sli = new SaveLayerInfo(layer);
48 assertEquals(file, sli.getFile());
49 assertEquals(layer, sli.getLayer());
50 assertEquals(name, sli.getName());
51 assertNull(sli.getSaveState());
52 assertNull(sli.getUploadState());
53 }
54}
Note: See TracBrowser for help on using the repository browser.