@Test public void addUidShouldLeadToMonoticMSNToUIDConversionWhenInsertInFirstPosition() { testee.addUid(messageUid2); testee.addUid(messageUid3); testee.addUid(messageUid4); testee.addUid(messageUid1); assertThat(mapTesteeInternalDataToMsnByUid().entrySet()) .containsExactlyElementsOf(ImmutableMap.of( 1, messageUid1, 2, messageUid2, 3, messageUid3, 4, messageUid4).entrySet()); }
public synchronized void addUid(MessageUid uid) { if (uids.contains(uid)) { return; } if (isLastUid(uid)) { uids.add(uid); } else { uids.add(uid); Collections.sort(uids); } }
UidMsnConverter { public synchronized void addUid(MessageUid uid) { if (uids.contains(uid)) { return; } if (isLastUid(uid)) { uids.add(uid); } else { uids.add(uid); Collections.sort(uids); } } }
UidMsnConverter { public synchronized void addUid(MessageUid uid) { if (uids.contains(uid)) { return; } if (isLastUid(uid)) { uids.add(uid); } else { uids.add(uid); Collections.sort(uids); } } UidMsnConverter(); }
UidMsnConverter { public synchronized void addUid(MessageUid uid) { if (uids.contains(uid)) { return; } if (isLastUid(uid)) { uids.add(uid); } else { uids.add(uid); Collections.sort(uids); } } UidMsnConverter(); synchronized void addAll(List<MessageUid> addedUids); synchronized NullableMessageSequenceNumber getMsn(MessageUid uid); synchronized Optional<MessageUid> getUid(int msn); synchronized Optional<MessageUid> getLastUid(); synchronized Optional<MessageUid> getFirstUid(); synchronized int getNumMessage(); synchronized void remove(MessageUid uid); synchronized boolean isEmpty(); synchronized void clear(); synchronized void addUid(MessageUid uid); }
UidMsnConverter { public synchronized void addUid(MessageUid uid) { if (uids.contains(uid)) { return; } if (isLastUid(uid)) { uids.add(uid); } else { uids.add(uid); Collections.sort(uids); } } UidMsnConverter(); synchronized void addAll(List<MessageUid> addedUids); synchronized NullableMessageSequenceNumber getMsn(MessageUid uid); synchronized Optional<MessageUid> getUid(int msn); synchronized Optional<MessageUid> getLastUid(); synchronized Optional<MessageUid> getFirstUid(); synchronized int getNumMessage(); synchronized void remove(MessageUid uid); synchronized boolean isEmpty(); synchronized void clear(); synchronized void addUid(MessageUid uid); static final int FIRST_MSN; }