@Test
  public void putErrorCasesTest() throws StoreException {
    // ID that exists
    StoreKey storeKey = store.index.journal.getAllEntries().get(2).getKey();
    MockId mockId = new MockId(storeKey.getID(), Utils.getRandomShort(TestUtils.RANDOM), Utils.getRandomShort(TestUtils.RANDOM));
    for (JournalEntry journalEntry : store.index.journal.getAllEntries()) {
      StoreKey storeKeyFromJournal = journalEntry.getKey();
      Offset offset = journalEntry.getOffset();
      store.index.journal.removeSpecificValueInJournal(offset);
      store.index.journal.addEntry(offset, storeKeyFromJournal, random.nextLong());
    }
    verifyPutFailure(mockId, StoreErrorCodes.AlreadyExist);

    // duplicates
    MockId id = getUniqueId();
    long crc = random.nextLong();
    MessageInfo info =
        new MessageInfo(id, PUT_RECORD_SIZE, false, false, false, expiresAtMs, crc, id.getAccountId(), id.getContainerId(),
            Utils.Infinite_Time, (short) 0);
    MessageWriteSet writeSet = new MockMessageWriteSet(Arrays.asList(info, info),
        Arrays.asList(ByteBuffer.allocate(1), ByteBuffer.allocate(1)));
    try {
      store.put(writeSet);
      fail("Store PUT should have failed");
    } catch (IllegalArgumentException e) {
      // expected. Nothing to do.
    }
  }
Tests error cases for {@link BlobStore#put(MessageWriteSet)}.
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/BlobStoreTest.java