TestNG Exception when converting unit test

Intention: Convert JUnit to NG --> ok - I had no language level 1.4 set

btw., is there a way to use testng without the assert statement, to test projects with language level 1.3?

Bye,
M.

Incorrect statement "assert false : "x";".
com.intellij.util.IncorrectOperationException: Incorrect statement "assert false : "x";".
at com.intellij.psi.impl.PsiElementFactoryImpl.createStatementFromText(PsiElementFactoryImpl.java:173)
at com.theoryinpractice.testng.util.Intentions.createAssert(Intentions.java:286)
at com.theoryinpractice.testng.util.Intentions.convert(Intentions.java:68)
at com.theoryinpractice.testng.intention.ConvertJUnitIntention.invoke(ConvertJUnitIntention.java:40)
at com.intellij.codeInsight.intention.impl.IntentionHintComponent$ListPopupRunnable$1$1$1.run(IntentionHintComponent.java:1)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:139)
at com.intellij.codeInsight.intention.impl.IntentionHintComponent$ListPopupRunnable$1$1$2.run(IntentionHintComponent.java:1)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:109)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:20)
at com.intellij.codeInsight.intention.impl.IntentionHintComponent$ListPopupRunnable$1$1.run(IntentionHintComponent.java:5)
at com.intellij.openapi.application.impl.LaterInvocatorEx$FlushQueue.run(LaterInvocatorEx.java:3)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:25)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:128)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:62)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

1 comment
Comment actions Permalink

Yeah, the converter unfortunately does emit 1.4 code. It is possible to convert it by hand though later on by not using java level asserts, and instead using the Assert or JUnitAssert classes for your asserts.

0

Please sign in to leave a comment.