Changeset 36193 in osm for applications/editors/josm/plugins/MicrosoftStreetside
- Timestamp:
- 2023-11-06T16:17:31+01:00 (14 months ago)
- Location:
- applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/StreetsideDataTest.java
r36065 r36193 25 25 @Main 26 26 class StreetsideDataTest { 27 28 /*@Rule29 public JOSMTestRules rules = new StreetsideTestRules().platform();*/30 27 31 28 private StreetsideData data; -
applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/StreetsideLayerTest.java
r36065 r36193 3 3 4 4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 import static org.junit.jupiter.api.Assertions.assertInstanceOf; 5 6 import static org.junit.jupiter.api.Assertions.assertNotNull; 6 7 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 import static org.junit.jupiter.api.Assertions.assertTrue; 8 9 import java.awt.GraphicsEnvironment;10 9 11 10 import org.junit.jupiter.api.Test; … … 69 68 void testGetInfoComponent() { 70 69 Object comp = StreetsideLayer.getInstance().getInfoComponent(); 71 assert True(comp instanceof String);70 assertInstanceOf(String.class, comp); 72 71 assertTrue(((String) comp).length() >= 9); 73 72 } -
applications/editors/josm/plugins/MicrosoftStreetside/test/unit/org/openstreetmap/josm/plugins/streetside/utils/TestUtil.java
r36065 r36193 4 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 import static org.junit.jupiter.api.Assertions.fail;7 6 8 import java.awt.GraphicsEnvironment;9 7 import java.lang.reflect.Constructor; 10 8 import java.lang.reflect.Field; … … 12 10 import java.lang.reflect.Method; 13 11 import java.lang.reflect.Modifier; 14 import java.util.logging.Level;15 12 16 import org.junit.runners.model.InitializationError; 17 import org.openstreetmap.josm.testutils.JOSMTestRules; 18 import org.openstreetmap.josm.tools.Logging; 19 import org.openstreetmap.josm.tools.Utils; 13 import org.openstreetmap.josm.tools.JosmRuntimeException; 20 14 21 15 /** … … 37 31 return result; 38 32 } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { 39 fail(e.getLocalizedMessage());33 throw new JosmRuntimeException(e); 40 34 } 41 return null;42 35 } 43 36 … … 52 45 return getAccessibleField(object.getClass(), name).get(object); 53 46 } catch (IllegalAccessException | SecurityException e) { 54 fail(e.getLocalizedMessage());47 throw new JosmRuntimeException(e); 55 48 } 56 return null;57 49 } 58 50 … … 80 72 } 81 73 } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { 82 fail(e.getLocalizedMessage()); 83 } 84 } 85 86 public static class StreetsideTestRules extends JOSMTestRules { 87 @Override 88 protected void before() throws InitializationError, ReflectiveOperationException { 89 Logging.getLogger().setFilter(record -> record.getLevel().intValue() >= Level.WARNING.intValue() || record.getSourceClassName().startsWith("org.openstreetmap.josm.plugins.streetside")); 90 Utils.updateSystemProperty("java.util.logging.SimpleFormatter.format", "%1$tF %1$tT.%1$tL %2$s %4$s: %5$s%6$s%n"); 91 final String isHeadless = Boolean.toString(GraphicsEnvironment.isHeadless()); 92 super.before(); 93 System.setProperty("java.awt.headless", isHeadless); 74 throw new JosmRuntimeException(e); 94 75 } 95 76 }
Note:
See TracChangeset
for help on using the changeset viewer.