vente viagra bruxelles 
prix viagra 50 mg 
commander cialis generique 
cialis sur internet 
viagra tarif 
viagra toulouse 
tadalafil inde 
achat cialis forum 
acheter viagra pharmacie 
achat viagra urgent 
kamagra generique 
acheter tadalafil en france 
acheter du cialis sur internet 
livraison viagra h 
buy sildenafil 
prezzo cialis originale viagra homme et femme cialis commande levitra quanto costa viagra pas cher en pharmacie generique sildenafil citrate che cosa e viagra generico soft comprar viagra barata generica cialis indien buy viagra online comprar viagra con paypal viagra kaufen holland cialis generico españa contrareembolso viagra en chewing gum achat cialismg

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.