Integrate HtmlUnit Based Tests with Apache Maven and Cargo

This blog post is a continuation of the one titled “Automating Assembly and Integration Tests with HtmlUnit” that can be read here.

In the previous post we learned how to make use of HtmlUnit API to write automated integration tests. In this post we are going to show how to integrate those tests in an Apache Maven project lifecycle while keeping a clear distinction between the unit test suite and the integration test suite.

Continue reading “Integrate HtmlUnit Based Tests with Apache Maven and Cargo”

Advertisements

Code Generation using Annotation Processors in the Java language – part 1: Annotation Types

With this post I would like to start a series about Code Generation using Annotation Processors in the Java language, how powerful they are, and at the end show how to make use of them to generate source code on compile time.

During the series we will:

  • Introduce what are Annotations in the Java language.
  • Understand the common uses of Annotations and their scopes.
  • Understand what are Annotation Processors and their defined role.
  • Learn how to build Annotation Processors.
  • Learn how to run Annotation Processors from command line, Eclipse and Maven.
  • Learn how to use Annotation Processors to generate source code.
  • Learn how to use Annotation Processors to generate source code using an external template engine as Apache Velocity.

Code Generation using Annotation Processors in the Java language – part 1: Annotation Types

Annotations were first introduced in the Java language with the third edition of the Java Language Specification (1) and first implemented in Java 5.

Using annotations, we are able to add metadata information to our source code – build or deployment information, configuration properties, compilation behavior or quality checks.

Unlike Javadocs, annotations are strong typed, having that any annotation in use has a corresponding Annotation Type defined in the classpath. Besides that, annotations can be defined to be available at run-time – not possible with Javadocs.

Continue reading “Code Generation using Annotation Processors in the Java language – part 1: Annotation Types”