Due to a ransomware attack, the wiki was reverted to a July 2022 version. . We apologize for the lack of a more recent valid backup.
...
Code Block | ||||
---|---|---|---|---|
| ||||
import static org.onlab.junit.UtilityClassChecker.assertThatClassIsUtility; /** * Check that the Criteria class is a valid utility class. */ @Test public void testCriteriaUtility() { assertThatClassIsUtility(Criteria.class); } |
- A basic test for each one of your constructors and a check for the values returned by data access methods should always be included:
Code Block | ||||
---|---|---|---|---|
| ||||
/**
* Checks the construction of a FlowId object.
*/
@Test
public void testConstruction() {
final long flowIdValue = 7777L;
final FlowId flowId = FlowId.valueOf(flowIdValue);
assertThat(flowId, is(notNullValue()));
assertThat(flowId.value(), is(flowIdValue));
} |
Hamcrest is a powerful framework for defining matchers for data values in tests. ONOS uses version 1.3 of Hamcrest. Contributors are encouraged to learn about and use the Hamcrest framework, particularly when working with arrays and collections.
We use the Hamcrest matchers, version 1.3.