SetMailboxesUpdateProcessor implements SetMailboxesProcessor { @VisibleForTesting <T> boolean requestChanged(Optional<T> requestValue, Optional<T> storeValue) { return requestValue.isPresent() && !requestValue.equals(storeValue); } @Inject @VisibleForTesting  SetMailboxesUpdateProcessor(MailboxUtils mailboxUtils, MailboxManager mailboxManager, MailboxFactory mailboxFactory, MetricFactory metricFactory); @Override SetMailboxesResponse process(SetMailboxesRequest request, MailboxSession mailboxSession);  }
@Test public void requestChangedShouldReturnFalseWhenRequestValueAndStoreValueAreEmpty() throws Exception { assertThat(sut.requestChanged(Optional.<String>empty(), Optional.empty())).isFalse(); }
@Test public void requestChangedShouldReturnFalseWhenEmptyRequestMeansNoChanging() throws Exception { assertThat(sut.requestChanged(Optional.empty(), Optional.of("any"))).isFalse(); }
@Test public void requestChangedShouldReturnTrueWhenEmptyStoreValue() throws Exception { assertThat(sut.requestChanged(Optional.of("any"), Optional.empty())).isTrue(); }
@Test public void requestChangedShouldReturnTrueWhenRequestValueAndStoreValueAreNotTheSame() throws Exception { assertThat(sut.requestChanged(Optional.of("any"), Optional.of("other"))).isTrue(); }
@Test public void requestChangedShouldReturnFalseWhenRequestValueAndStoreValueAreTheSame() throws Exception { assertThat(sut.requestChanged(Optional.of("any"), Optional.of("any"))).isFalse(); }