All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.testcase.annotation.handle.toexcel.TestCaseAnnotationProcessorImpl Maven / Gradle / Ivy

The newest version!
package com.googlecode.testcase.annotation.handle.toexcel;

import java.util.Map;
import java.util.Set;

import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;

import com.googlecode.testcase.annotation.TestCase;
import com.googlecode.testcase.annotation.wrapper.TestCaseWrapper;

@SupportedAnnotationTypes("com.googlecode.testcase.annotation.TestCase")
public class TestCaseAnnotationProcessorImpl extends AbstractProcessor {

	static {
		System.setProperty("log4j.ignoreTCL", "true");
	}

	@Override
	public boolean process(Set annotations,
			RoundEnvironment roundEnv) {
		Map options = this.processingEnv.getOptions();

		TestCaseFileGenerator abstractTestCaseGenerator = new TestCaseFileGenerator(
				options);

		Set elementsForTestCase = roundEnv
				.getElementsAnnotatedWith(TestCase.class);
		for (Element element : elementsForTestCase) {
			TestCase annotation = element.getAnnotation(TestCase.class);
			TestCaseWrapper testCaseWrapper = new TestCaseWrapper(annotation,
					element.toString());

			abstractTestCaseGenerator.addTestCaseWrapper(testCaseWrapper);
		}

		abstractTestCaseGenerator.process();

		return true;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy