Ignore:
Timestamp:
2016-08-24T00:18:37+02:00 (8 years ago)
Author:
Don-vip
Message:

fix #13434 - Increase bug report test coverage (patch by michael2402) - gsoc-core

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandlerTest.java

    r10819 r10886  
    22package org.openstreetmap.josm.tools.bugreport;
    33
    4 import static org.junit.Assert.assertFalse;
     4import java.util.concurrent.CountDownLatch;
    55
    6 import org.junit.Before;
     6import org.junit.Rule;
    77import org.junit.Test;
    8 import org.openstreetmap.josm.JOSMFixture;
     8import org.openstreetmap.josm.testutils.JOSMTestRules;
     9
     10import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    911
    1012/**
     
    1214 */
    1315public class BugReportExceptionHandlerTest {
    14 
    1516    /**
    16      * Setup tests.
     17     * No dependencies
    1718     */
    18     @Before
    19     public void setUp() {
    20         JOSMFixture.createUnitTestFixture().init(true);
    21     }
     19    @Rule
     20    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     21    public JOSMTestRules test = new JOSMTestRules();
    2222
    2323    /**
    2424     * Unit test for {@link BugReportExceptionHandler#handleException} method.
     25     * @throws InterruptedException if the current thread is interrupted while waiting
    2526     */
    2627    @Test
    27     public void testHandleException() {
     28    public void testHandleException() throws InterruptedException {
     29        CountDownLatch latch = new CountDownLatch(1);
     30        BugReportQueue.getInstance().addBugReportHandler(e -> {latch.countDown(); return false;});
    2831        BugReportExceptionHandler.handleException(new Exception("testHandleException"));
    29         assertFalse(BugReportExceptionHandler.exceptionHandlingInProgress());
     32        latch.await();
    3033    }
    3134}
Note: See TracChangeset for help on using the changeset viewer.