Skip to end of metadata
Go to start of metadata

FEST Assertions Module has moved to Github !

Check this page :https://github.com/alexruiz/fest-assert-2.x/wiki

The documentation below is for Fest 1.x which is no more maintained, we are focusing our effort to the 2.x version !

....

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