vente viagra andorre cialis 20 mg filmtabletten vente de cialis en belgique cialis 20mg prix du viagra 50 mg proscar 5 mg prezzo viagra rezeptfrei ch compra priligy online acheter cialis en ligne levitra schweiz tadalafil achat comprar viagra por telefono venta viagra españa comprar viagra españa vente viagra inde acheter viagra belgique
baclofen kaufen ohne rezept viagra tabletten viagra a vendre montreal cialis packungsbeilage køb cialis online cialis viagra levitra differenze kamagra belgique köpa viagra i spanien baclofen 10 mg vente viagra canada viagra medicinale viagra tarifs viagra online versand cialis generico españa viagra pille preis

IntelliJ Structural Search to Convert from JUnit3 to Junit4

Just a quick tip for intellij users. For an old project i wanted to convert JUnit 3 testcases to JUnit4 format. Most stuff was already in place, but after the conversion, i found that some of the old “assertTrue”, “assertFalse”, and “assertEquals” statements were failing.

So i ended up with some short search/replace, which are really handy in IntelliJ.

Replace “assertTrue” and “assertFalse” with “assertThat”

Search template

assertTrue($msg$, $actual$);

Replacement template:

org.junit.Assert.assertThat.assertThat($msg$, $actual$, org.hamcrest.core.Is.is(true));

Remove “assertEquals” with delta values

Search template

assertEquals($msg$, $expected$, $actual$, $delta$);

Replacement template:

org.junit.Assert.assertThat($msg$, $actual$, org.hamcrest.core.Is.is($expected$));

Optional Replace “assertEquals” with “assertThat”

Search template

assertEquals($msg$, $expected$, $actual$);

Replacement template:

org.junit.Assert.assertThat.assertThat($msg$, $actual$, org.hamcrest.core.Is.is($expected$));

Comments are closed.