@Test
public void testGenerateFilter() throws Exception {

  Map<String, String> valueMap = new HashMap<String, String>();
  valueMap.put("version", "[1.2, 2.3]");
  valueMap.put("resulution:", "mandatory");
  valueMap.put("company", "com");
  String filter = ManifestHeaderProcessor.generateFilter("symbolic-name", "com.ibm.foo", valueMap);
  String expected = createExpectedFilter(valueMap, "(&(symbolic-name=com.ibm.foo)", "(company=com)", "(version>=1.2.0)(version<=2.3.0)", "(mandatory:<*company))");
  assertEquals("The filter is wrong.", expected, filter );
  valueMap.clear();
  valueMap.put("version", "(1.2, 2.3]");
  valueMap.put("resulution:", "mandatory");
  valueMap.put("company", "com");
  filter = ManifestHeaderProcessor.generateFilter("symbolic-name", "com.ibm.foo", valueMap);
  expected = createExpectedFilter(valueMap, "(&(symbolic-name=com.ibm.foo)", "(company=com)", "(version>=1.2.0)(version<=2.3.0)(!(version=1.2.0))", "(mandatory:<*company))");
  assertEquals("The filter is wrong.", expected, filter );
  valueMap.clear();
  valueMap.put("version", "(1.2, 2.3)");
  valueMap.put("resulution:", "mandatory");
  valueMap.put("company", "com");
  filter = ManifestHeaderProcessor.generateFilter("symbolic-name", "com.ibm.foo", valueMap);
  expected = createExpectedFilter(valueMap, "(&(symbolic-name=com.ibm.foo)", "(company=com)", "(version>=1.2.0)(version<=2.3.0)(!(version=1.2.0))(!(version=2.3.0))", "(mandatory:<*company))");
  assertEquals("The filter is wrong.", expected, filter );
  valueMap.clear();
  valueMap.put("version", "1.2");
  valueMap.put("resulution:", "mandatory");
  valueMap.put("company", "com");
  filter = ManifestHeaderProcessor.generateFilter("symbolic-name", "com.ibm.foo", valueMap);
  expected = createExpectedFilter(valueMap, "(&(symbolic-name=com.ibm.foo)", "(company=com)", "(version>=1.2.0)", "(mandatory:<*company))");
  assertEquals("The filter is wrong.", expected, filter );
  valueMap.clear();
  valueMap.put("resulution:", "mandatory");
  valueMap.put("company", "com");
  filter = ManifestHeaderProcessor.generateFilter("symbolic-name", "com.ibm.foo", valueMap);
  expected = createExpectedFilter(valueMap, "(&(symbolic-name=com.ibm.foo)", "(company=com)", "", "(mandatory:<*company))");
  assertEquals("The filter is wrong.", expected, filter );
}