// Path: provider/src/main/java/com/cloudera/director/aws/common/ResourceBundleLocalizationContext.java
// public static class ResourceBundleLocalizationContextFactory implements Factory {
// 
//   /**
//    * The resource bundle resolver.
//    */
//   private final ResourceBundleResolver resourceBundleResolver;
// 
//   /**
//    * Creates a resource bundle localization context factory with the specified parameters.
//    *
//    * @param resourceBundleResolver the resource bundle resolver
//    */
//   public ResourceBundleLocalizationContextFactory(ResourceBundleResolver resourceBundleResolver) {
//     this.resourceBundleResolver = resourceBundleResolver;
//   }
// 
//   @Override
//   public LocalizationContext createRootLocalizationContext(Locale locale) {
//     return new ResourceBundleLocalizationContext(
//         locale, "", resourceBundleResolver.getBundle(BUNDLE_BASE_NAME, locale));
//   }
// }
// 
// Path: provider/src/main/java/com/cloudera/director/aws/common/ResourceBundleLocalizationContext.java
// public interface ResourceBundleResolver {
// 
//   /**
//    * The default resource bundle resolver.
//    */
//   ResourceBundleResolver DEFAULT = (baseName, locale) -> {
//     try {
//       return ResourceBundle.getBundle("com.cloudera.director.aws." + baseName, locale);
//     } catch (MissingResourceException e) {
//       LOG.warn("Could not load resource bundle '{}' for locale {}", baseName, locale);
//       return null;
//     }
//   };
// 
//   /**
//    * Returns the specified resource bundle for the specified locale, or {@code null} if there
//    * is no such resource bundle.
//    *
//    * @param baseName the base name of the resource bundle
//    * @param locale   the locale
//    * @return the specified resource bundle for the specified locale, or {@code null} if there
//    * is no such resource bundle
//    */
//   ResourceBundle getBundle(String baseName, Locale locale);
// }


import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import com.cloudera.director.aws.common.ResourceBundleLocalizationContext.ResourceBundleLocalizationContextFactory;
import com.cloudera.director.aws.common.ResourceBundleLocalizationContext.ResourceBundleResolver;
import com.cloudera.director.spi.v2.model.LocalizationContext;
import com.google.common.collect.Maps;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
// (c) Copyright 2015 Cloudera, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.cloudera.director.aws.common;





/**
 * Tests ResourceBundleLocalizationContext.
 */
public class ResourceBundleLocalizationContextTest {

  @Test
  public void testWithResourceBundle() {
    MockStringResourceBundle resourceBundle = new MockStringResourceBundle();
    resourceBundle.put("x", "x-ray");
    resourceBundle.put("x.y", "xylophone");
    resourceBundle.put("x.y.z", "eggzaktly");
    ResourceBundleLocalizationContext localizationContext =
// Path: provider/src/main/java/com/cloudera/director/aws/common/ResourceBundleLocalizationContext.java
// public static class ResourceBundleLocalizationContextFactory implements Factory {
// 
//   /**
//    * The resource bundle resolver.
//    */
//   private final ResourceBundleResolver resourceBundleResolver;
// 
//   /**
//    * Creates a resource bundle localization context factory with the specified parameters.
//    *
//    * @param resourceBundleResolver the resource bundle resolver
//    */
//   public ResourceBundleLocalizationContextFactory(ResourceBundleResolver resourceBundleResolver) {
//     this.resourceBundleResolver = resourceBundleResolver;
//   }
// 
//   @Override
//   public LocalizationContext createRootLocalizationContext(Locale locale) {
//     return new ResourceBundleLocalizationContext(
//         locale, "", resourceBundleResolver.getBundle(BUNDLE_BASE_NAME, locale));
//   }
// }
// 
// Path: provider/src/main/java/com/cloudera/director/aws/common/ResourceBundleLocalizationContext.java
// public interface ResourceBundleResolver {
// 
//   /**
//    * The default resource bundle resolver.
//    */
//   ResourceBundleResolver DEFAULT = (baseName, locale) -> {
//     try {
//       return ResourceBundle.getBundle("com.cloudera.director.aws." + baseName, locale);
//     } catch (MissingResourceException e) {
//       LOG.warn("Could not load resource bundle '{}' for locale {}", baseName, locale);
//       return null;
//     }
//   };
// 
//   /**
//    * Returns the specified resource bundle for the specified locale, or {@code null} if there
//    * is no such resource bundle.
//    *
//    * @param baseName the base name of the resource bundle
//    * @param locale   the locale
//    * @return the specified resource bundle for the specified locale, or {@code null} if there
//    * is no such resource bundle
//    */
//   ResourceBundle getBundle(String baseName, Locale locale);
// }


// Path: tests/src/test/java/com/cloudera/director/aws/common/ResourceBundleLocalizationContextTest.java
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import com.cloudera.director.aws.common.ResourceBundleLocalizationContext.ResourceBundleLocalizationContextFactory;
import com.cloudera.director.aws.common.ResourceBundleLocalizationContext.ResourceBundleResolver;
import com.cloudera.director.spi.v2.model.LocalizationContext;
import com.google.common.collect.Maps;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;

// (c) Copyright 2015 Cloudera, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.cloudera.director.aws.common;





/**
 * Tests ResourceBundleLocalizationContext.
 */
public class ResourceBundleLocalizationContextTest {

  @Test
  public void testWithResourceBundle() {
    MockStringResourceBundle resourceBundle = new MockStringResourceBundle();
    resourceBundle.put("x", "x-ray");
    resourceBundle.put("x.y", "xylophone");
    resourceBundle.put("x.y.z", "eggzaktly");
    ResourceBundleLocalizationContext localizationContext =
        new ResourceBundleLocalizationContext(Locale.getDefault(), "x", resourceBundle);