### Question:
Factory { public static Strategy buildStrategy(String kind, BazelLeafConfig.Decorated config) { switch (kind) { case "java_library": return new PlainBuildStrategy(config); case "android_library": return new AndroidLibraryStrategy(config); case "java_test": case "android_local_test": return new JavaTestStrategy(config); default: LOGGER.warn("Unsupported target kind '{}'. Currently, supporting java_library, java_test and android_library. Fix '{}:{}'", kind, config.targetPath, config.targetName); return new PlainBuildStrategy(config); } } private  Factory(); static Strategy buildStrategy(String kind, BazelLeafConfig.Decorated config);  }### Answer:
@Test public void testJavaLibraryKind() { BazelLeafConfig.Decorated config = new BazelLeafConfig.Decorated( "bazelBin", "targetPath", "targetName", "testTargetName", new File("workspaceDir"), "outputDir" ); Strategy strategy = Factory.buildStrategy("java_library", config); assertThat(strategy, Matchers.instanceOf(PlainBuildStrategy.class)); }
@Test public void testAndroidLibraryKind() { BazelLeafConfig.Decorated config = new BazelLeafConfig.Decorated( "bazelBin", "targetPath", "targetName", "testTargetName", new File("workspaceDir"), "outputDir" ); Strategy strategy = Factory.buildStrategy("android_library", config); assertThat(strategy, Matchers.instanceOf(AndroidLibraryStrategy.class)); }
@Test public void testTestKind() { BazelLeafConfig.Decorated config = new BazelLeafConfig.Decorated( "bazelBin", "targetPath", "targetName", "testTargetName", new File("workspaceDir"), "outputDir" ); Strategy strategy = Factory.buildStrategy("android_local_test", config); assertThat(strategy, Matchers.instanceOf(JavaTestStrategy.class)); strategy = Factory.buildStrategy("java_test", config); assertThat(strategy, Matchers.instanceOf(JavaTestStrategy.class)); }
@Test public void testInvalidKind() { BazelLeafConfig.Decorated config = new BazelLeafConfig.Decorated( "bazelBin", "targetPath", "targetName", "testTargetName", new File("workspaceDir"), "outputDir" ); Strategy strategy = Factory.buildStrategy("UnknownKind", config); assertThat(strategy, Matchers.instanceOf(PlainBuildStrategy.class)); }