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

Randoop fails with a runtime exception when generating tests for spring #1100

Open
jensdietrich opened this issue Nov 29, 2022 · 1 comment

Comments

@jensdietrich
Copy link

In my setup I try to generate tests for spring beans using the following parameters:

--testjar <some-path>/spring-beans-5.3.22.jar --no-regression-assertions --junit-package-name=generated.org.springframework.beans --junit-output-dir=generated-tests --log=randoop-spring-beans-5.3.22.log

The classpath work, and I have generated tests for some particular classes successfully. However, when I try to run this on the jar, randoop fails with an IllegalStateException caused by a failed spring assertion.

Throwable thrown while handling command: java.lang.IllegalStateException: Singleton instance not initialized yet
java.lang.IllegalStateException: Singleton instance not initialized yet
	at org.springframework.util.Assert.state(Assert.java:76)
	at org.springframework.beans.factory.config.AbstractFactoryBean.getSingletonInstance(AbstractFactoryBean.java:188)
	at org.springframework.beans.factory.config.AbstractFactoryBean.access$200(AbstractFactoryBean.java:63)
	at org.springframework.beans.factory.config.AbstractFactoryBean$EarlySingletonInvocationHandler.invoke(AbstractFactoryBean.java:275)
	at com.sun.proxy.$Proxy18.entrySet(Unknown Source)
	at randoop.org.plumelib.util.StringsPlume.mapToStringAndClass(StringsPlume.java:1144)
	at randoop.org.plumelib.util.StringsPlume.toStringAndClass(StringsPlume.java:1027)
	at randoop.org.plumelib.util.StringsPlume.toStringAndClass(StringsPlume.java:1001)
	at randoop.operation.MethodCall.execute(MethodCall.java:170)
	at randoop.operation.TypedOperation.execute(TypedOperation.java:310)
	at randoop.sequence.Statement.execute(Statement.java:163)
	at randoop.sequence.ExecutableSequence.executeStatement(ExecutableSequence.java:415)
	at randoop.sequence.ExecutableSequence.execute(ExecutableSequence.java:307)
	at randoop.sequence.ExecutableSequence.execute(ExecutableSequence.java:236)
	at randoop.generation.ForwardGenerator.step(ForwardGenerator.java:237)
	at randoop.generation.AbstractGenerator.createAndClassifySequences(AbstractGenerator.java:321)
	at randoop.main.GenTests.handle(GenTests.java:510)
	at randoop.main.Main.nonStaticMain(Main.java:71)
	at randoop.main.Main.main(Main.java:31)
@jensdietrich
Copy link
Author

I have also notices this exception that always seemed to happen just before:

Will try to generate tests for 286 classes.
Removing org.springframework.beans.factory.groovy.GroovyDynamicElementReader$_invokeMethod_closure1 from the classes under test due to problem extracting operations:
java.lang.NullPointerException
	at randoop.reflection.DefaultReflectionPredicate.doNotUseSpecialCase(DefaultReflectionPredicate.java:234)
	at randoop.reflection.DefaultReflectionPredicate.test(DefaultReflectionPredicate.java:106)
	at randoop.reflection.OperationExtractor.visit(OperationExtractor.java:435)
	at randoop.reflection.ReflectionManager.applyTo(ReflectionManager.java:309)
	at randoop.reflection.ReflectionManager.apply(ReflectionManager.java:150)
	at randoop.reflection.OperationExtractor.operations(OperationExtractor.java:216)
	at randoop.reflection.OperationModel.addOperationsFromClasses(OperationModel.java:682)
	at randoop.reflection.OperationModel.createModel(OperationModel.java:173)
	at randoop.main.GenTests.handle(GenTests.java:313)
	at randoop.main.Main.nonStaticMain(Main.java:71)
	at randoop.main.Main.main(Main.java:31)

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

1 participant