Property-based Testing in Java: From Examples to Properties
Test-driven development in OOPLs is mostly focused on example-based test cases aka as “plain old unit tests”. Let’s say we want to check if the common JDK function java.util.Collections.reverse() works as expected. We use a simple JUnit Jupiter test for that purpose: import java.util.* ; import org.assertj.core.api.Assertions ; import org.junit.jupiter.api.Test ; class ListReverseTests { @Test void reverseList () { List < Integer > aList = Arrays . asList ( 1 , 2 , 3 ); Collections . reverse ( aList ); Asse
评论
?
参与讨论