Changeset 18806 in josm for trunk/test/unit
- Timestamp:
- 2023-08-14T17:56:25+02:00 (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/RemoteEntryTest.java
r18635 r18806 2 2 package org.openstreetmap.josm.gui.layer.geoimage; 3 3 4 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 5 6 import java.io.File; 4 7 import java.net.URI; 5 8 import java.util.Objects; … … 8 11 import nl.jqno.equalsverifier.EqualsVerifier; 9 12 import org.junit.jupiter.api.Test; 13 import org.openstreetmap.josm.TestUtils; 10 14 11 15 /** … … 13 17 */ 14 18 class RemoteEntryTest { 19 private static final Supplier<RemoteEntry> NULL_SUPPLIER = () -> null; 15 20 @Test 16 21 void testHashCodeEquals() { 17 RemoteEntry remoteEntryA = new RemoteEntry(URI.create("https://somewhere.com/image.png?hash=a"),18 () -> null, () -> null, () -> null, () -> null);19 RemoteEntry remoteEntryB = new RemoteEntry(URI.create("https://somewhere.com/image.png?hash=b"),20 () -> null, () -> null, () -> null, () -> null);22 final RemoteEntry remoteEntryA = new RemoteEntry(URI.create("https://somewhere.com/image.png?hash=a"), 23 NULL_SUPPLIER, NULL_SUPPLIER, NULL_SUPPLIER, NULL_SUPPLIER); 24 final RemoteEntry remoteEntryB = new RemoteEntry(URI.create("https://somewhere.com/image.png?hash=b"), 25 NULL_SUPPLIER, NULL_SUPPLIER, NULL_SUPPLIER, NULL_SUPPLIER); 21 26 EqualsVerifier.simple().forClass(RemoteEntry.class).usingGetClass() 22 27 .withIgnoredFields("firstImage", "lastImage", "nextImage", "previousImage" /* These suppliers don't have good == semantics */, … … 26 31 .withGenericPrefabValues(Supplier.class, 27 32 a -> () -> new RemoteEntry(URI.create("https://somewhere.com/image.png?hash=" + Objects.hash(a)), 28 () -> null, () -> null, () -> null, () -> null)).verify(); 33 NULL_SUPPLIER, NULL_SUPPLIER, NULL_SUPPLIER, NULL_SUPPLIER)).verify(); 34 } 35 36 @Test 37 void testNonRegression23119() { 38 final String fileLocation = TestUtils.getRegressionDataFile(11685, "2015-11-08_15-33-27-Xiaomi_YI-Y0030832.jpg"); 39 final RemoteEntry remoteEntry = new RemoteEntry(new File(fileLocation).toURI(), 40 NULL_SUPPLIER, NULL_SUPPLIER, NULL_SUPPLIER, NULL_SUPPLIER); 41 assertDoesNotThrow(remoteEntry::getLastModified); 29 42 } 30 43 }
Note:
See TracChangeset
for help on using the changeset viewer.