Skip to content

Commit

Permalink
Rewrite tests using fluent assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
Philzen committed Jun 2, 2024
1 parent 2dbbbb6 commit ad3e000
Showing 1 changed file with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,26 @@
*/
package org.openapitools.codegen.languages;

import org.testng.Assert;
import org.testng.annotations.Test;

import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;

// This test class is in this package, not org.openapitools.codegen.java.helidon, so it can refer to elements of
// JavaHelidonCommonCodegen without making them public; package-private is sufficient and we don't want to expose those methods
// more broadly.
public class HelidonCommonCodegenTest {

JavaHelidonCommonCodegen.VersionUtil test = JavaHelidonCommonCodegen.VersionUtil.instance();

@Test void checkMajorVersionMatch() {
final var actual = JavaHelidonCommonCodegen.VersionUtil.instance().chooseVersion(
"1", List.of("3.2.1", "3.2.0", "2.0.4", "1.2.3", "1.2.2", "1.1.0")
);

Assert.assertEquals("1.2.3", actual);
assertThat(test.chooseVersion("1", List.of("3.2.1", "3.2.0", "2.0.4", "1.2.3", "1.2.2", "1.1.0")))
.isEqualTo("1.2.3");
}

@Test
void checkExactMatch() {
final var actual = JavaHelidonCommonCodegen.VersionUtil.instance().chooseVersion(
"1.2.2", List.of("3.2.1", "3.2.0", "2.0.4", "1.2.3", "1.2.2", "1.1.0")
);

Assert.assertEquals(
"1.2.2", actual
);
@Test void checkExactMatch() {
assertThat(test.chooseVersion("1.2.2", List.of("3.2.1", "3.2.0", "2.0.4", "1.2.3", "1.2.2", "1.1.0")))
.isEqualTo("1.2.2");
}
}

0 comments on commit ad3e000

Please # to comment.