JCodeModel generowanie kodu

0

Hej, chce wygenerowac sobie automatycznie klase do TestSuite
ma on wygladac tak

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

@RunWith(Suite.class)

@Suite.SuiteClasses({
   TestJunit1.class,
   TestJunit2.class
})

public class JunitTestSuite {   
}  	

z tym że klasy jak TestJUnit1.class itd trzymam w tablicy i chce je wrzucic tutaj automatycznie

W JCodeBlock wyskrobałem troche kodu

package com.globallogic.stg;

import java.io.File;
import java.lang.annotation.Annotation;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

import com.sun.codemodel.JCodeModel;
import com.sun.codemodel.JDefinedClass;
import com.sun.codemodel.JPackage;

/**
 * Example JCodeModel application.
 */

public class CodeModelExample {

	public static void main(String[] args) throws Exception {

		// Instantiate a new JCodeModel
		JCodeModel codeModel = new JCodeModel();

		// Create a new package
		JPackage jp = codeModel._package("com.bartek");

		// Create a new class
		JDefinedClass jc = jp._class("JunitTestSuite");

		jc.annotate(RunWith.class).paramArray("Suite.class");
		jc.annotate((Class<? extends Annotation>) Suite.class);

		// Generate the code
		codeModel.build(new File("src/main/java/"));

	}
}

ale nie wyglada to do konca jakbym chciał, ktos mogłby mi pomoc?

0

akutalnie wyglada to tak

package com.bartek;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

@RunWith(Suite.class = {

})
@Suite
public class JunitTestSuite {


}

1 użytkowników online, w tym zalogowanych: 0, gości: 1