diff --git a/.gitignore b/.gitignore index f73850f56b..81c33b22aa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.scannerwork/ .vscode *.iml out/ diff --git a/modules/openapi-generator-cli/pom.xml b/modules/openapi-generator-cli/pom.xml index b02f64f636..6aa9eb42de 100644 --- a/modules/openapi-generator-cli/pom.xml +++ b/modules/openapi-generator-cli/pom.xml @@ -109,9 +109,9 @@ test - org.jmockit - jmockit - + org.mockito + mockito-core + ${mockito-version} test diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java index cf8f8a1dd3..de331cde1e 100644 --- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java +++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java @@ -28,22 +28,17 @@ import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; -import org.openapitools.codegen.ClientOptInput; -import org.openapitools.codegen.CodegenConstants; -import org.openapitools.codegen.DefaultGenerator; -import org.openapitools.codegen.GeneratorNotFoundException; + +import org.openapitools.codegen.*; import org.openapitools.codegen.config.CodegenConfigurator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** - * User: lanwen Date: 24.03.15 Time: 20:22 - */ - @Command(name = "generate", description = "Generate code with the specified generator.") public class Generate implements Runnable { - // private static final Logger LOGGER = LoggerFactory.getLogger(Generate.class); + CodegenConfigurator configurator; + Generator generator; @Option(name = {"-v", "--verbose"}, description = "verbose mode") private Boolean verbose; @@ -257,13 +252,18 @@ public class Generate implements Runnable { .ifPresent(FilterAttachable::clearAllFilters); } - // attempt to read from config file - CodegenConfigurator configurator = CodegenConfigurator.fromFile(configFile); - - // if a config file wasn't specified or we were unable to read it + // this initial check allows for field-level package private injection (for unit testing) if (configurator == null) { - // createa a fresh configurator - configurator = new CodegenConfigurator(); + if (configFile != null && configFile.length() > 0) { + // attempt to load from configFile + configurator = CodegenConfigurator.fromFile(configFile); + } + + // if a config file wasn't specified, or we were unable to read it + if (configurator == null) { + // create a fresh configurator + configurator = new CodegenConfigurator(); + } } // now override with any specified parameters @@ -413,7 +413,14 @@ public class Generate implements Runnable { try { final ClientOptInput clientOptInput = configurator.toClientOptInput(); - new DefaultGenerator().opts(clientOptInput).generate(); + + // this null check allows us to inject for unit testing. + if (generator == null) { + generator = new DefaultGenerator(); + } + + generator.opts(clientOptInput); + generator.generate(); } catch (GeneratorNotFoundException e) { System.err.println(e.getMessage()); System.err.println("[error] Check the spelling of the generator's name and try again."); diff --git a/modules/openapi-generator-cli/src/test/java/org/openapitools/codegen/cmd/GenerateTest.java b/modules/openapi-generator-cli/src/test/java/org/openapitools/codegen/cmd/GenerateTest.java index 8f1879dd98..496e078a15 100644 --- a/modules/openapi-generator-cli/src/test/java/org/openapitools/codegen/cmd/GenerateTest.java +++ b/modules/openapi-generator-cli/src/test/java/org/openapitools/codegen/cmd/GenerateTest.java @@ -17,536 +17,417 @@ package org.openapitools.codegen.cmd; -import org.openapitools.codegen.ClientOptInput; -import org.openapitools.codegen.DefaultGenerator; -import org.openapitools.codegen.OpenAPIGenerator; -import org.openapitools.codegen.config.CodegenConfigurator; -import mockit.Expectations; -import mockit.FullVerifications; -import mockit.Injectable; -import mockit.Mocked; -import mockit.Verifications; +import io.airlift.airline.Cli; import org.apache.commons.lang3.ArrayUtils; +import org.mockito.MockSettings; +import org.openapitools.codegen.DefaultGenerator; +import org.openapitools.codegen.Generator; +import org.openapitools.codegen.config.CodegenConfigurator; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; + +import static org.mockito.Answers.CALLS_REAL_METHODS; +import static org.mockito.Mockito.*; +import static org.testng.Assert.fail; + @SuppressWarnings("unused") public class GenerateTest { - @Mocked - CodegenConfigurator configurator; + protected MockSettings mockSettings = withSettings().useConstructor().defaultAnswer(CALLS_REAL_METHODS); + private Generator generator; + private CodegenConfigurator configurator; + private Path outputDirectory; - @Injectable - ClientOptInput clientOptInput; + @AfterMethod + public void afterEachTest() { + outputDirectory.toFile().deleteOnExit(); + } - @Mocked - DefaultGenerator generator; + @BeforeMethod + public void beforeEachTest() throws IOException { + outputDirectory = Files.createTempDirectory("GenerateTest"); + generator = mock(DefaultGenerator.class); + when(generator.generate()).thenReturn(new ArrayList<>()); - @Test - public void testVerbose() throws Exception { - setupAndRunGenericTest("-v"); - - new FullVerifications() { - { - configurator.setVerbose(true); - times = 1; - } - }; - - setupAndRunGenericTest("--verbose"); - - new FullVerifications() { - { - configurator.setVerbose(true); - times = 1; - } - }; + configurator = mock(CodegenConfigurator.class, mockSettings); } @Test - public void testRequiredArgs_ShortArgs() throws Exception { - setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", false, null, "-p", "foo=bar"); - new FullVerifications() { - { - configurator.addAdditionalProperty("foo", "bar"); - times = 1; - } - }; - } - - @Test - public void testRequiredArgs_LongArgs() throws Exception { - setupAndRunTest("--input-spec", "src/test/resources/swagger.yaml", "--generator-name", "java", "--output", - "src/main/java", false, null); - new FullVerifications() { - { - } - }; - } - - @Test - public void testTemplateDir() throws Exception { - - final String templateDir = "src/main/resources/customTemplates"; - - setupAndRunGenericTest("--template-dir", templateDir); - - new FullVerifications() { - { - configurator.setTemplateDir(templateDir); - times = 1; - } - }; - - setupAndRunGenericTest("-t", templateDir); - - new FullVerifications() { - { - configurator.setTemplateDir(templateDir); - times = 1; - } - }; - } - - @Test - public void testAuth() throws Exception { - - final String auth = "hello:world"; - - setupAndRunGenericTest("--auth", auth); - - new FullVerifications() { - { - configurator.setAuth(auth); - times = 1; - } - }; - - setupAndRunGenericTest("-a", auth); - - new FullVerifications() { - { - configurator.setAuth(auth); - times = 1; - } - }; - - setupAndRunGenericTest(); - - new FullVerifications() { - { - configurator.setAuth(anyString); - times = 0; - } - }; - } - - @Test - public void testConfigJson() throws Exception { - - setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", true, - "config.json", "-c", "config.json"); - - new FullVerifications() { - { - } - }; - - setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", true, - "config.json", "--config", "config.json"); - - new FullVerifications() { - { - } - }; - } - - @Test - public void testConfigYaml() throws Exception { - - setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", true, - "config.yaml", "-c", "config.yaml"); - - new FullVerifications() { - { - } - }; - - setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", true, - "config.yaml", "--config", "config.yaml"); - - new FullVerifications() { - { - } - }; - } - - @Test - public void testSkipOverwrite() throws Exception { - - setupAndRunGenericTest("-s"); - new FullVerifications() { - { - configurator.setSkipOverwrite(true); - times = 1; - } - }; - - setupAndRunGenericTest("--skip-overwrite"); - new FullVerifications() { - { - configurator.setSkipOverwrite(true); - times = 1; - } - }; - } - - @Test - public void testStrictSpec() throws Exception { - - setupAndRunGenericTest("--strict-spec", "true"); - new FullVerifications() { - { - configurator.setStrictSpecBehavior(true); - times = 1; - } - }; - - setupAndRunGenericTest("--strict-spec", "false"); - new FullVerifications() { - { - configurator.setStrictSpecBehavior(false); - times = 1; - } - }; - } - - @Test - public void testPackageName() throws Exception { - final String value = "io.foo.bar.baz"; - setupAndRunGenericTest("--package-name", value); - - new FullVerifications() { - { - configurator.setPackageName(value); - times = 1; - } - }; - } - - @Test - public void testApiPackage() throws Exception { - final String value = "io.foo.bar.api"; - setupAndRunGenericTest("--api-package", value); - - new FullVerifications() { - { - configurator.setApiPackage(value); - times = 1; - } - }; - } - - @Test - public void testModelPackage() throws Exception { - final String value = "io.foo.bar.api"; - setupAndRunGenericTest("--model-package", value); - - new FullVerifications() { - { - configurator.setModelPackage(value); - times = 1; - } - }; - } - - @Test - public void testInstantiationTypes() throws Exception { - - setupAndRunGenericTest("--instantiation-types", "hello=world,key=,foo=bar,key2"); - - new FullVerifications() { - { - configurator.addInstantiationType("hello", "world"); - times = 1; - configurator.addInstantiationType("foo", "bar"); - times = 1; - configurator.addInstantiationType("key", ""); - times = 1; - configurator.addInstantiationType("key2", ""); - times = 1; - } - }; - - setupAndRunGenericTest("--instantiation-types", "hello=world", "--instantiation-types", - "key=", "--instantiation-types", "foo=bar", "--instantiation-types", "key2"); - - new FullVerifications() { - { - configurator.addInstantiationType("hello", "world"); - times = 1; - configurator.addInstantiationType("foo", "bar"); - times = 1; - configurator.addInstantiationType("key", ""); - times = 1; - configurator.addInstantiationType("key2", ""); - times = 1; - } - }; - } - - @Test - public void testTypeMappings() throws Exception { - setupAndRunGenericTest("--type-mappings", "hello=world,key=,foo=bar,key2"); - - new FullVerifications() { - { - configurator.addTypeMapping("hello", "world"); - times = 1; - configurator.addTypeMapping("foo", "bar"); - times = 1; - configurator.addTypeMapping("key", ""); - times = 1; - configurator.addTypeMapping("key2", ""); - times = 1; - } - }; - - setupAndRunGenericTest("--type-mappings", "hello=world", "--type-mappings", "key=", - "--type-mappings", "foo=bar", "--type-mappings", "key2"); - - new FullVerifications() { - { - configurator.addTypeMapping("hello", "world"); - times = 1; - configurator.addTypeMapping("foo", "bar"); - times = 1; - configurator.addTypeMapping("key", ""); - times = 1; - configurator.addTypeMapping("key2", ""); - times = 1; - } - }; - } - - @Test - public void testAdditionalProperties() throws Exception { + public void testAdditionalPropertiesLong() { setupAndRunGenericTest("--additional-properties", "hello=world,key=,foo=bar,key2"); + verify(configurator).addAdditionalProperty("hello", "world"); + verify(configurator).addAdditionalProperty("foo", "bar"); + verify(configurator).addAdditionalProperty("key", ""); + verify(configurator).addAdditionalProperty("key2", ""); + } - new FullVerifications() { - { - configurator.addAdditionalProperty("hello", "world"); - times = 1; - configurator.addAdditionalProperty("foo", "bar"); - times = 1; - configurator.addAdditionalProperty("key", ""); - times = 1; - configurator.addAdditionalProperty("key2", ""); - times = 1; - } - }; - + @Test + public void testAdditionalPropertiesLongMultiple() { setupAndRunGenericTest("--additional-properties", "hello=world", "--additional-properties", "key=", "--additional-properties", "foo=bar", "--additional-properties", "key2"); - - new FullVerifications() { - { - configurator.addAdditionalProperty("hello", "world"); - times = 1; - configurator.addAdditionalProperty("foo", "bar"); - times = 1; - configurator.addAdditionalProperty("key", ""); - times = 1; - configurator.addAdditionalProperty("key2", ""); - times = 1; - } - }; + verify(configurator).addAdditionalProperty("hello", "world"); + verify(configurator).addAdditionalProperty("foo", "bar"); + verify(configurator).addAdditionalProperty("key", ""); + verify(configurator).addAdditionalProperty("key2", ""); } @Test - public void testLanguageSpecificPrimitives() throws Exception { - setupAndRunGenericTest("--language-specific-primitives", "foo,,bar", - "--language-specific-primitives", "hello,world"); - - new FullVerifications() { - { - configurator.addLanguageSpecificPrimitive("foo"); - times = 1; - configurator.addLanguageSpecificPrimitive("bar"); - times = 1; - configurator.addLanguageSpecificPrimitive("hello"); - times = 1; - configurator.addLanguageSpecificPrimitive("world"); - times = 1; - } - }; - } - - @Test - public void testImportMappings() throws Exception { - setupAndRunGenericTest("--import-mappings", "hello=world,key=,foo=bar,key2"); - - new FullVerifications() { - { - configurator.addImportMapping("hello", "world"); - times = 1; - configurator.addImportMapping("foo", "bar"); - times = 1; - configurator.addImportMapping("key", ""); - times = 1; - configurator.addImportMapping("key2", ""); - times = 1; - } - }; - - setupAndRunGenericTest("--import-mappings", "hello=world", "--import-mappings", "key=", - "--import-mappings", "foo=bar", "--import-mappings", "key2"); - - new FullVerifications() { - { - configurator.addImportMapping("hello", "world"); - times = 1; - configurator.addImportMapping("foo", "bar"); - times = 1; - configurator.addImportMapping("key", ""); - times = 1; - configurator.addImportMapping("key2", ""); - times = 1; - } - }; - } - - @Test - public void testInvokerPackage() throws Exception { + public void testApiPackage() { final String value = "io.foo.bar.api"; - setupAndRunGenericTest("--invoker-package", value); - - new FullVerifications() { - { - configurator.setInvokerPackage(value); - times = 1; - } - }; + setupAndRunGenericTest("--api-package", value); + verify(configurator).setApiPackage(value); } @Test - public void testGroupId() throws Exception { - final String value = "io.foo.bar.api"; - setupAndRunGenericTest("--group-id", value); - - new FullVerifications() { - { - configurator.setGroupId(value); - times = 1; - } - }; - } - - @Test - public void testArtifactId() throws Exception { + public void testArtifactId() { final String value = "awesome-api"; setupAndRunGenericTest("--artifact-id", value); - new FullVerifications() { - { - configurator.setArtifactId(value); - times = 1; - } - }; - } - - @Test - public void testArtifactVersion() throws Exception { - final String value = "1.2.3"; - setupAndRunGenericTest("--artifact-version", value); - - new FullVerifications() { - { - configurator.setArtifactVersion(value); - times = 1; - } - }; - } - - @Test - public void testLibrary() throws Exception { - final String value = "library1"; - setupAndRunGenericTest("--library", value); - - new FullVerifications() { - { - configurator.setLibrary(value); - times = 1; - } - }; - } - - private void setupAndRunTest(String specFlag, final String spec, String langFlag, - final String lang, String outputDirFlag, final String outputDir, - boolean configuratorFromFile, final String configFile, String... additionalParameters) { - final String[] commonArgs = - {"generate", langFlag, lang, outputDirFlag, outputDir, specFlag, spec}; - - String[] argsToUse = ArrayUtils.addAll(commonArgs, additionalParameters); - - if (configuratorFromFile) { - - new Expectations() { - { - CodegenConfigurator.fromFile(configFile); - times = 1; - result = configurator; - } - }; - - } else { - new Expectations() { - { - CodegenConfigurator.fromFile(anyString); - result = null; - - new CodegenConfigurator(); - times = 1; - result = configurator; - } - }; - } - - new Expectations() { - { - - configurator.toClientOptInput(); - times = 1; - result = clientOptInput; - - new DefaultGenerator(); - times = 1; - result = generator; - - generator.opts(clientOptInput); - times = 1; - result = generator; - - generator.generate(); - times = 1; - - } - }; - - OpenAPIGenerator.main(argsToUse); - - new Verifications() { - { - configurator.setGeneratorName(lang); - times = 1; - configurator.setInputSpec(spec); - times = 1; - configurator.setOutputDir(outputDir); - } - }; + verify(configurator).setArtifactId(value); } private void setupAndRunGenericTest(String... additionalParameters) { setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", false, null, additionalParameters); } + + @SuppressWarnings("SameParameterValue") + private void setupAndRunTest(String specFlag, final String spec, String langFlag, + final String lang, String outputDirFlag, final String outputDir, + boolean configuratorFromFile, final String configFile, String... additionalParameters) { + final String[] commonArgs = + {"generate", langFlag, lang, outputDirFlag, outputDir, specFlag, spec}; + + String[] argsToUse = ArrayUtils.addAll(commonArgs, additionalParameters); + + Cli.CliBuilder builder = + Cli.builder("openapi-generator-cli") + .withCommands(Generate.class); + + Generate generate = (Generate) builder.build().parse(argsToUse); + + generate.configurator = configurator; + generate.generator = generator; + + try { + generate.run(); + } finally { + verify(configurator).setInputSpec(spec); + verify(configurator).setGeneratorName(lang); + verify(configurator).setOutputDir(outputDir); + } + } + + @Test + public void testArtifactVersion() { + final String value = "1.2.3"; + setupAndRunGenericTest("--artifact-version", value); + + verify(configurator).setArtifactVersion(value); + } + + @Test + public void testAuthLong() { + final String auth = "hello:world"; + setupAndRunGenericTest("--auth", auth); + verify(configurator).toClientOptInput(); + verify(configurator).toContext(); + verify(configurator).setAuth(auth); + verifyNoMoreInteractions(configurator); + } + + @Test + public void testAuthShort() { + final String auth = "hello:world"; + setupAndRunGenericTest("-a", auth); + verify(configurator).toClientOptInput(); + verify(configurator).toContext(); + verify(configurator).setAuth(auth); + verifyNoMoreInteractions(configurator); + } + + @Test + public void testAuthUnspecified() { + setupAndRunGenericTest(); + + verify(configurator).toClientOptInput(); + verify(configurator).toContext(); + + verify(configurator, never()).setAuth(anyString()); + verifyNoMoreInteractions(configurator); + } + + @Test + public void testConfigJsonLong() { + setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", true, + "config.json", "--config", "config.json"); + + verify(configurator).toClientOptInput(); + verify(configurator).toContext(); + + verifyNoMoreInteractions(configurator); + } + + @Test + public void testConfigJsonShort() { + setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", true, + "config.json", "-c", "config.json"); + + // on top of those in setupAndRunTest + verify(configurator).toClientOptInput(); + verify(configurator).toContext(); + + verifyNoMoreInteractions(configurator); + } + + @Test + public void testConfigYamlLong() { + setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", true, + "config.yaml", "--config", "config.yaml"); + + verify(configurator).toClientOptInput(); + verify(configurator).toContext(); + + verifyNoMoreInteractions(configurator); + } + + @Test + public void testConfigYamlShort() { + setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", true, + "config.yaml", "-c", "config.yaml"); + + // on top of those in setupAndRunTest + verify(configurator).toClientOptInput(); + verify(configurator).toContext(); + + verifyNoMoreInteractions(configurator); + } + + @Test + public void testGroupId() { + final String value = "io.foo.bar.api"; + setupAndRunGenericTest("--group-id", value); + verify(configurator).setGroupId(value); + } + + @Test + public void testImportMappingsLong() { + setupAndRunGenericTest("--import-mappings", "hello=world,key=,foo=bar,key2"); + + verify(configurator).addImportMapping("hello", "world"); + verify(configurator).addImportMapping("foo", "bar"); + verify(configurator).addImportMapping("key", ""); + verify(configurator).addImportMapping("key2", ""); + } + + @Test + public void testImportMappingsLongMultiple() { + setupAndRunGenericTest("--import-mappings", "hello=world", "--import-mappings", "key=", + "--import-mappings", "foo=bar", "--import-mappings", "key2"); + + verify(configurator).addImportMapping("hello", "world"); + verify(configurator).addImportMapping("foo", "bar"); + verify(configurator).addImportMapping("key", ""); + verify(configurator).addImportMapping("key2", ""); + } + + @Test + public void testInstantiationTypesLong() { + setupAndRunGenericTest("--instantiation-types", "hello=world,key=,foo=bar,key2"); + verify(configurator).addInstantiationType("hello", "world"); + verify(configurator).addInstantiationType("foo", "bar"); + verify(configurator).addInstantiationType("key", ""); + verify(configurator).addInstantiationType("key2", ""); + } + + @Test + public void testInstantiationTypesLongMultiple() { + setupAndRunGenericTest("--instantiation-types", "hello=world", "--instantiation-types", + "key=", "--instantiation-types", "foo=bar", "--instantiation-types", "key2"); + verify(configurator).addInstantiationType("hello", "world"); + verify(configurator).addInstantiationType("foo", "bar"); + verify(configurator).addInstantiationType("key", ""); + verify(configurator).addInstantiationType("key2", ""); + } + + @Test + public void testInvokerPackage() { + final String value = "io.foo.bar.api"; + setupAndRunGenericTest("--invoker-package", value); + verify(configurator).setInvokerPackage(value); + } + + @Test + public void testLanguageSpecificPrimitives() { + setupAndRunGenericTest("--language-specific-primitives", "foo,,bar", + "--language-specific-primitives", "hello,world"); + + verify(configurator).addLanguageSpecificPrimitive("foo"); + verify(configurator).addLanguageSpecificPrimitive("bar"); + verify(configurator).addLanguageSpecificPrimitive("hello"); + verify(configurator).addLanguageSpecificPrimitive("world"); + } + + @Test + public void testLibrary() { + final String value = "feign"; + setupAndRunGenericTest("--library", value); + verify(configurator).setLibrary(value); + } + + @Test + public void testModelPackage() { + final String value = "io.foo.bar.api"; + setupAndRunGenericTest("--model-package", value); + verify(configurator).setModelPackage(value); + } + + @Test + public void testPackageName() { + final String value = "io.foo.bar.baz"; + setupAndRunGenericTest("--package-name", value); + verify(configurator).setPackageName(value); + } + + @Test + public void testRequiredArgs_LongArgs() { + setupAndRunTest("--input-spec", "src/test/resources/swagger.yaml", "--generator-name", "java", "--output", + "src/main/java", false, null); + + // on top of those in setupAndRunTest: + verify(configurator).toClientOptInput(); + verify(configurator).toContext(); + + verifyNoMoreInteractions(configurator); + } + + @Test + public void testRequiredArgs_ShortArgs() { + setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", false, null, "-p", "foo=bar"); + + verify(configurator).addAdditionalProperty("foo", "bar"); + verify(configurator).toClientOptInput(); + verify(configurator).toContext(); + + verifyNoMoreInteractions(configurator); + } + + @Test + public void testSkipOverwriteLong() { + setupAndRunGenericTest("--skip-overwrite"); + verify(configurator).setSkipOverwrite(true); + verify(configurator).toClientOptInput(); + verify(configurator).toContext(); + verifyNoMoreInteractions(configurator); + } + + @Test + public void testSkipOverwriteShort() { + setupAndRunGenericTest("-s"); + verify(configurator).setSkipOverwrite(true); + verify(configurator).toClientOptInput(); + verify(configurator).toContext(); + verifyNoMoreInteractions(configurator); + } + + @Test + public void testStrictSpecFalse() { + setupAndRunGenericTest("--strict-spec", "false"); + verify(configurator).setStrictSpecBehavior(false); + } + + @Test + public void testStrictSpecTrue() { + setupAndRunGenericTest("--strict-spec", "true"); + verify(configurator).setStrictSpecBehavior(true); + } + + @SuppressWarnings("ResultOfMethodCallIgnored") + @Test + public void testTemplateDirLong() { + final String templateDir = "src/main/resources/customTemplates"; + File f = outputDirectory.resolve(templateDir).toFile(); + try { + f.mkdirs(); + setupAndRunGenericTest("--template-dir", f.getAbsolutePath()); + verify(configurator).setTemplateDir(f.getAbsolutePath()); + verify(configurator).toClientOptInput(); + verify(configurator).toContext(); + verifyNoMoreInteractions(configurator); + } finally { + if(!f.delete()) { + System.out.println("Directory didn't delete. You can ignore this."); + } + } + } + + @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Template directory src/main/resources/customTemplates does not exist.") + public void testTemplateDirMustExist() { + final String templateDir = "src/main/resources/customTemplates"; + setupAndRunGenericTest("-t", templateDir); + fail("Expected exception was not thrown."); + } + + @SuppressWarnings("ResultOfMethodCallIgnored") + @Test + public void testTemplateDirShort() { + final String templateDir = "src/main/resources/customTemplates"; + File f = outputDirectory.resolve(templateDir).toFile(); + try { + f.mkdirs(); + setupAndRunGenericTest("-t", f.getAbsolutePath()); + } finally { + verify(configurator).setTemplateDir(f.getAbsolutePath()); + verify(configurator).toClientOptInput(); + verify(configurator).toContext(); + verifyNoMoreInteractions(configurator); + if(!f.delete()) { + System.out.println("Directory didn't delete. You can ignore this."); + } + } + } + + @Test + public void testTypeMappingsLong() { + setupAndRunGenericTest("--type-mappings", "hello=world,key=,foo=bar,key2"); + verify(configurator).addTypeMapping("hello", "world"); + verify(configurator).addTypeMapping("foo", "bar"); + verify(configurator).addTypeMapping("key", ""); + verify(configurator).addTypeMapping("key2", ""); + } + + @Test + public void testTypeMappingsLongMultiple() { + setupAndRunGenericTest("--type-mappings", "hello=world", "--type-mappings", "key=", + "--type-mappings", "foo=bar", "--type-mappings", "key2"); + verify(configurator).addTypeMapping("hello", "world"); + verify(configurator).addTypeMapping("foo", "bar"); + verify(configurator).addTypeMapping("key", ""); + verify(configurator).addTypeMapping("key2", ""); + } + + @Test + public void testVerboseLong() { + setupAndRunGenericTest("--verbose"); + verify(configurator).setVerbose(true); + verify(configurator).toClientOptInput(); + verify(configurator).toContext(); + verifyNoMoreInteractions(configurator); + } + + @Test + public void testVerboseShort() { + setupAndRunGenericTest("-v"); + verify(configurator).setVerbose(true); + verify(configurator).toClientOptInput(); + verify(configurator).toContext(); + verifyNoMoreInteractions(configurator); + } } diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml index 9ab17b45b5..69f0314bb6 100644 --- a/modules/openapi-generator/pom.xml +++ b/modules/openapi-generator/pom.xml @@ -291,12 +291,6 @@ ${reflections-version} test - - org.jmockit - jmockit - - test - com.googlecode.java-diff-utils diffutils @@ -311,7 +305,7 @@ org.mockito mockito-core - 3.2.0 + ${mockito-version} test diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractOptionsTest.java index 89abc085f1..a5929f4af7 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractOptionsTest.java @@ -19,8 +19,8 @@ package org.openapitools.codegen; import com.google.common.base.Function; import com.google.common.collect.Lists; -import mockit.FullVerifications; import org.apache.commons.lang3.StringUtils; +import org.mockito.MockSettings; import org.openapitools.codegen.options.OptionsProvider; import org.testng.Assert; import org.testng.annotations.Test; @@ -29,8 +29,16 @@ import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Set; +import java.util.stream.Collectors; +import static org.mockito.Answers.CALLS_REAL_METHODS; +import static org.mockito.Mockito.withSettings; + +/** + * Base class for applying and processing generator options, then invoking a helper method to verify those options. + */ public abstract class AbstractOptionsTest { + protected MockSettings mockSettings = withSettings().useConstructor().defaultAnswer(CALLS_REAL_METHODS); private final OptionsProvider optionsProvider; protected AbstractOptionsTest(OptionsProvider optionsProvider) { @@ -41,17 +49,13 @@ public abstract class AbstractOptionsTest { @Test public void checkOptionsProcessing() { getCodegenConfig().additionalProperties().putAll(optionsProvider.createOptions()); - setExpectations(); - getCodegenConfig().processOpts(); - - new FullVerifications() {{ - }}; + verifyOptions(); } @Test(description = "check if all options described in documentation are presented in test case") public void checkOptionsHelp() { - final List cliOptions = Lists.transform(getCodegenConfig().cliOptions(), getCliOptionTransformer()); + final List cliOptions = getCodegenConfig().cliOptions().stream().map(getCliOptionTransformer()).collect(Collectors.toList()); final Set testOptions = optionsProvider.createOptions().keySet(); final Set skipped = new HashSet(cliOptions); skipped.removeAll(testOptions); @@ -76,5 +80,5 @@ public abstract class AbstractOptionsTest { protected abstract CodegenConfig getCodegenConfig(); - protected abstract void setExpectations(); + protected abstract void verifyOptions(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/bash/BashClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/bash/BashClientOptionsTest.java index 7fdff8e2fa..1d08eab2be 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/bash/BashClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/bash/BashClientOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.bash; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.BashClientCodegen; import org.openapitools.codegen.options.BashClientOptionsProvider; -public class BashClientOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private BashClientCodegen clientCodegen; +public class BashClientOptionsTest extends AbstractOptionsTest { + private BashClientCodegen clientCodegen = mock(BashClientCodegen.class, mockSettings); public BashClientOptionsTest() { super(new BashClientOptionsProvider()); @@ -40,36 +39,25 @@ public class BashClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setCurlOptions( + protected void verifyOptions() { + verify(clientCodegen).setCurlOptions( BashClientOptionsProvider.CURL_OPTIONS); - times = 1; - clientCodegen.setProcessMarkdown( + verify(clientCodegen).setProcessMarkdown( Boolean.parseBoolean( - BashClientOptionsProvider.PROCESS_MARKDOWN)); - times = 1; - clientCodegen.setScriptName( + BashClientOptionsProvider.PROCESS_MARKDOWN)); + verify(clientCodegen).setScriptName( BashClientOptionsProvider.SCRIPT_NAME); - times = 1; - clientCodegen.setGenerateBashCompletion( + verify(clientCodegen).setGenerateBashCompletion( Boolean.parseBoolean( - BashClientOptionsProvider.GENERATE_BASH_COMPLETION)); - times = 1; - clientCodegen.setGenerateZshCompletion( + BashClientOptionsProvider.GENERATE_BASH_COMPLETION)); + verify(clientCodegen).setGenerateZshCompletion( Boolean.parseBoolean( - BashClientOptionsProvider.GENERATE_ZSH_COMPLETION)); - times = 1; - clientCodegen.setHostEnvironmentVariable( + BashClientOptionsProvider.GENERATE_ZSH_COMPLETION)); + verify(clientCodegen).setHostEnvironmentVariable( BashClientOptionsProvider.HOST_ENVIRONMENT_VARIABLE_NAME); - times = 1; - clientCodegen.setApiKeyAuthEnvironmentVariable( + verify(clientCodegen).setApiKeyAuthEnvironmentVariable( BashClientOptionsProvider.APIKEY_AUTH_ENVIRONMENT_VARIABLE_NAME); - times = 1; - clientCodegen.setAllowUnicodeIdentifiers(Boolean.valueOf(BashClientOptionsProvider.ALLOW_UNICODE_IDENTIFIERS_VALUE)); - times = 1; - - }}; + verify(clientCodegen).setAllowUnicodeIdentifiers(Boolean.valueOf(BashClientOptionsProvider.ALLOW_UNICODE_IDENTIFIERS_VALUE)); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartClientOptionsTest.java index 8cb3ac9642..98bab7f092 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartClientOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.dart; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.DartClientCodegen; import org.openapitools.codegen.options.DartClientOptionsProvider; -public class DartClientOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private DartClientCodegen clientCodegen; +public class DartClientOptionsTest extends AbstractOptionsTest { + private DartClientCodegen clientCodegen = mock(DartClientCodegen.class, mockSettings); public DartClientOptionsTest() { super(new DartClientOptionsProvider()); @@ -40,28 +39,16 @@ public class DartClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(DartClientOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setBrowserClient(Boolean.valueOf(DartClientOptionsProvider.BROWSER_CLIENT_VALUE)); - times = 1; - clientCodegen.setPubName(DartClientOptionsProvider.PUB_NAME_VALUE); - times = 1; - clientCodegen.setPubVersion(DartClientOptionsProvider.PUB_VERSION_VALUE); - times = 1; - clientCodegen.setPubDescription(DartClientOptionsProvider.PUB_DESCRIPTION_VALUE); - times = 1; - clientCodegen.setPubAuthor(DartClientOptionsProvider.PUB_AUTHOR_VALUE); - times = 1; - clientCodegen.setPubAuthorEmail(DartClientOptionsProvider.PUB_AUTHOR_EMAIL_VALUE); - times = 1; - clientCodegen.setPubHomepage(DartClientOptionsProvider.PUB_HOMEPAGE_VALUE); - times = 1; - clientCodegen.setSourceFolder(DartClientOptionsProvider.SOURCE_FOLDER_VALUE); - times = 1; - clientCodegen.setUseEnumExtension(Boolean.valueOf(DartClientOptionsProvider.USE_ENUM_EXTENSION)); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(DartClientOptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setBrowserClient(Boolean.parseBoolean(DartClientOptionsProvider.BROWSER_CLIENT_VALUE)); + verify(clientCodegen).setPubName(DartClientOptionsProvider.PUB_NAME_VALUE); + verify(clientCodegen).setPubVersion(DartClientOptionsProvider.PUB_VERSION_VALUE); + verify(clientCodegen).setPubDescription(DartClientOptionsProvider.PUB_DESCRIPTION_VALUE); + verify(clientCodegen).setPubAuthor(DartClientOptionsProvider.PUB_AUTHOR_VALUE); + verify(clientCodegen).setPubAuthorEmail(DartClientOptionsProvider.PUB_AUTHOR_EMAIL_VALUE); + verify(clientCodegen).setPubHomepage(DartClientOptionsProvider.PUB_HOMEPAGE_VALUE); + verify(clientCodegen).setSourceFolder(DartClientOptionsProvider.SOURCE_FOLDER_VALUE); + verify(clientCodegen).setUseEnumExtension(Boolean.parseBoolean(DartClientOptionsProvider.USE_ENUM_EXTENSION)); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioClientOptionsTest.java index 8ab0fef380..81f707f507 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioClientOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.dartdio; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.DartDioClientCodegen; import org.openapitools.codegen.options.DartDioClientOptionsProvider; -public class DartDioClientOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private DartDioClientCodegen clientCodegen; +public class DartDioClientOptionsTest extends AbstractOptionsTest { + private DartDioClientCodegen clientCodegen = mock(DartDioClientCodegen.class, mockSettings); public DartDioClientOptionsTest() { super(new DartDioClientOptionsProvider()); @@ -40,32 +39,18 @@ public class DartDioClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(DartDioClientOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setBrowserClient(Boolean.valueOf(DartDioClientOptionsProvider.BROWSER_CLIENT_VALUE)); - times = 1; - clientCodegen.setPubName(DartDioClientOptionsProvider.PUB_NAME_VALUE); - times = 1; - clientCodegen.setPubVersion(DartDioClientOptionsProvider.PUB_VERSION_VALUE); - times = 1; - clientCodegen.setPubDescription(DartDioClientOptionsProvider.PUB_DESCRIPTION_VALUE); - times = 1; - //clientCodegen.setPubAuthor(DartDioClientOptionsProvider.PUB_AUTHOR_VALUE); - //times = 1; - //clientCodegen.setPubAuthorEmail(DartDioClientOptionsProvider.PUB_AUTHOR_EMAIL_VALUE); - //times = 1; - //clientCodegen.setPubHomepage(DartDioClientOptionsProvider.PUB_HOMEPAGE_VALUE); - //times = 1; - clientCodegen.setSourceFolder(DartDioClientOptionsProvider.SOURCE_FOLDER_VALUE); - times = 1; - clientCodegen.setUseEnumExtension(Boolean.valueOf(DartDioClientOptionsProvider.USE_ENUM_EXTENSION)); - times = 1; - clientCodegen.setDateLibrary(DartDioClientOptionsProvider.DATE_LIBRARY); - times = 1; - clientCodegen.setNullableFields(Boolean.valueOf(DartDioClientOptionsProvider.NULLABLE_FIELDS)); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(DartDioClientOptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setBrowserClient(Boolean.parseBoolean(DartDioClientOptionsProvider.BROWSER_CLIENT_VALUE)); + verify(clientCodegen).setPubName(DartDioClientOptionsProvider.PUB_NAME_VALUE); + verify(clientCodegen).setPubVersion(DartDioClientOptionsProvider.PUB_VERSION_VALUE); + verify(clientCodegen).setPubDescription(DartDioClientOptionsProvider.PUB_DESCRIPTION_VALUE); + //verify(clientCodegen).setPubAuthor(DartDioClientOptionsProvider.PUB_AUTHOR_VALUE); + //verify(clientCodegen).setPubAuthorEmail(DartDioClientOptionsProvider.PUB_AUTHOR_EMAIL_VALUE); + //verify(clientCodegen).setPubHomepage(DartDioClientOptionsProvider.PUB_HOMEPAGE_VALUE); + verify(clientCodegen).setSourceFolder(DartDioClientOptionsProvider.SOURCE_FOLDER_VALUE); + verify(clientCodegen).setUseEnumExtension(Boolean.parseBoolean(DartDioClientOptionsProvider.USE_ENUM_EXTENSION)); + verify(clientCodegen).setDateLibrary(DartDioClientOptionsProvider.DATE_LIBRARY); + verify(clientCodegen).setNullableFields(Boolean.parseBoolean(DartDioClientOptionsProvider.NULLABLE_FIELDS)); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/elixir/ElixirClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/elixir/ElixirClientOptionsTest.java index e5f9e05475..41fe7cbbbb 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/elixir/ElixirClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/elixir/ElixirClientOptionsTest.java @@ -17,17 +17,17 @@ package org.openapitools.codegen.elixir; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.ElixirClientCodegen; import org.openapitools.codegen.options.ElixirClientOptionsProvider; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + public class ElixirClientOptionsTest extends AbstractOptionsTest { - @Tested - private ElixirClientCodegen clientCodegen; + private ElixirClientCodegen clientCodegen = mock(ElixirClientCodegen.class, mockSettings); public ElixirClientOptionsTest() { super(new ElixirClientOptionsProvider()); @@ -40,10 +40,7 @@ public class ElixirClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setModuleName(ElixirClientOptionsProvider.INVOKER_PACKAGE_VALUE); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setModuleName(ElixirClientOptionsProvider.INVOKER_PACKAGE_VALUE); } } \ No newline at end of file diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java index e132eea705..e6a65d953a 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java @@ -17,17 +17,17 @@ package org.openapitools.codegen.go; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.GoClientCodegen; import org.openapitools.codegen.options.GoClientOptionsProvider; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + public class GoClientOptionsTest extends AbstractOptionsTest { - @Tested - private GoClientCodegen clientCodegen; + private GoClientCodegen clientCodegen = mock(GoClientCodegen.class, mockSettings); public GoClientOptionsTest() { super(new GoClientOptionsProvider()); @@ -40,26 +40,15 @@ public class GoClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setPackageVersion(GoClientOptionsProvider.PACKAGE_VERSION_VALUE); - times = 1; - clientCodegen.setPackageName(GoClientOptionsProvider.PACKAGE_NAME_VALUE); - times = 1; - clientCodegen.setWithGoCodegenComment(GoClientOptionsProvider.WITH_GO_CODEGEN_COMMENT_VALUE); - times = 1; - clientCodegen.setWithXml(GoClientOptionsProvider.WITH_XML_VALUE); - times = 1; - clientCodegen.setWithXml(GoClientOptionsProvider.ENUM_CLASS_PREFIX_VALUE); - times = 1; - clientCodegen.setPrependFormOrBodyParameters(Boolean.valueOf(GoClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); - times = 1; - clientCodegen.setIsGoSubmodule(Boolean.valueOf(GoClientOptionsProvider.IS_GO_SUBMODULE_VALUE)); - times = 1; - clientCodegen.setStructPrefix(Boolean.valueOf(GoClientOptionsProvider.STRUCT_PREFIX_VALUE)); - times = 1; - clientCodegen.setWithAWSV4Signature(Boolean.valueOf(GoClientOptionsProvider.WITH_AWSV4_SIGNATURE)); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setPackageVersion(GoClientOptionsProvider.PACKAGE_VERSION_VALUE); + verify(clientCodegen).setPackageName(GoClientOptionsProvider.PACKAGE_NAME_VALUE); + verify(clientCodegen).setWithGoCodegenComment(GoClientOptionsProvider.WITH_GO_CODEGEN_COMMENT_VALUE); + verify(clientCodegen).setWithXml(GoClientOptionsProvider.WITH_XML_VALUE); + verify(clientCodegen).setWithXml(GoClientOptionsProvider.ENUM_CLASS_PREFIX_VALUE); + verify(clientCodegen).setPrependFormOrBodyParameters(GoClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE); + verify(clientCodegen).setIsGoSubmodule(GoClientOptionsProvider.IS_GO_SUBMODULE_VALUE); + verify(clientCodegen).setStructPrefix(GoClientOptionsProvider.STRUCT_PREFIX_VALUE); + verify(clientCodegen).setWithAWSV4Signature(GoClientOptionsProvider.WITH_AWSV4_SIGNATURE); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/haskellservant/HaskellServantOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/haskellservant/HaskellServantOptionsTest.java index 0ec2b3e59c..769dcbedbd 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/haskellservant/HaskellServantOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/haskellservant/HaskellServantOptionsTest.java @@ -17,18 +17,17 @@ package org.openapitools.codegen.haskellservant; - -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.HaskellServantCodegen; import org.openapitools.codegen.options.HaskellServantOptionsProvider; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + public class HaskellServantOptionsTest extends AbstractOptionsTest { - @Tested - private HaskellServantCodegen clientCodegen; + private HaskellServantCodegen clientCodegen = mock(HaskellServantCodegen.class, mockSettings); public HaskellServantOptionsTest() { super(new HaskellServantOptionsProvider()); @@ -40,14 +39,9 @@ public class HaskellServantOptionsTest extends AbstractOptionsTest { } @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setModelPackage(HaskellServantOptionsProvider.MODEL_PACKAGE_VALUE); - times = 1; - clientCodegen.setApiPackage(HaskellServantOptionsProvider.API_PACKAGE_VALUE); - times = 1; - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(HaskellServantOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setModelPackage(HaskellServantOptionsProvider.MODEL_PACKAGE_VALUE); + verify(clientCodegen).setApiPackage(HaskellServantOptionsProvider.API_PACKAGE_VALUE); + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(HaskellServantOptionsProvider.SORT_PARAMS_VALUE)); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/lumen/PhpLumenServerOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/lumen/PhpLumenServerOptionsTest.java index 4bf8dadc0d..4a79464569 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/lumen/PhpLumenServerOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/lumen/PhpLumenServerOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.lumen; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.PhpLumenServerCodegen; import org.openapitools.codegen.options.PhpLumenServerOptionsProvider; -public class PhpLumenServerOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private PhpLumenServerCodegen clientCodegen; +public class PhpLumenServerOptionsTest extends AbstractOptionsTest { + private PhpLumenServerCodegen clientCodegen = mock(PhpLumenServerCodegen.class, mockSettings); public PhpLumenServerOptionsTest() { super(new PhpLumenServerOptionsProvider()); @@ -40,24 +39,14 @@ public class PhpLumenServerOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(PhpLumenServerOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setParameterNamingConvention(PhpLumenServerOptionsProvider.VARIABLE_NAMING_CONVENTION_VALUE); - clientCodegen.setModelPackage(PhpLumenServerOptionsProvider.MODEL_PACKAGE_VALUE); - times = 1; - clientCodegen.setApiPackage(PhpLumenServerOptionsProvider.API_PACKAGE_VALUE); - times = 1; - times = 1; - clientCodegen.setInvokerPackage(PhpLumenServerOptionsProvider.INVOKER_PACKAGE_VALUE); - times = 1; - clientCodegen.setPackageName(PhpLumenServerOptionsProvider.PACKAGE_NAME_VALUE); - times = 1; - clientCodegen.setSrcBasePath(PhpLumenServerOptionsProvider.SRC_BASE_PATH_VALUE); - times = 1; - clientCodegen.setArtifactVersion(PhpLumenServerOptionsProvider.ARTIFACT_VERSION_VALUE); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(PhpLumenServerOptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setParameterNamingConvention(PhpLumenServerOptionsProvider.VARIABLE_NAMING_CONVENTION_VALUE); + verify(clientCodegen).setModelPackage(PhpLumenServerOptionsProvider.MODEL_PACKAGE_VALUE); + verify(clientCodegen).setApiPackage(PhpLumenServerOptionsProvider.API_PACKAGE_VALUE); + verify(clientCodegen).setInvokerPackage(PhpLumenServerOptionsProvider.INVOKER_PACKAGE_VALUE); + verify(clientCodegen).setPackageName(PhpLumenServerOptionsProvider.PACKAGE_NAME_VALUE); + verify(clientCodegen).setSrcBasePath(PhpLumenServerOptionsProvider.SRC_BASE_PATH_VALUE); + verify(clientCodegen).setArtifactVersion(PhpLumenServerOptionsProvider.ARTIFACT_VERSION_VALUE); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaOptionsTest.java index e81dc3640c..4aa7b8a5b2 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaOptionsTest.java @@ -16,17 +16,16 @@ package org.openapitools.codegen.mysql; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.MysqlSchemaCodegen; import org.openapitools.codegen.options.MysqlSchemaOptionsProvider; -public class MysqlSchemaOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private MysqlSchemaCodegen clientCodegen; +public class MysqlSchemaOptionsTest extends AbstractOptionsTest { + private MysqlSchemaCodegen clientCodegen = mock(MysqlSchemaCodegen.class, mockSettings); public MysqlSchemaOptionsTest() { super(new MysqlSchemaOptionsProvider()); @@ -39,14 +38,9 @@ public class MysqlSchemaOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setDefaultDatabaseName(MysqlSchemaOptionsProvider.DEFAULT_DATABASE_NAME_VALUE); - times = 1; - clientCodegen.setJsonDataTypeEnabled(Boolean.valueOf(MysqlSchemaOptionsProvider.JSON_DATA_TYPE_ENABLED_VALUE)); - times = 1; - clientCodegen.setIdentifierNamingConvention(MysqlSchemaOptionsProvider.IDENTIFIER_NAMING_CONVENTION_VALUE); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setDefaultDatabaseName(MysqlSchemaOptionsProvider.DEFAULT_DATABASE_NAME_VALUE); + verify(clientCodegen).setJsonDataTypeEnabled(Boolean.valueOf(MysqlSchemaOptionsProvider.JSON_DATA_TYPE_ENABLED_VALUE)); + verify(clientCodegen).setIdentifierNamingConvention(MysqlSchemaOptionsProvider.IDENTIFIER_NAMING_CONVENTION_VALUE); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/objc/ObjcClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/objc/ObjcClientOptionsTest.java index 4a8ca1ae54..036891051e 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/objc/ObjcClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/objc/ObjcClientOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.objc; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.ObjcClientCodegen; import org.openapitools.codegen.options.ObjcClientOptionsProvider; -public class ObjcClientOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private ObjcClientCodegen clientCodegen; +public class ObjcClientOptionsTest extends AbstractOptionsTest { + private ObjcClientCodegen clientCodegen = mock(ObjcClientCodegen.class, mockSettings); public ObjcClientOptionsTest() { super(new ObjcClientOptionsProvider()); @@ -40,20 +39,12 @@ public class ObjcClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setClassPrefix(ObjcClientOptionsProvider.CLASS_PREFIX_VALUE); - times = 1; - clientCodegen.setPodName(ObjcClientOptionsProvider.POD_NAME_VALUE); - times = 1; - clientCodegen.setPodVersion(ObjcClientOptionsProvider.POD_VERSION_VALUE); - times = 1; - clientCodegen.setAuthorName(ObjcClientOptionsProvider.AUTHOR_NAME_VALUE); - times = 1; - clientCodegen.setAuthorEmail(ObjcClientOptionsProvider.AUTHOR_EMAIL_VALUE); - times = 1; - clientCodegen.setGitRepoURL(ObjcClientOptionsProvider.GIT_REPO_URL_VALUE); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setClassPrefix(ObjcClientOptionsProvider.CLASS_PREFIX_VALUE); + verify(clientCodegen).setPodName(ObjcClientOptionsProvider.POD_NAME_VALUE); + verify(clientCodegen).setPodVersion(ObjcClientOptionsProvider.POD_VERSION_VALUE); + verify(clientCodegen).setAuthorName(ObjcClientOptionsProvider.AUTHOR_NAME_VALUE); + verify(clientCodegen).setAuthorEmail(ObjcClientOptionsProvider.AUTHOR_EMAIL_VALUE); + verify(clientCodegen).setGitRepoURL(ObjcClientOptionsProvider.GIT_REPO_URL_VALUE); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/ScalaHttpClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/ScalaHttpClientOptionsProvider.java index 7c1bea2a2c..6c41744f23 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/ScalaHttpClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/ScalaHttpClientOptionsProvider.java @@ -29,7 +29,7 @@ public class ScalaHttpClientOptionsProvider implements OptionsProvider { public static final String SORT_PARAMS_VALUE = "false"; public static final String SORT_MODEL_PROPERTIES_VALUE = "false"; public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; - public static final String MODEL_PROPERTY_NAMING = "modelPropertyNaming"; + public static final String MODEL_PROPERTY_NAMING = "PascalCase"; public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true"; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/perl/PerlClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/perl/PerlClientOptionsTest.java index fb34c63515..e3d951301f 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/perl/PerlClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/perl/PerlClientOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.perl; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.PerlClientCodegen; import org.openapitools.codegen.options.PerlClientOptionsProvider; -public class PerlClientOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private PerlClientCodegen clientCodegen; +public class PerlClientOptionsTest extends AbstractOptionsTest { + private PerlClientCodegen clientCodegen = mock(PerlClientCodegen.class, mockSettings); public PerlClientOptionsTest() { super(new PerlClientOptionsProvider()); @@ -40,14 +39,9 @@ public class PerlClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setModuleName(PerlClientOptionsProvider.MODULE_NAME_VALUE); - times = 1; - clientCodegen.setModuleVersion(PerlClientOptionsProvider.MODULE_VERSION_VALUE); - times = 1; - clientCodegen.setPrependFormOrBodyParameters(Boolean.valueOf(PerlClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setModuleName(PerlClientOptionsProvider.MODULE_NAME_VALUE); + verify(clientCodegen).setModuleVersion(PerlClientOptionsProvider.MODULE_VERSION_VALUE); + verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(PerlClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientOptionsTest.java index eea1f9bd33..8479c3441a 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.php; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.PhpClientCodegen; import org.openapitools.codegen.options.PhpClientOptionsProvider; -public class PhpClientOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private PhpClientCodegen clientCodegen; +public class PhpClientOptionsTest extends AbstractOptionsTest { + private PhpClientCodegen clientCodegen = mock(PhpClientCodegen.class, mockSettings); public PhpClientOptionsTest() { super(new PhpClientOptionsProvider()); @@ -40,24 +39,14 @@ public class PhpClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setModelPackage(PhpClientOptionsProvider.MODEL_PACKAGE_VALUE); - times = 1; - clientCodegen.setApiPackage(PhpClientOptionsProvider.API_PACKAGE_VALUE); - times = 1; - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(PhpClientOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setParameterNamingConvention(PhpClientOptionsProvider.VARIABLE_NAMING_CONVENTION_VALUE); - times = 1; - clientCodegen.setInvokerPackage(PhpClientOptionsProvider.INVOKER_PACKAGE_VALUE); - times = 1; - clientCodegen.setPackageName(PhpClientOptionsProvider.PACKAGE_NAME_VALUE); - times = 1; - clientCodegen.setSrcBasePath(PhpClientOptionsProvider.SRC_BASE_PATH_VALUE); - times = 1; - clientCodegen.setArtifactVersion(PhpClientOptionsProvider.ARTIFACT_VERSION_VALUE); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setModelPackage(PhpClientOptionsProvider.MODEL_PACKAGE_VALUE); + verify(clientCodegen).setApiPackage(PhpClientOptionsProvider.API_PACKAGE_VALUE); + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(PhpClientOptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setParameterNamingConvention(PhpClientOptionsProvider.VARIABLE_NAMING_CONVENTION_VALUE); + verify(clientCodegen).setInvokerPackage(PhpClientOptionsProvider.INVOKER_PACKAGE_VALUE); + verify(clientCodegen).setPackageName(PhpClientOptionsProvider.PACKAGE_NAME_VALUE); + verify(clientCodegen).setSrcBasePath(PhpClientOptionsProvider.SRC_BASE_PATH_VALUE); + verify(clientCodegen).setArtifactVersion(PhpClientOptionsProvider.ARTIFACT_VERSION_VALUE); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientOptionsTest.java index 289c7c21e2..e423c6e858 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientOptionsTest.java @@ -17,19 +17,19 @@ package org.openapitools.codegen.python; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.PythonClientCodegen; import org.openapitools.codegen.options.PythonClientOptionsProvider; +import org.testng.Assert; import java.io.File; -public class PythonClientOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private PythonClientCodegen clientCodegen; +public class PythonClientOptionsTest extends AbstractOptionsTest { + private PythonClientCodegen clientCodegen = mock(PythonClientCodegen.class, mockSettings); public PythonClientOptionsTest() { super(new PythonClientOptionsProvider()); @@ -42,26 +42,13 @@ public class PythonClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setPackageName(PythonClientOptionsProvider.PACKAGE_NAME_VALUE); - times = 1; + protected void verifyOptions() { + Assert.assertEquals(clientCodegen.packagePath(), PythonClientOptionsProvider.PACKAGE_NAME_VALUE.replace('.', File.separatorChar)); - clientCodegen.setProjectName(PythonClientOptionsProvider.PROJECT_NAME_VALUE); - times = 1; - - clientCodegen.setPackageVersion(PythonClientOptionsProvider.PACKAGE_VERSION_VALUE); - times = 1; - - clientCodegen.setPackageUrl(PythonClientOptionsProvider.PACKAGE_URL_VALUE); - times = 1; - - clientCodegen.setUseNose(PythonClientOptionsProvider.USE_NOSE_VALUE); - times = 1; - - clientCodegen.packagePath(); - result = PythonClientOptionsProvider.PACKAGE_NAME_VALUE.replace('.', File.separatorChar); - minTimes = 1; - }}; + verify(clientCodegen).setPackageName(PythonClientOptionsProvider.PACKAGE_NAME_VALUE); + verify(clientCodegen).setProjectName(PythonClientOptionsProvider.PROJECT_NAME_VALUE); + verify(clientCodegen).setPackageVersion(PythonClientOptionsProvider.PACKAGE_VERSION_VALUE); + verify(clientCodegen).setPackageUrl(PythonClientOptionsProvider.PACKAGE_URL_VALUE); + verify(clientCodegen).setUseNose(PythonClientOptionsProvider.USE_NOSE_VALUE); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientOptionsTest.java index 3cd888e797..6c338ad66b 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.ruby; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.RubyClientCodegen; import org.openapitools.codegen.options.RubyClientOptionsProvider; -public class RubyClientOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private RubyClientCodegen clientCodegen; +public class RubyClientOptionsTest extends AbstractOptionsTest { + private RubyClientCodegen clientCodegen = mock(RubyClientCodegen.class, mockSettings); public RubyClientOptionsTest() { super(new RubyClientOptionsProvider()); @@ -40,29 +39,16 @@ public class RubyClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setGemName(RubyClientOptionsProvider.GEM_NAME_VALUE); - times = 1; - clientCodegen.setModuleName(RubyClientOptionsProvider.MODULE_NAME_VALUE); - times = 1; - clientCodegen.setGemVersion(RubyClientOptionsProvider.GEM_VERSION_VALUE); - times = 1; - clientCodegen.setGemLicense(RubyClientOptionsProvider.GEM_LICENSE_VALUE); - times = 1; - clientCodegen.setGemRequiredRubyVersion(RubyClientOptionsProvider.GEM_REQUIRED_RUBY_VERSION_VALUE); - times = 1; - clientCodegen.setGemHomepage(RubyClientOptionsProvider.GEM_HOMEPAGE_VALUE); - times = 1; - clientCodegen.setGemDescription(RubyClientOptionsProvider.GEM_DESCRIPTION_VALUE); - times = 1; - clientCodegen.setGemSummary(RubyClientOptionsProvider.GEM_SUMMARY_VALUE); - times = 1; - clientCodegen.setGemAuthor(RubyClientOptionsProvider.GEM_AUTHOR_VALUE); - times = 1; - clientCodegen.setGemAuthorEmail(RubyClientOptionsProvider.GEM_AUTHOR_EMAIL_VALUE); - times = 1; - - }}; + protected void verifyOptions() { + verify(clientCodegen).setGemName(RubyClientOptionsProvider.GEM_NAME_VALUE); + verify(clientCodegen).setModuleName(RubyClientOptionsProvider.MODULE_NAME_VALUE); + verify(clientCodegen).setGemVersion(RubyClientOptionsProvider.GEM_VERSION_VALUE); + verify(clientCodegen).setGemLicense(RubyClientOptionsProvider.GEM_LICENSE_VALUE); + verify(clientCodegen).setGemRequiredRubyVersion(RubyClientOptionsProvider.GEM_REQUIRED_RUBY_VERSION_VALUE); + verify(clientCodegen).setGemHomepage(RubyClientOptionsProvider.GEM_HOMEPAGE_VALUE); + verify(clientCodegen).setGemDescription(RubyClientOptionsProvider.GEM_DESCRIPTION_VALUE); + verify(clientCodegen).setGemSummary(RubyClientOptionsProvider.GEM_SUMMARY_VALUE); + verify(clientCodegen).setGemAuthor(RubyClientOptionsProvider.GEM_AUTHOR_VALUE); + verify(clientCodegen).setGemAuthorEmail(RubyClientOptionsProvider.GEM_AUTHOR_EMAIL_VALUE); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/rubysinatra/RubySinatraServerOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/rubysinatra/RubySinatraServerOptionsTest.java index 7b986935ff..3362338160 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/rubysinatra/RubySinatraServerOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/rubysinatra/RubySinatraServerOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.rubysinatra; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.RubySinatraServerCodegen; import org.openapitools.codegen.options.RubySinatraServerOptionsProvider; -public class RubySinatraServerOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private RubySinatraServerCodegen clientCodegen; +public class RubySinatraServerOptionsTest extends AbstractOptionsTest { + private RubySinatraServerCodegen clientCodegen = mock(RubySinatraServerCodegen.class, mockSettings); public RubySinatraServerOptionsTest() { super(new RubySinatraServerOptionsProvider()); @@ -40,8 +39,7 @@ public class RubySinatraServerOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - }}; + protected void verifyOptions() { + // TODO verify ruby sinatra opts } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/scalaakka/ScalaAkkaClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/scalaakka/ScalaAkkaClientOptionsTest.java index 6a09e808f5..ec56dbc8ce 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/scalaakka/ScalaAkkaClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/scalaakka/ScalaAkkaClientOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.scalaakka; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.ScalaAkkaClientCodegen; import org.openapitools.codegen.options.ScalaAkkaClientOptionsProvider; -public class ScalaAkkaClientOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private ScalaAkkaClientCodegen clientCodegen; +public class ScalaAkkaClientOptionsTest extends AbstractOptionsTest { + private ScalaAkkaClientCodegen clientCodegen = mock(ScalaAkkaClientCodegen.class, mockSettings); public ScalaAkkaClientOptionsTest() { super(new ScalaAkkaClientOptionsProvider()); @@ -40,20 +39,12 @@ public class ScalaAkkaClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setModelPackage(ScalaAkkaClientOptionsProvider.MODEL_PACKAGE_VALUE); - times = 1; - clientCodegen.setApiPackage(ScalaAkkaClientOptionsProvider.API_PACKAGE_VALUE); - times = 1; - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(ScalaAkkaClientOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setSourceFolder(ScalaAkkaClientOptionsProvider.SOURCE_FOLDER_VALUE); - times = 1; - clientCodegen.setPrependFormOrBodyParameters(Boolean.valueOf(ScalaAkkaClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); - times = 1; - clientCodegen.setMainPackage(ScalaAkkaClientOptionsProvider.MAIN_PACKAGE_VALUE); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setModelPackage(ScalaAkkaClientOptionsProvider.MODEL_PACKAGE_VALUE); + verify(clientCodegen).setApiPackage(ScalaAkkaClientOptionsProvider.API_PACKAGE_VALUE); + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(ScalaAkkaClientOptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setSourceFolder(ScalaAkkaClientOptionsProvider.SOURCE_FOLDER_VALUE); + verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(ScalaAkkaClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); + verify(clientCodegen).setMainPackage(ScalaAkkaClientOptionsProvider.MAIN_PACKAGE_VALUE); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/scalahttpclient/ScalaHttpClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/scalahttpclient/ScalaHttpClientOptionsTest.java index d88c112b7b..3f31758c12 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/scalahttpclient/ScalaHttpClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/scalahttpclient/ScalaHttpClientOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.scalahttpclient; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.ScalaHttpClientCodegen; import org.openapitools.codegen.options.ScalaHttpClientOptionsProvider; -public class ScalaHttpClientOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private ScalaHttpClientCodegen clientCodegen; +public class ScalaHttpClientOptionsTest extends AbstractOptionsTest { + private ScalaHttpClientCodegen clientCodegen = mock(ScalaHttpClientCodegen.class, mockSettings); public ScalaHttpClientOptionsTest() { super(new ScalaHttpClientOptionsProvider()); @@ -40,20 +39,12 @@ public class ScalaHttpClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setModelPackage(ScalaHttpClientOptionsProvider.MODEL_PACKAGE_VALUE); - times = 1; - clientCodegen.setApiPackage(ScalaHttpClientOptionsProvider.API_PACKAGE_VALUE); - times = 1; - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(ScalaHttpClientOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setModelPropertyNaming(ScalaHttpClientOptionsProvider.MODEL_PROPERTY_NAMING); - times = 1; - clientCodegen.setSourceFolder(ScalaHttpClientOptionsProvider.SOURCE_FOLDER_VALUE); - times = 1; - clientCodegen.setPrependFormOrBodyParameters(Boolean.valueOf(ScalaHttpClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setModelPackage(ScalaHttpClientOptionsProvider.MODEL_PACKAGE_VALUE); + verify(clientCodegen).setApiPackage(ScalaHttpClientOptionsProvider.API_PACKAGE_VALUE); + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(ScalaHttpClientOptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setModelPropertyNaming(ScalaHttpClientOptionsProvider.MODEL_PROPERTY_NAMING); + verify(clientCodegen).setSourceFolder(ScalaHttpClientOptionsProvider.SOURCE_FOLDER_VALUE); + verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(ScalaHttpClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/silex/PhpSilexServerOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/silex/PhpSilexServerOptionsTest.java index 82ba456f7a..d7dcc1a280 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/silex/PhpSilexServerOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/silex/PhpSilexServerOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.silex; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.PhpSilexServerCodegen; import org.openapitools.codegen.options.PhpSilexServerOptionsProvider; -public class PhpSilexServerOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private PhpSilexServerCodegen clientCodegen; +public class PhpSilexServerOptionsTest extends AbstractOptionsTest { + private PhpSilexServerCodegen clientCodegen = mock(PhpSilexServerCodegen.class, mockSettings); public PhpSilexServerOptionsTest() { super(new PhpSilexServerOptionsProvider()); @@ -40,10 +39,7 @@ public class PhpSilexServerOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(PhpSilexServerOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(PhpSilexServerOptionsProvider.SORT_PARAMS_VALUE)); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/slim/PhpSlimServerOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/slim/PhpSlimServerOptionsTest.java index ccf91c4efa..ad6fb48b27 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/slim/PhpSlimServerOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/slim/PhpSlimServerOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.slim; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.PhpSlimServerCodegen; import org.openapitools.codegen.options.PhpSlimServerOptionsProvider; -public class PhpSlimServerOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private PhpSlimServerCodegen clientCodegen; +public class PhpSlimServerOptionsTest extends AbstractOptionsTest { + private PhpSlimServerCodegen clientCodegen = mock(PhpSlimServerCodegen.class, mockSettings); public PhpSlimServerOptionsTest() { super(new PhpSlimServerOptionsProvider()); @@ -40,24 +39,14 @@ public class PhpSlimServerOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setModelPackage(PhpSlimServerOptionsProvider.MODEL_PACKAGE_VALUE); - times = 1; - clientCodegen.setApiPackage(PhpSlimServerOptionsProvider.API_PACKAGE_VALUE); - times = 1; - clientCodegen.setParameterNamingConvention(PhpSlimServerOptionsProvider.VARIABLE_NAMING_CONVENTION_VALUE); - times = 1; - clientCodegen.setInvokerPackage(PhpSlimServerOptionsProvider.INVOKER_PACKAGE_VALUE); - times = 1; - clientCodegen.setPackageName(PhpSlimServerOptionsProvider.PACKAGE_NAME_VALUE); - times = 1; - clientCodegen.setSrcBasePath(PhpSlimServerOptionsProvider.SRC_BASE_PATH_VALUE); - times = 1; - clientCodegen.setArtifactVersion(PhpSlimServerOptionsProvider.ARTIFACT_VERSION_VALUE); - times = 1; - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(PhpSlimServerOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setModelPackage(PhpSlimServerOptionsProvider.MODEL_PACKAGE_VALUE); + verify(clientCodegen).setApiPackage(PhpSlimServerOptionsProvider.API_PACKAGE_VALUE); + verify(clientCodegen).setParameterNamingConvention(PhpSlimServerOptionsProvider.VARIABLE_NAMING_CONVENTION_VALUE); + verify(clientCodegen).setInvokerPackage(PhpSlimServerOptionsProvider.INVOKER_PACKAGE_VALUE); + verify(clientCodegen).setPackageName(PhpSlimServerOptionsProvider.PACKAGE_NAME_VALUE); + verify(clientCodegen).setSrcBasePath(PhpSlimServerOptionsProvider.SRC_BASE_PATH_VALUE); + verify(clientCodegen).setArtifactVersion(PhpSlimServerOptionsProvider.ARTIFACT_VERSION_VALUE); + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(PhpSlimServerOptionsProvider.SORT_PARAMS_VALUE)); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/slim4/PhpSlim4ServerOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/slim4/PhpSlim4ServerOptionsTest.java index a06f4488b8..499e6bec63 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/slim4/PhpSlim4ServerOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/slim4/PhpSlim4ServerOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.slim4; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.PhpSlim4ServerCodegen; import org.openapitools.codegen.options.PhpSlim4ServerOptionsProvider; -public class PhpSlim4ServerOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private PhpSlim4ServerCodegen clientCodegen; +public class PhpSlim4ServerOptionsTest extends AbstractOptionsTest { + private PhpSlim4ServerCodegen clientCodegen = mock(PhpSlim4ServerCodegen.class, mockSettings); public PhpSlim4ServerOptionsTest() { super(new PhpSlim4ServerOptionsProvider()); @@ -40,27 +39,16 @@ public class PhpSlim4ServerOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setModelPackage(PhpSlim4ServerOptionsProvider.MODEL_PACKAGE_VALUE); - times = 1; - clientCodegen.setApiPackage(PhpSlim4ServerOptionsProvider.API_PACKAGE_VALUE); - times = 1; - clientCodegen.setParameterNamingConvention(PhpSlim4ServerOptionsProvider.VARIABLE_NAMING_CONVENTION_VALUE); - times = 1; - clientCodegen.setInvokerPackage(PhpSlim4ServerOptionsProvider.INVOKER_PACKAGE_VALUE); - times = 1; - clientCodegen.setPackageName(PhpSlim4ServerOptionsProvider.PACKAGE_NAME_VALUE); - times = 1; - clientCodegen.setSrcBasePath(PhpSlim4ServerOptionsProvider.SRC_BASE_PATH_VALUE); - times = 1; - clientCodegen.setArtifactVersion(PhpSlim4ServerOptionsProvider.ARTIFACT_VERSION_VALUE); - times = 1; - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(PhpSlim4ServerOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setPsr7Implementation(PhpSlim4ServerOptionsProvider.PSR7_IMPLEMENTATION_VALUE); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setModelPackage(PhpSlim4ServerOptionsProvider.MODEL_PACKAGE_VALUE); + verify(clientCodegen).setApiPackage(PhpSlim4ServerOptionsProvider.API_PACKAGE_VALUE); + verify(clientCodegen).setParameterNamingConvention(PhpSlim4ServerOptionsProvider.VARIABLE_NAMING_CONVENTION_VALUE); + verify(clientCodegen).setInvokerPackage(PhpSlim4ServerOptionsProvider.INVOKER_PACKAGE_VALUE); + verify(clientCodegen).setPackageName(PhpSlim4ServerOptionsProvider.PACKAGE_NAME_VALUE); + verify(clientCodegen).setSrcBasePath(PhpSlim4ServerOptionsProvider.SRC_BASE_PATH_VALUE); + verify(clientCodegen).setArtifactVersion(PhpSlim4ServerOptionsProvider.ARTIFACT_VERSION_VALUE); + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(PhpSlim4ServerOptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setPsr7Implementation(PhpSlim4ServerOptionsProvider.PSR7_IMPLEMENTATION_VALUE); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift3/Swift3OptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift3/Swift3OptionsTest.java index a4caa6ca8c..9d13950613 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift3/Swift3OptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift3/Swift3OptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.swift3; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.Swift3Codegen; import org.openapitools.codegen.options.Swift3OptionsProvider; -public class Swift3OptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private Swift3Codegen clientCodegen; +public class Swift3OptionsTest extends AbstractOptionsTest { + private Swift3Codegen clientCodegen = mock(Swift3Codegen.class, mockSettings); public Swift3OptionsTest() { super(new Swift3OptionsProvider()); @@ -40,22 +39,13 @@ public class Swift3OptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(Swift3OptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setProjectName(Swift3OptionsProvider.PROJECT_NAME_VALUE); - times = 1; - clientCodegen.setResponseAs(Swift3OptionsProvider.RESPONSE_AS_VALUE.split(",")); - times = 1; - clientCodegen.setUnwrapRequired(Boolean.valueOf(Swift3OptionsProvider.UNWRAP_REQUIRED_VALUE)); - times = 1; - clientCodegen.setObjcCompatible(Boolean.valueOf(Swift3OptionsProvider.OBJC_COMPATIBLE_VALUE)); - times = 1; - clientCodegen.setLenientTypeCast(Boolean.valueOf(Swift3OptionsProvider.LENIENT_TYPE_CAST_VALUE)); - times = 1; - clientCodegen.setPrependFormOrBodyParameters(Boolean.valueOf(Swift3OptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.parseBoolean(Swift3OptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setProjectName(Swift3OptionsProvider.PROJECT_NAME_VALUE); + verify(clientCodegen).setResponseAs(Swift3OptionsProvider.RESPONSE_AS_VALUE.split(",")); + verify(clientCodegen).setUnwrapRequired(Boolean.parseBoolean(Swift3OptionsProvider.UNWRAP_REQUIRED_VALUE)); + verify(clientCodegen).setObjcCompatible(Boolean.parseBoolean(Swift3OptionsProvider.OBJC_COMPATIBLE_VALUE)); + verify(clientCodegen).setLenientTypeCast(Boolean.parseBoolean(Swift3OptionsProvider.LENIENT_TYPE_CAST_VALUE)); + verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.parseBoolean(Swift3OptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4OptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4OptionsTest.java index aa2cfbda8a..dc4aa7d094 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4OptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4OptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.swift4; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.Swift4Codegen; import org.openapitools.codegen.options.Swift4OptionsProvider; -public class Swift4OptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private Swift4Codegen clientCodegen; +public class Swift4OptionsTest extends AbstractOptionsTest { + private Swift4Codegen clientCodegen = mock(Swift4Codegen.class, mockSettings); public Swift4OptionsTest() { super(new Swift4OptionsProvider()); @@ -40,24 +39,14 @@ public class Swift4OptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(Swift4OptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setProjectName(Swift4OptionsProvider.PROJECT_NAME_VALUE); - times = 1; - clientCodegen.setResponseAs(Swift4OptionsProvider.RESPONSE_AS_VALUE.split(",")); - times = 1; - clientCodegen.setNonPublicApi(Boolean.valueOf(Swift4OptionsProvider.NON_PUBLIC_API_REQUIRED_VALUE)); - times = 1; - clientCodegen.setUnwrapRequired(Boolean.valueOf(Swift4OptionsProvider.UNWRAP_REQUIRED_VALUE)); - times = 1; - clientCodegen.setObjcCompatible(Boolean.valueOf(Swift4OptionsProvider.OBJC_COMPATIBLE_VALUE)); - times = 1; - clientCodegen.setLenientTypeCast(Boolean.valueOf(Swift4OptionsProvider.LENIENT_TYPE_CAST_VALUE)); - times = 1; - clientCodegen.setPrependFormOrBodyParameters(Boolean.valueOf(Swift4OptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(Swift4OptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setProjectName(Swift4OptionsProvider.PROJECT_NAME_VALUE); + verify(clientCodegen).setResponseAs(Swift4OptionsProvider.RESPONSE_AS_VALUE.split(",")); + verify(clientCodegen).setNonPublicApi(Boolean.parseBoolean(Swift4OptionsProvider.NON_PUBLIC_API_REQUIRED_VALUE)); + verify(clientCodegen).setUnwrapRequired(Boolean.parseBoolean(Swift4OptionsProvider.UNWRAP_REQUIRED_VALUE)); + verify(clientCodegen).setObjcCompatible(Boolean.parseBoolean(Swift4OptionsProvider.OBJC_COMPATIBLE_VALUE)); + verify(clientCodegen).setLenientTypeCast(Boolean.parseBoolean(Swift4OptionsProvider.LENIENT_TYPE_CAST_VALUE)); + verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(Swift4OptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5OptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5OptionsTest.java index e0ed42441f..3902711776 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5OptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5OptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.swift5; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.Swift5ClientCodegen; import org.openapitools.codegen.options.Swift5OptionsProvider; -public class Swift5OptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private Swift5ClientCodegen clientCodegen; +public class Swift5OptionsTest extends AbstractOptionsTest { + private Swift5ClientCodegen clientCodegen = mock(Swift5ClientCodegen.class, mockSettings); public Swift5OptionsTest() { super(new Swift5OptionsProvider()); @@ -40,22 +39,13 @@ public class Swift5OptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(Swift5OptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setProjectName(Swift5OptionsProvider.PROJECT_NAME_VALUE); - times = 1; - clientCodegen.setResponseAs(Swift5OptionsProvider.RESPONSE_AS_VALUE.split(",")); - times = 1; - clientCodegen.setNonPublicApi(Boolean.valueOf(Swift5OptionsProvider.NON_PUBLIC_API_REQUIRED_VALUE)); - times = 1; - clientCodegen.setObjcCompatible(Boolean.valueOf(Swift5OptionsProvider.OBJC_COMPATIBLE_VALUE)); - times = 1; - clientCodegen.setLenientTypeCast(Boolean.valueOf(Swift5OptionsProvider.LENIENT_TYPE_CAST_VALUE)); - times = 1; - clientCodegen.setPrependFormOrBodyParameters(Boolean.valueOf(Swift5OptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(Swift5OptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setProjectName(Swift5OptionsProvider.PROJECT_NAME_VALUE); + verify(clientCodegen).setResponseAs(Swift5OptionsProvider.RESPONSE_AS_VALUE.split(",")); + verify(clientCodegen).setNonPublicApi(Boolean.parseBoolean(Swift5OptionsProvider.NON_PUBLIC_API_REQUIRED_VALUE)); + verify(clientCodegen).setObjcCompatible(Boolean.parseBoolean(Swift5OptionsProvider.OBJC_COMPATIBLE_VALUE)); + verify(clientCodegen).setLenientTypeCast(Boolean.parseBoolean(Swift5OptionsProvider.LENIENT_TYPE_CAST_VALUE)); + verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(Swift5OptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/aurelia/TypeScriptAureliaClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/aurelia/TypeScriptAureliaClientOptionsTest.java index 24ad1b86d2..c8e6a379ab 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/aurelia/TypeScriptAureliaClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/aurelia/TypeScriptAureliaClientOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.typescript.aurelia; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.TypeScriptAureliaClientCodegen; import org.openapitools.codegen.options.TypeScriptAureliaClientOptionsProvider; -public class TypeScriptAureliaClientOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private TypeScriptAureliaClientCodegen clientCodegen; +public class TypeScriptAureliaClientOptionsTest extends AbstractOptionsTest { + private TypeScriptAureliaClientCodegen clientCodegen = mock(TypeScriptAureliaClientCodegen.class, mockSettings); public TypeScriptAureliaClientOptionsTest() { super(new TypeScriptAureliaClientOptionsProvider()); @@ -40,16 +39,10 @@ public class TypeScriptAureliaClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptAureliaClientOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setModelPropertyNaming(TypeScriptAureliaClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); - times = 1; - clientCodegen.setSupportsES6(TypeScriptAureliaClientOptionsProvider.SUPPORTS_ES6_VALUE); - times = 1; - clientCodegen.setPrependFormOrBodyParameters(Boolean.valueOf(TypeScriptAureliaClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptAureliaClientOptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setModelPropertyNaming(TypeScriptAureliaClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); + verify(clientCodegen).setSupportsES6(TypeScriptAureliaClientOptionsProvider.SUPPORTS_ES6_VALUE); + verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(TypeScriptAureliaClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientOptionsTest.java index 2b79bd0f20..ec63ae29d7 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.typescript.fetch; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.TypeScriptFetchClientCodegen; import org.openapitools.codegen.options.TypeScriptFetchClientOptionsProvider; -public class TypeScriptFetchClientOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private TypeScriptFetchClientCodegen clientCodegen; +public class TypeScriptFetchClientOptionsTest extends AbstractOptionsTest { + private TypeScriptFetchClientCodegen clientCodegen = mock(TypeScriptFetchClientCodegen.class, mockSettings); public TypeScriptFetchClientOptionsTest() { super(new TypeScriptFetchClientOptionsProvider()); @@ -40,18 +39,11 @@ public class TypeScriptFetchClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptFetchClientOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setModelPropertyNaming(TypeScriptFetchClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); - times = 1; - clientCodegen.setSupportsES6(TypeScriptFetchClientOptionsProvider.SUPPORTS_ES6_VALUE); - times = 1; - clientCodegen.setPrependFormOrBodyParameters(Boolean.valueOf(TypeScriptFetchClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); - times = 1; - clientCodegen.setTypescriptThreePlus(Boolean.valueOf(TypeScriptFetchClientOptionsProvider.TYPESCRIPT_THREE_PLUS)); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptFetchClientOptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setModelPropertyNaming(TypeScriptFetchClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); + verify(clientCodegen).setSupportsES6(TypeScriptFetchClientOptionsProvider.SUPPORTS_ES6_VALUE); + verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(TypeScriptFetchClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); + verify(clientCodegen).setTypescriptThreePlus(Boolean.valueOf(TypeScriptFetchClientOptionsProvider.TYPESCRIPT_THREE_PLUS)); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientOptionsTest.java index c36fac78ec..92aa51c846 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.typescript.typescriptangular; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.TypeScriptAngularClientCodegen; import org.openapitools.codegen.options.TypeScriptAngularClientOptionsProvider; -public class TypeScriptAngularClientOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private TypeScriptAngularClientCodegen clientCodegen; +public class TypeScriptAngularClientOptionsTest extends AbstractOptionsTest { + private TypeScriptAngularClientCodegen clientCodegen = mock(TypeScriptAngularClientCodegen.class, mockSettings); public TypeScriptAngularClientOptionsTest() { super(new TypeScriptAngularClientOptionsProvider()); @@ -40,18 +39,11 @@ public class TypeScriptAngularClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setModelPropertyNaming(TypeScriptAngularClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); - times = 1; - clientCodegen.setSupportsES6(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.SUPPORTS_ES6_VALUE)); - times = 1; - clientCodegen.setStringEnums(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.STRING_ENUMS_VALUE)); - times = 1; - clientCodegen.setPrependFormOrBodyParameters(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setModelPropertyNaming(TypeScriptAngularClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); + verify(clientCodegen).setSupportsES6(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.SUPPORTS_ES6_VALUE)); + verify(clientCodegen).setStringEnums(Boolean.parseBoolean(TypeScriptAngularClientOptionsProvider.STRING_ENUMS_VALUE)); + verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangularjs/TypeScriptAngularJsClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangularjs/TypeScriptAngularJsClientOptionsTest.java index cbeb314294..f966d40b21 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangularjs/TypeScriptAngularJsClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangularjs/TypeScriptAngularJsClientOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.typescript.typescriptangularjs; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.TypeScriptAngularJsClientCodegen; import org.openapitools.codegen.options.TypeScriptAngularJsClientOptionsProvider; -public class TypeScriptAngularJsClientOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private TypeScriptAngularJsClientCodegen clientCodegen; +public class TypeScriptAngularJsClientOptionsTest extends AbstractOptionsTest { + private TypeScriptAngularJsClientCodegen clientCodegen = mock(TypeScriptAngularJsClientCodegen.class, mockSettings); public TypeScriptAngularJsClientOptionsTest() { super(new TypeScriptAngularJsClientOptionsProvider()); @@ -40,16 +39,10 @@ public class TypeScriptAngularJsClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptAngularJsClientOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setModelPropertyNaming(TypeScriptAngularJsClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); - times = 1; - clientCodegen.setSupportsES6(Boolean.valueOf(TypeScriptAngularJsClientOptionsProvider.SUPPORTS_ES6_VALUE)); - times = 1; - clientCodegen.setPrependFormOrBodyParameters(Boolean.valueOf(TypeScriptAngularJsClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptAngularJsClientOptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setModelPropertyNaming(TypeScriptAngularJsClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); + verify(clientCodegen).setSupportsES6(Boolean.valueOf(TypeScriptAngularJsClientOptionsProvider.SUPPORTS_ES6_VALUE)); + verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(TypeScriptAngularJsClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypeScriptNodeClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypeScriptNodeClientOptionsTest.java index 6e3dfc0149..bf7e050992 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypeScriptNodeClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypeScriptNodeClientOptionsTest.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.typescript.typescriptnode; -import mockit.Expectations; -import mockit.Tested; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.TypeScriptNodeClientCodegen; import org.openapitools.codegen.options.TypeScriptNodeClientOptionsProvider; -public class TypeScriptNodeClientOptionsTest extends AbstractOptionsTest { +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; - @Tested - private TypeScriptNodeClientCodegen clientCodegen; +public class TypeScriptNodeClientOptionsTest extends AbstractOptionsTest { + private TypeScriptNodeClientCodegen clientCodegen = mock(TypeScriptNodeClientCodegen.class, mockSettings); public TypeScriptNodeClientOptionsTest() { super(new TypeScriptNodeClientOptionsProvider()); @@ -40,16 +39,10 @@ public class TypeScriptNodeClientOptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptNodeClientOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setModelPropertyNaming(TypeScriptNodeClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); - times = 1; - clientCodegen.setSupportsES6(Boolean.valueOf(TypeScriptNodeClientOptionsProvider.SUPPORTS_ES6_VALUE)); - times = 1; - clientCodegen.setPrependFormOrBodyParameters(Boolean.valueOf(TypeScriptNodeClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); - times = 1; - }}; + protected void verifyOptions() { + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptNodeClientOptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setModelPropertyNaming(TypeScriptNodeClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); + verify(clientCodegen).setSupportsES6(Boolean.valueOf(TypeScriptNodeClientOptionsProvider.SUPPORTS_ES6_VALUE)); + verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(TypeScriptNodeClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); } } diff --git a/new.sh b/new.sh index 52e501c477..c3dd7f499b 100755 --- a/new.sh +++ b/new.sh @@ -327,13 +327,11 @@ import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.${lang_classname}; import org.openapitools.codegen.options.${lang_classname}OptionsProvider; -import mockit.Expectations; -import mockit.Tested; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; public class ${lang_classname}OptionsTest extends AbstractOptionsTest { - - @Tested - private ${lang_classname} codegen; + private ${lang_classname} codegen = mock(${lang_classname}.class, mockSettings); public ${lang_classname}OptionsTest() { super(new ${lang_classname}OptionsProvider()); @@ -346,11 +344,9 @@ public class ${lang_classname}OptionsTest extends AbstractOptionsTest { @SuppressWarnings("unused") @Override - protected void setExpectations() { - // TODO: Complete options - new Expectations(codegen) {{ - - }}; + protected void verifyOptions() { + // TODO: Complete options using Mockito + // verify(codegen).someMethod(arguments) } } diff --git a/pom.xml b/pom.xml index 64d0efc5fb..5f3b845c7c 100644 --- a/pom.xml +++ b/pom.xml @@ -160,17 +160,7 @@ none:none org.testng:testng -XX:+StartAttachListener - -javaagent:"${settings.localRepository}/org/jmockit/jmockit/${jmockit-version}/jmockit-${jmockit-version}.jar" - - - - org.jmockit - jmockit - ${jmockit-version} - compile - - maven-dependency-plugin @@ -1382,12 +1372,6 @@ ${testng-version} test - - org.jmockit - jmockit - ${jmockit-version} - test - @@ -1419,7 +1403,7 @@ 4.1.2 6.14.3 3.0.0-M3 - 1.46 0.9.10 + 3.2.0