Migrating from Fest Swing

Migrating from Fest is easy! Since AssertJ Swing is a fork of Fest, there are very few breaking changes. But we forked a not-published version (1.4-SNAPSHOT). So you may have to migrate more than this few easy changes from your Fest version to AssertJ Swing. Below are all steps regarding to your Fest version.

The easiest part of the migration might be the part we changed: the naming from Fest to AssertJ Swing.

First you should have a look at the FEST to AssertJ migration guide! All steps of migrating the core assertions are not described here but there.

You should change your imports. Both, normal and static imports.

import static org.fest.swing.*

to

import static org.assertj.swing.*

For linux users, a quick way to do that is to use this command (see also all-in-one command)

find . -name "*.java" -exec sed -i "s/import static org.fest.swing./import static org.assertj.swing./g;s/import org.fest.swing./import org.assertj.swing./g" '{}' \;

Another simple (in terms of automatable) task is to rename the base test classes from

FestSwingTestCaseTemplate
FestSwingJUnitTestCase
FestSwingTestNGTestCase

to

AssertJSwingTestCaseTemplate
AssertJSwingJUnitTestCase
AssertJSwingTestNGTestCase

Linux users use this command (see also all-in-one command)

find . -name "*.java" -exec sed -i "s/FestSwingTestCaseTemplate/AssertJSwingTestCaseTemplate/g;s/FestSwingJUnitTestCase/AssertJSwingJUnitTestCase/g;s/FestSwingTestNGTestCase/AssertJSwingTestNGTestCase/g" '{}' \;

To perform all steps above at once use this script.

find . -name "*.java" -exec sed -i "s/import static org.fest.swing./import static org.assertj.swing./g;s/import org.fest.swing./import org.assertj.swing./g;s/FestSwingTestCaseTemplate/AssertJSwingTestCaseTemplate/g;s/FestSwingJUnitTestCase/AssertJSwingJUnitTestCase/g;s/FestSwingTestNGTestCase/AssertJSwingTestNGTestCase/g" '{}' \;

Above we described the steps that should help you to migrate most parts of your code. Unfortunately there are some things to do which we were not able to script so that it would be 100% fail-safe (but of course we would love to see your solution if you made it!). So you have to do them manually. These migrations are the result of the refactorings made after publishing Fest 1.2.x.

Surely we missed some migration steps since we don't make use of the full API in our sample projects. So please don't hesitate to notify us about further migration steps you encounter!

Fest 1.2.x allowed to access some fields directly, Fest 1.4-SNAPSHOT and therefore AssertJ Swing does not. Basically this comes down to replacing

<AbstractComponentFixture>.robot
<AbstractComponentFixture>.target

by

<AbstractComponentFixture>.robot()
<AbstractComponentFixture>.target()

Although scriptable this is not fail-safe, use this command only if you have a sufficient VCS or backups.

find . -name "*.java" -exec sed -i "s/robot\([^(]\)/robot()\1/g;s/target\([^(]\)/target()\1/g" '{}' \;

Fest 1.2.x has the method component(), Fest 1.4-SNAPSHOT not. Replace it by target().

Although scriptable this is not fail-safe, use this command only if you have a sufficient VCS or backups.

find . -name "*.java" -exec sed -i "s/component()/target()/g" '{}' \;

With Fest 1.2.x you could replace a driver of a fixture with driver(ComponentDriver). This method has been renamed to replaceDriverWith(ComponentDriver).

Although scriptable this is not fail-safe, use this command only if you have a sufficient VCS or backups.

find . -name "*.java" -exec sed -i "s/driver(\([^)]\)/replaceDriverWith(\1/g" '{}' \;

The class Pair had two fields: i and ii. These are now called first and second.