source: josm/trunk/test/unit/org/openstreetmap/josm/plugins/PluginExceptionTest.java@ 10956

Last change on this file since 10956 was 10050, checked in by Don-vip, 8 years ago

add more unit tests

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.plugins;
3
4import static org.junit.Assert.assertEquals;
5
6import org.junit.BeforeClass;
7import org.junit.Test;
8import org.openstreetmap.josm.JOSMFixture;
9
10/**
11 * Unit tests of {@link PluginException} class.
12 */
13public class PluginExceptionTest {
14
15 /**
16 * Setup test.
17 */
18 @BeforeClass
19 public static void setUp() {
20 JOSMFixture.createUnitTestFixture().init();
21 }
22
23 /**
24 * Unit test of {@link PluginException#PluginException}.
25 */
26 @Test
27 public void testPluginDownloadException() {
28 PluginException ex = new PluginException("foo");
29 assertEquals("foo", ex.getMessage());
30 NullPointerException npe = new NullPointerException();
31 ex = new PluginException("bar", npe);
32 assertEquals("An error occurred in plugin bar", ex.getMessage());
33 assertEquals(npe, ex.getCause());
34 ex = new PluginException(null, "foobar", npe);
35 assertEquals("An error occurred in plugin foobar", ex.getMessage());
36 assertEquals(npe, ex.getCause());
37 }
38}
Note: See TracBrowser for help on using the repository browser.