@Override public void configure(ImapConfiguration imapConfiguration) { super.configure(imapConfiguration); disabledCaps.addAll(imapConfiguration.getDisabledCaps()); if (shouldDisableCondstore(imapConfiguration)) { disabledCaps.add(SUPPORTS_CONDSTORE); } }
@Override public final boolean equals(Object obj) { if (obj instanceof ImapConfiguration) { ImapConfiguration that = (ImapConfiguration)obj; return Objects.equal(that.isEnableIdle(), enableIdle) && Objects.equal(that.getIdleTimeInterval(), idleTimeInterval) && Objects.equal(that.getIdleTimeIntervalUnit(), idleTimeIntervalUnit) && Objects.equal(that.getDisabledCaps(), disabledCaps) && Objects.equal(that.isCondstoreEnable(), isCondstoreEnable); } return false; }
@Test public void disabledCapsShouldBeEmptyAsDefault() { ImapConfiguration imapConfiguration = ImapConfiguration.builder() .build(); assertThat(imapConfiguration.getDisabledCaps()).isEmpty(); }
@Test public void disabledCapsShouldReturnSetValue() { ImapConfiguration imapConfiguration = ImapConfiguration.builder() .disabledCaps(ImmutableSet.of("AnyValue")) .build(); assertThat(imapConfiguration.getDisabledCaps()).containsExactly("AnyValue"); }
@Test public void disabledCapsShouldReturnMultipleSetValues() { ImapConfiguration imapConfiguration = ImapConfiguration.builder() .disabledCaps(ImmutableSet.of("AnyValue", "OtherValue")) .build(); assertThat(imapConfiguration.getDisabledCaps()).containsExactly("AnyValue", "OtherValue"); }
@Test public void disabledCapsShouldReturnMultipleSetValuesWithNormalizeValue() { ImapConfiguration imapConfiguration = ImapConfiguration.builder() .disabledCaps(ImmutableSet.of(" AnyValue ", " OtherValue ")) .build(); assertThat(imapConfiguration.getDisabledCaps()).containsExactly("AnyValue", "OtherValue"); }
@Test public void disabledCapShouldReturnMultipleStringWithNormalizeValue() { ImapConfiguration imapConfiguration = ImapConfiguration.builder() .disabledCap(" AnyValue ") .build(); assertThat(imapConfiguration.getDisabledCaps()).containsExactly("AnyValue"); }
@Test public void disabledCapsFromStringArrayShouldReturnMultipleSetValuesWithNormalizeValue() { ImapConfiguration imapConfiguration = ImapConfiguration.builder() .disabledCaps(" AnyValue ", " OtherValue ") .build(); assertThat(imapConfiguration.getDisabledCaps()).containsExactly("AnyValue", "OtherValue"); }