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

Can not set a seed with the default ForgeConfigurator #54

Closed
vincent314 opened this issue Dec 12, 2020 · 3 comments
Closed

Can not set a seed with the default ForgeConfigurator #54

vincent314 opened this issue Dec 12, 2020 · 3 comments
Labels

Comments

@vincent314
Copy link

Hi,

I was just testing your lovely library after watching this video on youtube, and just got an error : I can not replay a test with a seed and the default ForgeConfigurator. It also happen with just @ForgeConfiguration (no seed and no Configurator provided)

class fr.xgouchet.elmyr.junit5.ForgeExtension cannot access a member of class fr.xgouchet.elmyr.ForgeConfigurator$NoOp with modifiers "private"
java.lang.IllegalAccessException: class fr.xgouchet.elmyr.junit5.ForgeExtension cannot access a member of class fr.xgouchet.elmyr.ForgeConfigurator$NoOp with modifiers "private"
	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
	at java.base/jdk.internal.reflect.Reflection.ensureMemberAccess(Reflection.java:99)
	at java.base/java.lang.Class.newInstance(Class.java:579)
	at fr.xgouchet.elmyr.junit5.ForgeExtension.getConfigurators(ForgeExtension.kt:193)
	at fr.xgouchet.elmyr.junit5.ForgeExtension.beforeAll(ForgeExtension.kt:66)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$7(ClassBasedTestDescriptor.java:359)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at 
[...]

Here is my very basic test class:

import fr.xgouchet.elmyr.annotation.IntForgery
import fr.xgouchet.elmyr.junit5.ForgeConfiguration
import fr.xgouchet.elmyr.junit5.ForgeExtension
import io.kotest.matchers.shouldBe
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith

@ExtendWith(ForgeExtension::class)
@ForgeConfiguration(seed = 0x2af7b7def4L)
class FooTest {
    @Test
    fun testSomething(@IntForgery i: Int) {
        i % 2 shouldBe 0
    }
}

version: 1.2.0
kotlin: 1.4.20
junit: 5.6.0

@xgouchet
Copy link
Owner

xgouchet commented Sep 7, 2021

Hi @vincent314, this seems like a weird issue, let me jump on it I'll try and fix it quickly.

@xgouchet
Copy link
Owner

xgouchet commented Sep 7, 2021

After some investigation, this seem to only happen when kotest is used. I've not tested Elmyr with Kotest since it already has a property based testing support.

@xgouchet xgouchet added the bug label Sep 7, 2021
@xgouchet
Copy link
Owner

xgouchet commented Sep 7, 2021

This was just fixed in version 1.3.1

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

No branches or pull requests

2 participants