aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/glavo/javah/RuntimeSearchPathTests.java
blob: 253031257b5cef5dec933c3f2cf65776de5859fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package org.glavo.javah;

import org.junit.jupiter.api.Test;

import java.io.InputStream;
import java.nio.file.Files;

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

public class RuntimeSearchPathTests {

    @Test
    void test() throws Exception {
        Class<?>[] testClasses = {
                String.class,
                Test.class,
                RuntimeSearchPathTests.class,
                Main.class
        };

        for (Class<?> cls : testClasses) {
            try (InputStream in = cls.getResourceAsStream(cls.getSimpleName() + ".class")) {
                assertArrayEquals(
                        Files.readAllBytes(RuntimeSearchPath.searchClass(cls.getName())),
                        in.readAllBytes(),
                        "Search " + cls + " failed"
                );
            }
        }
    }
}