@Test
  public void testFilterWithMultipleFilesAndMultipleLookUps() {

    String expectedLookUp1 = "lookUp1";
    String expectedLookUp2 = "lookUp2";

    ResourceBundle bundle1 =
        PropertyResourceBundle.getBundle("propertyServiceImplTest-withLookUps-1");
    ResourceBundle bundle2 =
        PropertyResourceBundle.getBundle("propertyServiceImplTest-withLookUps-2");

    List<ResourceBundle> bundles = new ArrayList<ResourceBundle>();
    bundles.add(bundle1);
    bundles.add(bundle2);

    PropertyServiceImpl service = new PropertyServiceImpl(new ParenthesesLookUpKeyResolver());

    Set<ClearProperty> properties = service.load(bundles);

    // test with just one lookUp 'lookUp1'
    List<String> lookUps = new ArrayList<String>();
    lookUps.add(expectedLookUp1);
    lookUps.add(expectedLookUp2);

    Collection<ClearProperty> filteredProperties = service.filter(properties, lookUps);

    Assert.assertNotNull(filteredProperties);
    Assert.assertEquals(filteredProperties.size(), 4);

    for (ClearProperty filteredProperty : filteredProperties) {
      String key = filteredProperty.getKey();
      String value = filteredProperty.getValue();
      String lookUp = filteredProperty.getLookUpKey().getLookUp();

      Assert.assertNotNull(filteredProperty.getLookUpKey());
      Assert.assertNotNull(filteredProperty.getValue());
      Assert.assertNotNull(filteredProperty.getKey());
      Assert.assertNotNull(lookUp);

      if (!(key.equals("foo") || key.equals("stux") || key.equals("flix") || key.equals("baz"))) {
        Assert.fail("Key must either be foo, stux, flix, or baz");
      }
      if (!(value.equals("bar")
          || value.equals("flux")
          || value.equals("glux")
          || value.equals("waldo"))) {
        Assert.fail("Key must either be bar, flux, glux, or waldo");
      }
      if (!(lookUp.equals(expectedLookUp1) || lookUp.equals(expectedLookUp2))) {
        Assert.fail("lookUp either be lookUp1 or lookUp2");
      }
    }
  }
  @Test
  public void testLoadMultipleFilesAndNoLookUps() {

    ResourceBundle bundle1 =
        PropertyResourceBundle.getBundle("propertyServiceImplTest-noLookUps-1");
    ResourceBundle bundle2 =
        PropertyResourceBundle.getBundle("propertyServiceImplTest-noLookUps-2");

    List<ResourceBundle> bundles = new ArrayList<ResourceBundle>();
    bundles.add(bundle1);
    bundles.add(bundle2);

    LookUpKeyResolver resolver =
        new LookUpKeyResolver() {
          @Override
          public LookUpKey resolve(String lookUpKey) {
            return new LookUpKey(null, lookUpKey, lookUpKey);
          }
        };

    PropertyServiceImpl service = new PropertyServiceImpl(resolver);

    Set<ClearProperty> properties = service.load(bundles);

    Assert.assertNotNull(properties);
    Assert.assertEquals(properties.size(), 5);

    for (ClearProperty property : properties) {
      String key = property.getKey();
      String value = property.getValue();
      String lookUp = property.getLookUpKey().getLookUp();

      Assert.assertNotNull(property.getLookUpKey());
      Assert.assertNotNull(property.getValue());
      Assert.assertNotNull(property.getKey());
      Assert.assertNull(lookUp);

      if (!(key.equals("foo")
          || key.equals("baz")
          || key.equals("qix")
          || key.equals("stux")
          || key.equals("flix"))) {
        Assert.fail("Key must either be foo, baz, or qix");
      }
      if (!(value.equals("bar")
          || value.equals("waldo")
          || value.equals("qux")
          || value.equals("flux")
          || value.equals("glux"))) {
        Assert.fail("Key must either be bar, waldo, or qux");
      }
    }
  }
  @Test
  public void testLoadOneFileWithLookUps() {

    ResourceBundle bundle1 =
        PropertyResourceBundle.getBundle("propertyServiceImplTest-withLookUps-1");

    List<ResourceBundle> bundles = new ArrayList<ResourceBundle>();
    bundles.add(bundle1);

    // using the parentheses resolver for this unit test
    LookUpKeyResolver resolver = new ParenthesesLookUpKeyResolver();

    PropertyServiceImpl service = new PropertyServiceImpl(resolver);

    Set<ClearProperty> properties = service.load(bundles);

    Assert.assertNotNull(properties);
    Assert.assertEquals(properties.size(), 5);

    for (ClearProperty property : properties) {
      Assert.assertNotNull(property.getLookUpKey());

      String key = property.getKey();
      String value = property.getValue();
      String lookUp = property.getLookUpKey().getLookUp();

      Assert.assertNotNull(key);
      Assert.assertNotNull(value);

      // assert keys
      if (!(key.equals("foo") || key.equals("qix") || key.equals("baz"))) {
        Assert.fail("invalid key set");
      }

      // assert values
      if (!(value.equals("boo")
          || value.equals("bar")
          || value.equals("waldo")
          || value.equals("qux")
          || value.equals("fred"))) {
        Assert.fail("invalid value set");
      }

      // assert lookUps
      if (lookUp != null) {
        if (!(lookUp.equals("lookUp1") || lookUp.equals("lookUp2") || lookUp.equals("lookUp3"))) {
          Assert.fail("LookUp must either be lookUp1, lookUp2, lookUp3");
        }
      }
    }
  }