Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Here's a list of find/replace based on regexp that allow to change JUnit assertion into FEST assertion (don't forget to check regexp mode in your editor replace window).

A similar idea would be to use the Structured Search and Replace (SSR) feature of IntelliJ IDEA.

Note that FEST & JUnit assertions can coexist together, you don't have to migrate all in one time.

Changing assertEquals(0, myList.size()) to assertThat(myList).isEmpty()

It's important to run this one before the assertEquals -> isEqualTo, to avoid ending with : assertThat(myList.size()).isEqualTo(0)

Changing assertEquals(expectedSize, myList.size()) to assertThat(myList).hasSize(expectedSize)

It's important to run this one before the assertEquals -> isEqualTo, to avoid ending with : assertThat(myList.size()).isEqualTo(expectedSize)

Changing assertEquals(value, valueUnderTest) to assertThat(valueUnderTest).isEqualTo(value)

Changing assertNotEquals(value, valueUnderTest) to assertThat(valueUnderTest).isNotEqualTo(value)

Changing assertNull(objectUnderTest) to assertThat(objectUnderTest).isNull()

Changing assertNotNull(objectUnderTest) to assertThat(objectUnderTest).isNotNull()

Changing assertTrue(logicalCondition) to assertThat(logicalCondition).isTrue()

Changing assertFalse(logicalCondition) to assertThat(logicalCondition).isFalse()

  • No labels