开发者

Custom DataType generators with Feed4J/benerator

开发者 https://www.devze.com 2023-02-10 09:00 出处:网络
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:

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 into OutOfMemoryError.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消