### Question:
MpscRingBufferWriter implements RingBufferWriter { public int capacity() { return capacity; } MpscRingBufferWriter(final AtomicBuffer buffer); int capacity(); boolean write(final int typeId, final AtomicBuffer buffer, final int offset, final int length);  }### Answer:
@Test public void shouldReturnCorrectCapacity() { assertThat(writer.capacity(), is(CAPACITY)); }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionWhenCapacityNotPowerOfTwo() { when(buffer.capacity()).thenReturn(CAPACITY - 1 + MpscRingBuffer.STATE_TRAILER_SIZE); new MpscRingBufferWriter(buffer); }