Sascha Tayefeh's Homepage

Blogging about Information Technology

Archive for the ‘Tutorial’ tag

JUnit4 and Maven – minimal example

with 2 comments

When I migrated an old project from JUnit3 to JUnit4, I ran into some problems. mvn:test produced an error:

junit.framework.AssertionFailedError: No tests found in minimal.DoSomeActionTest

>The test classes were no longer available. I found that I had to remove inheritance from :TestCase() and annotate all test methods with @Test. Here is a trivial example:

package minimal;
import org.junit.Assert;
import org.junit.Test;
public class DoSomeActionTest {
    @Test
    public void testIsThisReallyTrue() {
        Assert.assertTrue(true);
    }
}

In case you have your project managed by maven, remember to make use of the maven-compiler-plugin to enforce Java 1.6 (required for annotations):

            <plugin>
                <groupId>
                  org.apache.maven.plugins
                </groupId>
                <artifactId>
                  maven-compiler-plugin
                </artifactId>
                <version>2.3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>

When running mvn:test you should get following positive message:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running minimal.DoSomeActionTest

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Sun Jul 11 17:22:44 CEST 2010
[INFO] Final Memory: 10M/19M
[INFO] ------------------------------------------------------------------------

I have prepared a working maven project. It was published at github. Get your local copy by cloning with git:

git clone git://github.com/sastay/JUnit4-and-Maven-Example.git

Written by Sascha Tayefeh

July 13th, 2010 at 6:31 pm

Posted in Coding

Tagged with , , , , , , ,

The Gimp – Tutorials

without comments

The tutorials at http://www.gimp.org/tutorials/ are very useful. You may come to astonishing results following them. My favourite ones are

Another nice tutorial that deals with creating vintage look using The Gimp is here:

http://www.linuxjournal.com/article/6750

It focuses on more subtle filtering.

Written by Sascha Tayefeh

November 14th, 2009 at 11:03 pm

Switch to our mobile site