@Test
  public void appendErrorCasesTest() throws IOException, StoreException {
    Log log = new Log(tempDir.getAbsolutePath(), LOG_CAPACITY, StoreTestUtils.DEFAULT_DISK_SPACE_ALLOCATOR,
        createStoreConfig(SEGMENT_CAPACITY, setFilePermissionEnabled), metrics, null);
    try {
      // write exceeds size of a single segment.
      ByteBuffer buffer =
          ByteBuffer.wrap(TestUtils.getRandomBytes((int) (SEGMENT_CAPACITY + 1 - LogSegment.HEADER_SIZE)));
      try {
        log.appendFrom(buffer);
        fail("Cannot append a write of size greater than log segment size");
      } catch (IllegalArgumentException e) {
        assertEquals("Position of buffer has changed", 0, buffer.position());
      }

      try {
        log.appendFrom(Channels.newChannel(new ByteBufferInputStream(buffer)), buffer.remaining());
        fail("Cannot append a write of size greater than log segment size");
      } catch (IllegalArgumentException e) {
        assertEquals("Position of buffer has changed", 0, buffer.position());
      }
    } finally {
      log.close(false);
      cleanDirectory(tempDir);
    }
  }
Tests cases where bad arguments are provided to the append operations.
@throws IOException
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/LogTest.java