Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working as part of a compiled jar #5

Closed
JLLeitschuh opened this issue Aug 6, 2014 · 2 comments
Closed

Not working as part of a compiled jar #5

JLLeitschuh opened this issue Aug 6, 2014 · 2 comments

Comments

@JLLeitschuh
Copy link

Given this example test:

@RunWith(JUnitParamsRunner.class)
public class QuickTest{
    @Parameters
    @Test
    public void test(int i) {
        assertEquals(i, i);
    }
    private Object[] parametersForTest() { return $($(0), $(1), $(2), $(3));}
}

Running this within Eclipse Luna works fine when I run it as a JUnit test using Java 8 however when I try to run it as part of a compiled JAR file on an embeded linux arm chip using an embedded version of Java 8 I receive the following exception:

Starting Tests
JUnit version 4.11
The following tests were loaded:
    QuickTest

Failure List: 
initializationError(edu.wpi.first.wpilibj.test.QuickTest)
java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class junitparams.Parameters.source()
    at java.lang.reflect.Method.getDefaultValue(Method.java:597)
    at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:128)
    at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:85)
    at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:266)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
    at java.lang.reflect.Executable.declaredAnnotations(Executable.java:546)
    at java.lang.reflect.Executable.getDeclaredAnnotations(Executable.java:539)
    at java.lang.reflect.Method.getDeclaredAnnotations(Method.java:615)
    at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:206)
    at org.junit.runners.model.FrameworkMethod.getAnnotations(FrameworkMethod.java:189)
    at org.junit.runners.model.TestClass.addToAnnotationLists(TestClass.java:58)
    at org.junit.runners.model.TestClass.<init>(TestClass.java:46)
    at org.junit.runners.ParentRunner.<init>(ParentRunner.java:75)
    at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:57)
    at junitparams.JUnitParamsRunner.<init>(JUnitParamsRunner.java:377)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
    at org.junit.runner.Computer.getRunner(Computer.java:40)
    at org.junit.runner.Computer$1.runnerForClass(Computer.java:31)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:101)
    at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:87)
    at org.junit.runners.Suite.<init>(Suite.java:80)
    at org.junit.runner.Computer.getSuite(Computer.java:28)
    at org.junit.runner.Request.classes(Request.java:75)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:128)
    at org.junit.runner.JUnitCore.runClasses(JUnitCore.java:73)
    at edu.wpi.first.wpilibj.test.TestSuite.parseArgsRunAndGetResult(TestSuite.java:180)
    at edu.wpi.first.wpilibj.test.TestSuite.main(TestSuite.java:323)

I have double checked to ensure that maven is correctly adding your library to the .jar file before I copy it over to the arm chip and attempt to run it.

@jrmichael
Copy link
Contributor

@JLLeitschuh We don't have the knowledge and hardware necessary to reproduce this issue. However we have implemented a simple fix that we believe to to fix your problems. We will appreciate if you tried to reproduce this bug with latest SNAPSHOT of JUnitParams.

@JLLeitschuh
Copy link
Author

🤣 Bahahhahhahahh. 🤣

This is for a project I was working on 2 years ago.

I ended up using the default junit params.

Glad to see this old issue resolved.

@AustinShalit you want to try this code on a robo-rio and see if it works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants