mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-03-10 08:31:23 +00:00
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
This commit is contained in:
@@ -16,37 +16,26 @@
|
||||
*/
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
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.
|
||||
class HelidonCommonCodegenTest {
|
||||
public class HelidonCommonCodegenTest {
|
||||
|
||||
@Test
|
||||
void checkMajorVersionMatch() {
|
||||
Assert.assertEquals("1.2.3",
|
||||
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")));
|
||||
JavaHelidonCommonCodegen.VersionUtil test = JavaHelidonCommonCodegen.VersionUtil.instance();
|
||||
|
||||
@Test void checkMajorVersionMatch() {
|
||||
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() {
|
||||
Assert.assertEquals("1.2.2",
|
||||
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")));
|
||||
@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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user