MailboxACLJsonConverter { public static String toJson(MailboxACL acl) throws JsonProcessingException { return objectMapper.writeValueAsString(acl); }  static String toJson(MailboxACL acl); static MailboxACL toACL(String jsonACLString);  }
@Test void emptyACLShouldBeWellSerialized() throws Exception { assertThatJson(MailboxACLJsonConverter.toJson(MailboxACL.EMPTY)) .when(Option.IGNORING_ARRAY_ORDER) .isEqualTo("{\"entries\":{}}"); }
@Test void singleUserEntryACLShouldBeWellSerialized() throws Exception { assertThatJson(MailboxACLJsonConverter.toJson(new ACLMapBuilder().addSingleUserEntryToMap().buildAsACL())) .when(Option.IGNORING_ARRAY_ORDER) .isEqualTo("{\"entries\":{\"-user\":\"klprstwx\"}}"); }
@Test void singleGroupEntryACLShouldBeWellSerialized() throws Exception { assertThatJson(MailboxACLJsonConverter.toJson(new ACLMapBuilder().addSingleGroupEntryToMap().buildAsACL())) .when(Option.IGNORING_ARRAY_ORDER) .isEqualTo("{\"entries\":{\"-$group\":\"lprstwx\"}}"); }
@Test void singleSpecialEntryACLShouldBeWellSerialized() throws Exception { assertThatJson(MailboxACLJsonConverter.toJson(new ACLMapBuilder().addSingleSpecialEntryToMap().buildAsACL())) .when(Option.IGNORING_ARRAY_ORDER) .isEqualTo("{\"entries\":{\"-special\":\"lpstwx\"}}"); }
@Test void multipleEntriesACLShouldBeWellSerialized() throws Exception { assertThatJson(MailboxACLJsonConverter.toJson(new ACLMapBuilder().addSingleUserEntryToMap().addSingleGroupEntryToMap().buildAsACL())) .when(Option.IGNORING_ARRAY_ORDER) .isEqualTo("{\"entries\":{\"-user\":\"klprstwx\",\"-$group\":\"lprstwx\"}}"); }