source: josm/trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/ThumbsLoaderTest.java@ 17856

Last change on this file since 17856 was 17856, checked in by simon04, 3 years ago

see #20813 - Add ThumbsLoaderTest.testPerformance

File size: 1.4 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.layer.geoimage;
3
4import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
5import org.junit.jupiter.api.Disabled;
6import org.junit.jupiter.api.Test;
7import org.junit.jupiter.api.extension.RegisterExtension;
8import org.openstreetmap.josm.testutils.JOSMTestRules;
9import org.openstreetmap.josm.tools.StreamUtils;
10
11import java.nio.file.DirectoryStream;
12import java.nio.file.Files;
13import java.nio.file.Path;
14import java.nio.file.Paths;
15import java.util.List;
16import java.util.stream.Collectors;
17
18/**
19 * Unit tests of {@link ThumbsLoader} class.
20 */
21class ThumbsLoaderTest {
22 /**
23 * Setup test.
24 */
25 @RegisterExtension
26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
27 public JOSMTestRules test = new JOSMTestRules().main();
28
29 /**
30 * Performance test for {@link ThumbsLoader}
31 * @throws Exception if any error occurs
32 */
33 @Test
34 @Disabled("Set working directory to image folder and run manually")
35 void testPerformance() throws Exception {
36 List<ImageEntry> imageEntries;
37 try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(".").toAbsolutePath(), "*.{JPG,jpg}")) {
38 imageEntries = StreamUtils.toStream(stream).map(Path::toFile).map(ImageEntry::new).collect(Collectors.toList());
39 }
40 new ThumbsLoader(imageEntries).run();
41 }
42
43}
Note: See TracBrowser for help on using the repository browser.