Changeset 17383 in josm


Ignore:
Timestamp:
2020-12-01T20:59:49+01:00 (3 years ago)
Author:
Don-vip
Message:

see #16567 - better assertion error messages for rules/plugins integration tests

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/validator/ValidatorTagCheckerRulesPreferenceTestIT.java

    r17275 r17383  
    99import java.util.Collection;
    1010
     11import org.junit.jupiter.api.Test;
    1112import org.junit.jupiter.api.extension.RegisterExtension;
    12 import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.data.preferences.sources.ExtendedSourceEntry;
    1414import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker;
     
    3838        Collection<ExtendedSourceEntry> sources = new ValidatorTagCheckerRulesPreference.TagCheckerRulesSourceEditor()
    3939                .loadAndGetAvailableSources();
    40         assertFalse(sources.isEmpty());
     40        assertFalse(sources.isEmpty(), sources::toString);
    4141        Collection<Throwable> allErrors = new ArrayList<>();
    4242        MapCSSTagChecker tagChecker = new MapCSSTagChecker();
     
    4545            try {
    4646                ParseResult result = tagChecker.addMapCSS(source.url);
    47                 assertFalse(result.parseChecks.isEmpty());
     47                assertFalse(result.parseChecks.isEmpty(), result::toString);
    4848                System.out.println(result.parseErrors.isEmpty() ? " => OK" : " => KO");
    4949                allErrors.addAll(result.parseErrors);
     
    5454            }
    5555        }
    56         assertTrue(allErrors.isEmpty());
     56        assertTrue(allErrors.isEmpty(), allErrors::toString);
    5757    }
    5858}
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java

    r17288 r17383  
    3636import org.openstreetmap.josm.testutils.JOSMTestRules;
    3737import org.openstreetmap.josm.tools.Destroyable;
     38import org.openstreetmap.josm.tools.Logging;
    3839import org.openstreetmap.josm.tools.Utils;
    3940
     
    121122            // removed and readded)
    122123            for (int i = 0; i < 2; i++) {
    123                 assertFalse(PluginHandler.removePlugins(restartable));
    124                 assertTrue(restartable.stream().noneMatch(info -> PluginHandler.getPlugins().contains(info)));
     124                assertFalse(PluginHandler.removePlugins(restartable), () -> Logging.getLastErrorAndWarnings().toString());
     125                List<PluginInformation> notRemovedPlugins = restartable.stream()
     126                        .filter(info -> PluginHandler.getPlugins().contains(info)).collect(Collectors.toList());
     127                assertTrue(notRemovedPlugins.isEmpty(), notRemovedPlugins::toString);
    125128                loadPlugins(restartable);
    126129            }
    127130
    128             assertTrue(PluginHandler.removePlugins(loadedPlugins));
     131            assertTrue(PluginHandler.removePlugins(loadedPlugins), () -> Logging.getLastErrorAndWarnings().toString());
    129132            assertTrue(restartable.parallelStream().noneMatch(info -> PluginHandler.getPlugins().contains(info)));
    130133        } catch (Exception | LinkageError t) {
     
    162165        List<PluginInformation> plugins = pluginInfoDownloadTask.getAvailablePlugins();
    163166        System.out.println("Original plugin list contains " + plugins.size() + " plugins");
    164         assertFalse(plugins.isEmpty());
     167        assertFalse(plugins.isEmpty(), plugins::toString);
    165168        PluginInformation info = plugins.get(0);
    166         assertFalse(info.getName().isEmpty());
    167         assertFalse(info.getClass().getName().isEmpty());
     169        assertFalse(info.getName().isEmpty(), info::toString);
     170        assertFalse(info.getClass().getName().isEmpty(), info::toString);
    168171
    169172        // Filter deprecated and unmaintained ones, or those not responsive enough to match our continuous integration needs
Note: See TracChangeset for help on using the changeset viewer.