Comments (22)
Debugging into this, it looks like the discovery request for (byte[], byte[]) param types comes in as [byte,[byte
which explodicates. I cannot find docs for the protocol for passing in method param type descriptors, and the javadocs on MethodSelector are... not awesome.
from jqwik.
Confirmed, it happens on arrays but not single objects.
from jqwik.
Checked it. Here's what I found...
Overview
The problem seems to occur only with primitive array types. And it does not occure withing the jqwik part of the execution chain. Which sounds like a good thing for me - because I don't have to fix it - but it's also a bad thing for me - because I CANNOT fix it :-(
Details
The selector (an instance of class MethodSelector
) that jqwik gets from the framework (aka JUnit Platform) is wrong. Wrong in the sense
that there's a method parameter type encoded as "[byte" which should be encoded as "[B". So the problem lies either in IntelliJ code or in some JUnit 5 platform support code. I'd bet on the former if I had to.
What you can do
If you care enough for the problem to be fixed, you should do the following:
- Reproduce the bug with a parameterized Jupiter test. Why? Because Jupiter (aka JUnit 5) is much more common than jqwik and will attract more attention.
- Open an issue for both junit5 and IntelliJ
- Add the links to the issues here, so that I can also track any advances in this topic.
- Hope that the JUnit team and the IntelliJ team will sort out the underlying problem.
I'm sorry that I can't offer a better solution.
One more thing
It's helpful for any issue you create to provide at least
- A code example or even a failing test
- The version numbers of all participating parties, in this case of jqwik, the junit platform and IntelliJ
from jqwik.
Looks like a bug in IDEA. The IDE should feed [B
as the parameter type, @akozlova -- am I right?
from jqwik.
Please see junit-team/junit5#815. IDEA never passes VM names, only source names.
from jqwik.
I remember that one. Wasn't the solution to send byte[]
instead of a mesh-up like [byte
?
from jqwik.
I don't remember exactly, but [Ljava.lang.String;
is similar to [byte
to me.
from jqwik.
We should take the discussion over to junit-team/junit5#815
@brianm a possible work-around is to use java.nio.ByteBuffer
for now. Replace byte[] data
with ByteBuffer data
in your test method and wrap the bytes with ByteBuffer.wrap(...)
.
Edit
I cannot find docs for the protocol for passing in method param type descriptors, and the javadocs on MethodSelector are... not awesome.
ReflectionSupport.loadClass
doc contains the information you were looking for:
from jqwik.
This is a bug in IntelliJ.
The supported syntax is clearly documented here:
from jqwik.
[byte
is neither valid in source code nor in binary.
from jqwik.
I cannot find docs for the protocol for passing in method param type descriptors, and the javadocs on MethodSelector are... not awesome.
Good point.
I introduced cross referencing in this commit.
from jqwik.
I don't remember exactly, but
[Ljava.lang.String;
is similar to[byte
to me.
Yep, it is indeed similar but unfortunately unsupported.
Will you raise an issue against IDEA for this?
from jqwik.
This will teach me again to do nothing before I actually can check it. I had a test data for [int array which I thought would be supported. Here is the IDEA issue: https://youtrack.jetbrains.com/issue/IDEA-189846
from jqwik.
@akozlova, no worries... We are all quite confident that you will fix it blazingly fast (as always)! 😉
from jqwik.
Wow, ya'll rock. Thank you! Apologies for no test code :-(
from jqwik.
@akozlova Any news on this front?
from jqwik.
I've created issue in IDEA's tracker (IDEA-189846) and resolved it in the same day. I am not aware of anything else I should do here.
from jqwik.
Has been fixed in in IntelliJ: https://youtrack.jetbrains.com/issue/IDEA-189846
Available probably in version 2018.2
from jqwik.
@akozlova Thanks, the fix somehow slipped my mind.
from jqwik.
The fix is included in IntelliJ 2018.2. Everything works as expected :-)
from jqwik.
@jlink seems the issue reproduces again using jqwik 1.3.0 and IDEA 2020.1.
Version 1.2.0 works fine
from jqwik.
I cannot reproduce with
@Property
void test(@ForAll byte[] bytes) {}
@nick318 Can you be more specific about the failure you are observing?
from jqwik.
Related Issues (20)
- Javadocs and source files are missing on Central HOT 2
- Make IgnoreException "attempts" (and other related hard coded values) configurable HOT 11
- Allow to define a scope/lifespan with @Provide methods HOT 7
- Support UniqueElements annotation for Extensions HOT 1
- Bug: PropertyExecutor.execute() does not handle AssertionErrors correctly HOT 1
- ClassCastException when using Combinators during shrinking HOT 21
- ListArbitrary<T> providers are not selected to resolve List<T> parameters HOT 1
- Support OpenJML for Arbitraries
- Jqwik Quarkus Support HOT 2
- Type arguments are missing in some situations HOT 8
- support for heterogeneous arbitrary configurators in base HOT 9
- Arbitrary.size as an option to tweak during arbitrary construction. HOT 22
- Feature Request: Report generator state when generation fails with exception
- Provide a way to suppress excessive output/stacktraces HOT 16
- Domains inject parameterized values incorrectly HOT 25
- Method to specify the order of execution for tests HOT 5
- Programmatic use of jqwik without JUnit HOT 3
- Repeatead chars not working as expected HOT 6
- Every X years in @YearRange HOT 1
- Allow parallel test runs with SBT HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jqwik.