下面列出了怎么用com.google.common.collect.testing.Helpers的API类实例代码及写法,或者点击链接到github查看源代码。
@Test(description = "test delegate with tags")
public void delegateWithTags() throws Exception {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); //may be move to /build
KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen();
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(KotlinSpringServerCodegen.DELEGATE_PATTERN, true);
codegen.additionalProperties().put(KotlinSpringServerCodegen.USE_TAGS, true);
List<File> files = new DefaultGenerator()
.opts(
new ClientOptInput()
.openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue5497-use-tags-kotlin.yaml"))
.config(codegen)
)
.generate();
Helpers.assertContainsAllOf(files,
new File(output, "src/main/kotlin/org/openapitools/api/TestV1ApiController.kt"),
new File(output, "src/main/kotlin/org/openapitools/api/TestV1ApiDelegate.kt"),
new File(output, "src/main/kotlin/org/openapitools/api/TestV2ApiController.kt"),
new File(output, "src/main/kotlin/org/openapitools/api/TestV2ApiDelegate.kt")
);
}
@Override
public SampleElements<Map.Entry<String, CompletableFuture<String>>> samples() {
return new SampleElements<>(
Helpers.mapEntry("one", JAN),
Helpers.mapEntry("two", FEB),
Helpers.mapEntry("three", MARCH),
Helpers.mapEntry("four", APRIL),
Helpers.mapEntry("five", MAY));
}