Skip to content

Commit 051abb8

Browse files
authored
Bugfix/activate helidon versionutil tests (#18815)
* Reactivate tests Contrary to Junit5, classes containing TestNG tests need to have public visibility, otherwise the tests will not be discovered and run. * Reformat tests for readability * Rewrite tests using fluent assertions
1 parent 713aa92 commit 051abb8

File tree

1 file changed

+12
-23
lines changed

1 file changed

+12
-23
lines changed

modules/openapi-generator/src/test/java/org/openapitools/codegen/languages/HelidonCommonCodegenTest.java

+12-23
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,26 @@
1616
*/
1717
package org.openapitools.codegen.languages;
1818

19+
import org.testng.annotations.Test;
20+
1921
import java.util.List;
2022

21-
import org.testng.Assert;
22-
import org.testng.annotations.Test;
23+
import static org.assertj.core.api.Assertions.assertThat;
2324

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

29-
@Test
30-
void checkMajorVersionMatch() {
31-
Assert.assertEquals("1.2.3",
32-
JavaHelidonCommonCodegen.VersionUtil.instance().chooseVersion("1",
33-
List.of("3.2.1",
34-
"3.2.0",
35-
"2.0.4",
36-
"1.2.3",
37-
"1.2.2",
38-
"1.1.0")));
30+
JavaHelidonCommonCodegen.VersionUtil test = JavaHelidonCommonCodegen.VersionUtil.instance();
31+
32+
@Test void checkMajorVersionMatch() {
33+
assertThat(test.chooseVersion("1", List.of("3.2.1", "3.2.0", "2.0.4", "1.2.3", "1.2.2", "1.1.0")))
34+
.isEqualTo("1.2.3");
3935
}
4036

41-
@Test
42-
void checkExactMatch() {
43-
Assert.assertEquals("1.2.2",
44-
JavaHelidonCommonCodegen.VersionUtil.instance().chooseVersion("1.2.2",
45-
List.of("3.2.1",
46-
"3.2.0",
47-
"2.0.4",
48-
"1.2.3",
49-
"1.2.2",
50-
"1.1.0")));
37+
@Test void checkExactMatch() {
38+
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")))
39+
.isEqualTo("1.2.2");
5140
}
5241
}

0 commit comments

Comments
 (0)