@Test
public void testReplaceAclEntriesUnchanged() throws AclException {

  List<AclEntry> existing = new ImmutableList.Builder<AclEntry>()
    .add(aclEntry(ACCESS, USER, ALL))
    .add(aclEntry(ACCESS, USER, "bruce", ALL))
    .add(aclEntry(ACCESS, GROUP, READ_EXECUTE))
    .add(aclEntry(ACCESS, GROUP, "sales", ALL))
    .add(aclEntry(ACCESS, MASK, ALL))
    .add(aclEntry(ACCESS, OTHER, NONE))
    .add(aclEntry(DEFAULT, USER, ALL))
    .add(aclEntry(DEFAULT, USER, "bruce", ALL))
    .add(aclEntry(DEFAULT, GROUP, READ_EXECUTE))
    .add(aclEntry(DEFAULT, GROUP, "sales", ALL))
    .add(aclEntry(DEFAULT, MASK, ALL))
    .add(aclEntry(DEFAULT, OTHER, NONE))
    .build();
  List<AclEntry> aclSpec = Lists.newArrayList(
    aclEntry(ACCESS, USER, ALL),
    aclEntry(ACCESS, USER, "bruce", ALL),
    aclEntry(ACCESS, GROUP, READ_EXECUTE),
    aclEntry(ACCESS, GROUP, "sales", ALL),
    aclEntry(ACCESS, MASK, ALL),
    aclEntry(ACCESS, OTHER, NONE),
    aclEntry(DEFAULT, USER, ALL),
    aclEntry(DEFAULT, USER, "bruce", ALL),
    aclEntry(DEFAULT, GROUP, READ_EXECUTE),
    aclEntry(DEFAULT, GROUP, "sales", ALL),
    aclEntry(DEFAULT, MASK, ALL),
    aclEntry(DEFAULT, OTHER, NONE));
  assertEquals(existing, replaceAclEntries(existing, aclSpec));
}