PrivilegeDescriptorSupport implements PrivilegeDescriptor<T,Y> { protected static String humanizeName(final String name, final String format) { if (ALL.equals(name)) { if (ALL.equals(format)) { return "all"; } else { return "all '" + format + "'-format"; } } else { return name; } } PrivilegeDescriptorSupport(final String type); @Override String getType(); @Override String toString(); static final String ALL; static final String INVALID_ACTIONS; }
@Test public void humanizeNameTest() throws Exception { assertThat(humanizeName(ALL, ALL), equalTo("all")); assertThat(humanizeName(ALL, "bar"), equalTo("all 'bar'-format")); assertThat(humanizeName("foo", "bar"), equalTo("foo")); }