[ https://issues.apache.org/jira/browse/CALCITE-5726?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Hyde resolved CALCITE-5726. ---------------------------------- Fix Version/s: 1.35.0 Resolution: Fixed Fixed in [0b819dfe|https://github.com/apache/calcite/commit/0b819dfe83f19f9647e9b05da98332b53c189c7d]. > Canonize use of Hamcrest matchers in test code > ---------------------------------------------- > > Key: CALCITE-5726 > URL: https://issues.apache.org/jira/browse/CALCITE-5726 > Project: Calcite > Issue Type: Bug > Reporter: Julian Hyde > Assignee: Julian Hyde > Priority: Major > Fix For: 1.35.0 > > > Canonize use of Hamcrest matchers in test code. > 1. If there are multiple equivalent methods, use the canonical one: > * CoreMatchers.is → Is.is > * Matchers.hasToString → HasToString.hasToString > * Matchers.hasSize → IsCollectionWithSize.hasSize > * Matchers.aMapWithSize → IsMapWithSize.aMapWithSize > 2. Use matchers for {{Object.toString()}}, {{Collection.size()}}, > {{Map.size()}}: > * assertThat(map.size(), is\(n)) → assertThat(map, aMapWithSize\(n)); > * assertThat(list.size(), is\(n)) → assertThat(map, > IsCollectionWithSize.hasSize\(n)); > * assertThat(o.toString(), is(s)) → assertThat(o, hasToString(s)); > * assertThat(o.toString(), equalTo(s)) → assertThat(o, hasToString(s)); > Require static import of Hamcrest methods. > > The benefit is conciseness/uniformity of tests. Most of these transformations > can be accomplished using autostyle rules in the Gradle {{build.gradle.kts}}, > so people's code will be fixed using {{gradle autostyleApply}}. -- This message was sent by Atlassian Jira (v8.20.10#820010)