Opentelemetry-java: Inconsistency in tests static imports, need to document what to use

Created on 4 Nov 2020  路  5Comments  路  Source: open-telemetry/opentelemetry-java

I saw usages of:

import static org.junit.Assert.assertEquals;

// AND

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.assertj.core.api.Assertions.assertThat;

// AND

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;  // a simple replace of Assertions works.
Bug

Most helpful comment

We, in my opinion, should standardize on assertj with import static org.assertj.core.api.Assertions.assertThat;

All 5 comments

We, in my opinion, should standardize on assertj with import static org.assertj.core.api.Assertions.assertThat;

what about assertEquals which one should we use?

I've found all the assertX() methods with assertj to be far easier to use than the ones with JUnit 5

what about assertEquals which one should we use?

assertThat(x).isEqualTo(y). Has the great advantage that you don't get expected vs actual wrong about 40% of the time 馃槃

what about assertEquals which one should we use?

I think we shouldn't use either of them, and just stick with assertj

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arminru picture arminru  路  5Comments

arminru picture arminru  路  5Comments

jkwatson picture jkwatson  路  3Comments

jkwatson picture jkwatson  路  5Comments

carlosalberto picture carlosalberto  路  4Comments