Custom DataType generators with Feed4J/benerator
I am trying to i开发者_Go百科mplement a custom DataType generator for use with Feed4JUnit. I have tried implementing the provided Generator
interface. But now I get the following error:
java.lang.ClassCastException: org.databene.feed4junit.generators.CustomCheckGenerator$1 cannot be cast to [Ljava.lang.Object;
My implementation can be found here: http://goo.gl/EALMu
Looks like you're trying to cast an Enum to something else. Can't be of more help than that I'm afraid, as I don't know the specific tool, but look in that direction.
I have solved it with the help of the tool developers.
JUnit
is designed to calculate each test invocation in advance. If you do not limit the amount of generated test data, you will run intoOutOfMemoryError
.You can alternatively use an @InvocationCount:
@Test @InvocationCount(100) public void testAdd(int param1, int param2) { ... }
or limit the amount of data in the Generator code, by return null in
generate()
.
Solution was posted here.
精彩评论