Skip to content

Commit 1863122

Browse files
committed
Move resource lookup to test-base, remove test-utils
1 parent 0e30b92 commit 1863122

File tree

3 files changed

+38
-58
lines changed

3 files changed

+38
-58
lines changed

translator-core/src/test/java/software/coley/dextransformer/ConversionTests.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.android.tools.r8.utils.AndroidApiLevel;
44
import org.junit.jupiter.params.ParameterizedTest;
5-
import org.junit.jupiter.params.provider.Arguments;
65
import org.junit.jupiter.params.provider.MethodSource;
76
import org.objectweb.asm.ClassReader;
87
import org.objectweb.asm.ClassWriter;
@@ -13,12 +12,8 @@
1312
import javax.annotation.Nonnull;
1413
import javax.annotation.Nullable;
1514
import java.io.File;
16-
import java.io.IOException;
17-
import java.nio.file.Files;
1815
import java.nio.file.Path;
19-
import java.nio.file.Paths;
2016
import java.util.Map;
21-
import java.util.stream.Stream;
2217

2318
import static org.junit.jupiter.api.Assertions.*;
2419

@@ -139,31 +134,6 @@ private static FailureType getKnownFailureType(@Nonnull Path path, boolean isDex
139134
return null;
140135
}
141136

142-
/**
143-
* @return DEX test resources.
144-
*/
145-
@Nonnull
146-
public static Stream<Arguments> findDexResources() throws IOException {
147-
return findResources(".dex");
148-
}
149-
150-
/**
151-
* @return JAR test resources.
152-
*/
153-
@Nonnull
154-
public static Stream<Arguments> findJarResources() throws IOException {
155-
return findResources(".jar");
156-
}
157-
158-
@Nonnull
159-
@SuppressWarnings("all")
160-
private static Stream<Arguments> findResources(@Nonnull String filter) throws IOException {
161-
return Files.find(Paths.get("src/test/resources/"), 10,
162-
(p, attributes) -> attributes.isRegularFile() &&
163-
p.getFileName().toString().endsWith(filter))
164-
.map(Arguments::of);
165-
}
166-
167137
private enum FailureType {
168138
/**
169139
* Not sure if bug in D8 handling, or the input is crafted specifically to fail.

translator-core/src/test/java/software/coley/dextransformer/TestBase.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
package software.coley.dextransformer;
22

33
import com.android.tools.r8.D8;
4+
import org.junit.jupiter.params.provider.Arguments;
5+
6+
import javax.annotation.Nonnull;
7+
import java.io.IOException;
8+
import java.nio.file.Files;
9+
import java.nio.file.Paths;
10+
import java.util.stream.Stream;
411

512
public class TestBase {
613
static {
@@ -13,4 +20,35 @@ public class TestBase {
1320
// Any dex --> jar processing fails because it asserts the direction can only be jar --> dex.
1421
D8.class.getClassLoader().setDefaultAssertionStatus(false);
1522
}
23+
24+
/**
25+
* @return DEX test resources.
26+
*/
27+
@Nonnull
28+
public static Stream<Arguments> findDexResources() throws IOException {
29+
return findResources(".dex");
30+
}
31+
32+
/**
33+
* @return JAR test resources.
34+
*/
35+
@Nonnull
36+
public static Stream<Arguments> findJarResources() throws IOException {
37+
return findResources(".jar");
38+
}
39+
40+
/**
41+
* @param filter
42+
* File name filter.
43+
*
44+
* @return Resources matching the filter.
45+
*/
46+
@Nonnull
47+
@SuppressWarnings("all")
48+
public static Stream<Arguments> findResources(@Nonnull String filter) throws IOException {
49+
return Files.find(Paths.get("src/test/resources/"), 10,
50+
(p, attributes) -> attributes.isRegularFile() &&
51+
p.getFileName().toString().endsWith(filter))
52+
.map(Arguments::of);
53+
}
1654
}

translator-core/src/test/java/software/coley/dextransformer/TestUtils.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)