@Test void deSerializeShouldThrowWhenNameInEntryKeyIsEmpty() { assertThatThrownBy(() -> DTO_JSON_SERIALIZE.aclEntryKeyReads().reads(new JsString(""))) .isInstanceOf(IllegalArgumentException.class); }
@Test void mailboxIdDeserializationShouldThrowWhenInvalid() { assertThatThrownBy(() -> DTO_JSON_SERIALIZE.mailboxIdReads().reads(new JsString("invalid"))) .isInstanceOf(IllegalArgumentException.class); } }
@Test void deSerializeShouldThrowWhenNameInEntryKeyIsNull() { assertThat(DTO_JSON_SERIALIZE.aclEntryKeyReads().reads(JsNull$.MODULE$)) .isInstanceOf(JsError.class); }
@Test void quotaSizeShouldBeWellDeSerializedWhenUnlimited() { assertThat(DTO_JSON_SERIALIZE.quotaSizeReads().reads(JsNull$.MODULE$).get()) .isEqualTo(QuotaSize.unlimited()); }
@Test void quotaCountShouldBeWellDeSerializedWhenUnlimited() { assertThat(DTO_JSON_SERIALIZE.quotaCountReads().reads(JsNull$.MODULE$).get()) .isEqualTo(QuotaCount.unlimited()); }
@Test void eventIdShouldBeWellDeSerialized() { assertThat(DTO_JSON_SERIALIZE.eventIdReads().reads(new JsString(SerializerFixture.SERIALIZED_EVENT_ID)).get()) .isEqualTo(SerializerFixture.EVENT_ID); }
@Test void emptyQuotaRootShouldBeWellDeSerialized() { assertThat(DTO_JSON_SERIALIZE.quotaRootReads().reads(new JsString("")).get()) .isEqualTo(QuotaRoot.quotaRoot("", Optional.empty())); }
@Test void fromJsonShouldDeserializeQuotaSize() { assertThat(DTO_JSON_SERIALIZE.quotaSReads().reads(Json.parse(json)).get().toJava()) .isEqualTo(quota); } }
@Test void mailboxPathDeserializationShouldFailWhenMissingMailboxName() { assertThat(DTO_JSON_SERIALIZE.mailboxPathReads().reads(Json.parse("{" + " \"namespace\":\"#private\"," + " \"user\":\"user\"" + "}"))) .isInstanceOf(JsError.class); }
@Test void mailboxPathDeserializationShouldFailWhenNullMailboxName() { assertThat(DTO_JSON_SERIALIZE.mailboxPathReads().reads(Json.parse("{" + " \"namespace\":\"#private\"," + " \"user\":\"user\"," + " \"name\":null" + "}"))) .isInstanceOf(JsError.class); }
@Test void deserializeShouldThrowWhenUnknownSystemFlag() { assertThatThrownBy(() -> DTOs.Flags$.MODULE$.toJavaFlags( DTO_JSON_SERIALIZE.flagsReads().reads(Json.parse("{\"systemFlags\":[\"unknown\"],\"userFlags\":[]}")) .get())) .isInstanceOf(NoSuchElementException.class); }
@Test void deserializeShouldThrowWhenBadCaseSystemFlag() { assertThatThrownBy(() -> DTOs.Flags$.MODULE$.toJavaFlags( DTO_JSON_SERIALIZE.flagsReads().reads(Json.parse("{\"systemFlags\":[\"AnSwErEd\"],\"userFlags\":[]}")) .get())) .isInstanceOf(NoSuchElementException.class); }
@Test void deserializeShouldThrowWhenSystemFlagContainsNotStringElements() { assertThatThrownBy(() -> DTOs.Flags$.MODULE$.toJavaFlags( DTO_JSON_SERIALIZE.flagsReads().reads(Json.parse("{\"systemFlags\":[42,\"Draft\"],\"userFlags\":[]}")) .get())) .isInstanceOf(NoSuchElementException.class); }
@Test void deserializeShouldThrowWhenNoUserFlags() { assertThatThrownBy(() -> DTOs.Flags$.MODULE$.toJavaFlags( DTO_JSON_SERIALIZE.flagsReads().reads(Json.parse("{\"systemFlags\":[]}")) .get())) .isInstanceOf(NoSuchElementException.class); }
@Test void quotaSizeShouldReturnErrorWhenString() { assertThat(DTO_JSON_SERIALIZE.quotaSizeReads().reads(new JsString("18"))) .isInstanceOf(JsError.class); }
@Test void fromJsonShouldDeserializeQuotaSize() { assertThat(DTO_JSON_SERIALIZE.quotaSReads().reads(Json.parse(json)).get().toJava()) .isEqualTo(quota); } }
@Test void fromJsonShouldDeserializeQuotaSize() { assertThat(DTO_JSON_SERIALIZE.quotaSReads().reads(Json.parse(json)).get().toJava()) .isEqualTo(quota); } }
@Test void fromJsonShouldDeserializeQuotaSize() { assertThat(DTO_JSON_SERIALIZE.quotaSReads().reads(Json.parse(json)).get().toJava()) .isEqualTo(quota); } }
@Test void fromJsonShouldDeserializeQuotaCount() { assertThat(DTO_JSON_SERIALIZE.quotaCReads().reads(Json.parse(json)).get().toJava()) .isEqualTo(quota); } }
@Test void scopesShouldBeString() { assertThat(DTO_JSON_SERIALIZE.quotaScopeReads().reads(Json.parse("3"))) .isInstanceOf(JsError.class); } }