}
public void testCheckAttributesSorted() {
// see also the corresponding tests in ImmutableUpdateMapTest.
ImmutableStateMap.checkAttributesSorted(Arrays.asList(new Attribute[] {}));
ImmutableStateMap.checkAttributesSorted(Arrays.asList(new Attribute("a", "1")));
ImmutableStateMap.checkAttributesSorted(Arrays.asList(
new Attribute("aa", "1"), new Attribute("ab", "1")));
ImmutableStateMap.checkAttributesSorted(Arrays.asList(
new Attribute("a", "1"), new Attribute("b", "2"), new Attribute("c", "1")));
try {
ImmutableStateMap.checkAttributesSorted(Arrays.asList(
new Attribute("asdfa", "1"), new Attribute("asdfb", "2"), new Attribute("asdfb", "2")));
fail();
} catch (IllegalArgumentException e) {
// ok
}
try {
ImmutableStateMap.checkAttributesSorted(Arrays.asList(
new Attribute("rar", "1"), new Attribute("rar", "2"), new Attribute("rbr", "1")));
fail();
} catch (IllegalArgumentException e) {
// ok
}
try {
ImmutableStateMap.checkAttributesSorted(Arrays.asList(
null, new Attribute("a", "2")));
fail();
} catch (NullPointerException e) {
// ok
}
try {
ImmutableStateMap.checkAttributesSorted(Arrays.asList(
new Attribute("a", "2"), null));
fail();
} catch (NullPointerException e) {
// ok
}
try {
ImmutableStateMap.checkAttributesSorted(Arrays.asList(
new Attribute("a", "1"), new Attribute("a", "1")));
fail();
} catch (IllegalArgumentException e) {
// ok
}
try {
ImmutableStateMap.checkAttributesSorted(Arrays.asList(
new Attribute("a", "1"), null, new Attribute("c", "1")));
fail();
} catch (NullPointerException e) {
// ok
}
try {
ImmutableStateMap.checkAttributesSorted(Arrays.asList(
null, new Attribute("a", "1"), new Attribute("c", "1")));
fail();
} catch (NullPointerException e) {
// ok
}
try {
ImmutableStateMap.checkAttributesSorted(Arrays.asList(
new Attribute("a", "1"), new Attribute("c", "1"), null));
fail();
} catch (NullPointerException e) {
// ok
}
try {
ImmutableStateMap.checkAttributesSorted(Arrays.asList(
new Attribute("a", "1"), new Attribute("a", "1"), null));
fail();
} catch (IllegalArgumentException e) {
// ok
}
try {
ImmutableStateMap.checkAttributesSorted(Arrays.asList(
new Attribute("a", "1"), new Attribute("c", "2"), new Attribute("b", "3")));
fail();
} catch (IllegalArgumentException e) {
// ok
}
}