/** * Create the content of the condition * * @param ctInvocation * @return */ private CtBlock<Object> createThen(CtInvocation<?> ctInvocation) { CtBlock<Object> thenStatement = ctInvocation.getFactory().Core().createBlock(); thenStatement.addStatement( (getFactory().Code().createCodeSnippetStatement("System.out.println(\"Else...\")"))); thenStatement.addStatement( (getFactory() .Code() .createCodeSnippetStatement( "System.out.println(" + Debug.class.getCanonicalName() + ".getSolvedPC())"))); CtAssert<Object> ctAssert = ctInvocation.getFactory().Core().createAssert(); CtCodeSnippetExpression<Boolean> assertExpression = getFactory().Core().createCodeSnippetExpression(); assertExpression.setValue("false"); ctAssert.setAssertExpression(assertExpression); ctAssert.setExpression( getFactory() .Code() .createCodeSnippetExpression( String.format("\"%s\"", ctInvocation.toString().replaceAll("\"", "'")))); thenStatement.addStatement(ctAssert); return thenStatement; }