Java Code Examples for com.google.common.collect.testing.Helpers

The following examples show how to use com.google.common.collect.testing.Helpers. These examples are extracted from open source projects.
Example 1
Project: openapi-generator   File: KotlinSpringServerCodegenTest.java    License: Apache License 2.0 6 votes vote down vote up
@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")
    );
}
 
Example 2
Project: caffeine   File: MapTestFactory.java    License: Apache License 2.0 5 votes vote down vote up
@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));
}