source: josm/trunk/test/unit/org/openstreetmap/josm/gui/io/CredentialDialogTest.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.io;
3
4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
5import static org.junit.jupiter.api.Assertions.assertEquals;
6import static org.junit.jupiter.api.Assertions.assertFalse;
7import static org.junit.jupiter.api.Assertions.assertTrue;
8
9import org.junit.jupiter.api.extension.RegisterExtension;
10import org.junit.jupiter.api.Test;
11import org.openstreetmap.josm.gui.io.CredentialDialog.CredentialPanel;
12import org.openstreetmap.josm.testutils.JOSMTestRules;
13
14import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
15
16/**
17 * Unit tests of {@link CredentialDialog} class.
18 */
19class CredentialDialogTest {
20
21 /**
22 * Setup tests
23 */
24 @RegisterExtension
25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
26 public JOSMTestRules test = new JOSMTestRules().preferences();
27
28 /**
29 * Test of {@link CredentialDialog.CredentialPanel} class.
30 */
31 @Test
32 void testCredentialPanel() {
33 CredentialPanel cp = new CredentialPanel(null);
34 cp.build();
35
36 cp.init(null, null);
37 assertEquals("", cp.getUserName());
38 assertArrayEquals("".toCharArray(), cp.getPassword());
39 assertFalse(cp.isSaveCredentials());
40
41 cp.init("user", "password");
42 assertEquals("user", cp.getUserName());
43 assertArrayEquals("password".toCharArray(), cp.getPassword());
44 assertTrue(cp.isSaveCredentials());
45
46 cp.updateWarningLabel(null);
47 cp.updateWarningLabel("http://something_insecure");
48 cp.updateWarningLabel("https://something_secure");
49
50 cp.startUserInput();
51 }
52}
Note: See TracBrowser for help on using the repository browser.