assertFalse(test.isValid());
assertTrue(test.getValidation().contains("Context section: project: expected 'String', saw"));
final HashSet<Attribute> env = new HashSet<Attribute>();
assertFalse(test.matches(env));
env.add(new Attribute(new URI("test://project"), "abc"));
assertFalse(test.matches(env));
env.add(new Attribute(new URI("test://application"), "bloo"));
assertFalse(test.matches(env));
}
{
final Map context=new HashMap();
//key is not a string
context.put(new HashMap(), "monkey");
final YamlPolicy.YamlEnvironmentalContext test = new YamlPolicy.YamlEnvironmentalContext(
"test://", context);
assertFalse(test.isValid());
assertTrue(test.getValidation().contains("Context section key expected 'String', saw"));
final HashSet<Attribute> env = new HashSet<Attribute>();
assertFalse(test.matches(env));
env.add(new Attribute(new URI("test://project"), "abc"));
assertFalse(test.matches(env));
env.add(new Attribute(new URI("test://application"), "bloo"));
assertFalse(test.matches(env));
}
{
final Map context = new HashMap();
//key is not a valid URI component
context.put(" project", "monkey");
final YamlPolicy.YamlEnvironmentalContext test = new YamlPolicy.YamlEnvironmentalContext(
"test://", context);
assertFalse(test.isValid());
assertTrue(test.getValidation().contains("invalid URI"));
final HashSet<Attribute> env = new HashSet<Attribute>();
assertFalse(test.matches(env));
env.add(new Attribute(new URI("test://project"), "abc"));
assertFalse(test.matches(env));
env.add(new Attribute(new URI("test://application"), "bloo"));
assertFalse(test.matches(env));
}
}