Skip to content

Commit fe27053

Browse files
committed
Fix tests and add basic pom.xml file
The tests were broken due to a jmockit version update and the removal of a method used in tests. Signed-off-by: Taylor Smock <[email protected]>
1 parent a62ac6c commit fe27053

File tree

3 files changed

+60
-5
lines changed

3 files changed

+60
-5
lines changed

pom.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>org.openstreetmap.josm.plugins</groupId>
6+
<artifactId>plugin-root</artifactId>
7+
<version>SNAPSHOT</version>
8+
</parent>
9+
<artifactId>markseen</artifactId>
10+
11+
<url>${plugin.link}</url>
12+
<developers>
13+
<developer>
14+
<name>Robert Scott</name>
15+
</developer>
16+
</developers>
17+
<properties>
18+
<plugin.src.dir>src</plugin.src.dir>
19+
<plugin.main.version>19044</plugin.main.version>
20+
<plugin.author>Robert Scott</plugin.author>
21+
<plugin.class>org.openstreetmap.josm.plugins.markseen.MarkSeenPlugin</plugin.class>
22+
<plugin.description>Marks ’seen’ areas of the map</plugin.description>
23+
<plugin.icon>images/icons/24x24/markseen.svg</plugin.icon>
24+
<plugin.link>https://github.com/JOSM/markseen</plugin.link>
25+
<plugin.canloadatruntime>true</plugin.canloadatruntime>
26+
</properties>
27+
<build>
28+
<plugins>
29+
<plugin>
30+
<groupId>org.apache.maven.plugins</groupId>
31+
<artifactId>maven-jar-plugin</artifactId>
32+
<configuration>
33+
<archive>
34+
<manifestEntries>
35+
<Plugin-Link>${plugin.link}</Plugin-Link>
36+
<Plugin-Icon>${plugin.icon}</Plugin-Icon>
37+
<Plugin-Canloadatruntime>${plugin.canloadatruntime}</Plugin-Canloadatruntime>
38+
</manifestEntries>
39+
</archive>
40+
</configuration>
41+
</plugin>
42+
</plugins>
43+
</build>
44+
</project>

test/unit/org/openstreetmap/josm/plugins/markseen/BaseQuadTreeMetaTest.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.awt.Color;
77
import java.awt.image.DataBufferByte;
88
import java.io.IOException;
9+
import java.lang.reflect.Field;
910
import java.util.ArrayList;
1011
import java.util.List;
1112
import java.util.concurrent.Future;
@@ -24,9 +25,11 @@
2425

2526
import org.junit.After;
2627
import org.junit.Ignore;
28+
import org.openstreetmap.josm.tools.JosmRuntimeException;
29+
import org.openstreetmap.josm.tools.ReflectionUtils;
30+
2731
import mockit.Mock;
2832
import mockit.MockUp;
29-
import mockit.Deencapsulation;
3033
import mockit.Invocation;
3134

3235
@Ignore
@@ -35,9 +38,17 @@ public static QuadTreeNodeDynamicReference[] createDynamicReferences(QuadTreeMet
3538
new MockUp<Tile>() {
3639
@Mock void $init(Invocation invocation, TileSource source, int xtile, int ytile, int zoom) {
3740
Tile tile = invocation.getInvokedInstance();
38-
Deencapsulation.setField(tile, "xtile", xtile);
39-
Deencapsulation.setField(tile, "ytile", ytile);
40-
Deencapsulation.setField(tile, "zoom", zoom);
41+
try {
42+
final Field xtileField = Tile.class.getDeclaredField("xtile");
43+
final Field ytileField = Tile.class.getDeclaredField("ytile");
44+
final Field zoomField = Tile.class.getDeclaredField("zoom");
45+
ReflectionUtils.setObjectsAccessible(xtileField, ytileField, zoomField);
46+
xtileField.setInt(tile, xtile);
47+
ytileField.setInt(tile, ytile);
48+
zoomField.setInt(tile, zoom);
49+
} catch (ReflectiveOperationException roe) {
50+
throw new JosmRuntimeException(roe);
51+
}
4152
}
4253
};
4354
QuadTreeNodeDynamicReference[] refs = new QuadTreeNodeDynamicReference[referenceTiles_.length];

test/unit/org/openstreetmap/josm/plugins/markseen/QuadTreeMetaClearOrderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public void testClearUnseen()
6565
boolean clearSuccess = false;
6666
while (!clearSuccess) {
6767
try {
68-
this.quadTreeMeta.requestClear(true);
68+
this.quadTreeMeta.requestClear(); // Note: This _used_ to check integrity
6969
clearSuccess = true;
7070
} catch (RejectedExecutionException e) {
7171
try {

0 commit comments

Comments
 (0)