Refine search
@Theory public void shouldGetCapacity(final AtomicBuffer buffer) { assertThat(buffer.capacity(), is(BUFFER_CAPACITY)); }
@Theory public void shouldGetSizeWhenEmpty(final Fixture fixture) { final Queue<Integer> queue = fixture.newInstance(); assertThat(queue.size(), is(0)); }
@Theory public void shouldAddAndRemoveFromEmptyQueue(final Fixture fixture) { final Queue<Integer> queue = fixture.newInstance(); final Integer testValue = 7; final boolean success = queue.add(testValue); assertTrue(success); assertThat(queue.size(), is(1)); final Integer removedValue = queue.remove(); assertThat(removedValue, is(testValue)); assertThat(queue.size(), is(0)); }
@Theory public void shouldGetAndSetIntToNativeBuffer(final AtomicBuffer buffer) { final ByteBuffer duplicateBuffer = byteBuffer(buffer); duplicateBuffer.order(ByteOrder.nativeOrder()); duplicateBuffer.putInt(INDEX, INT_VALUE); final int afterValue = 1; final int beforeValue = buffer.getAndSetInt(INDEX, afterValue); assertThat(beforeValue, is(INT_VALUE)); assertThat(duplicateBuffer.getInt(INDEX), is(afterValue)); }
@Theory public void shouldGetAndAddIntToNativeBuffer(final AtomicBuffer buffer) { final ByteBuffer duplicateBuffer = byteBuffer(buffer); duplicateBuffer.order(ByteOrder.nativeOrder()); duplicateBuffer.putInt(INDEX, INT_VALUE); final int delta = 1; final int beforeValue = buffer.getAndAddInt(INDEX, delta); assertThat(beforeValue, is(INT_VALUE)); assertThat(duplicateBuffer.getInt(INDEX), is(INT_VALUE + delta)); }
@Theory public void shouldGetLongVolatileFromNativeBuffer(final AtomicBuffer buffer) { final ByteBuffer duplicateBuffer = byteBuffer(buffer); duplicateBuffer.order(ByteOrder.nativeOrder()); duplicateBuffer.putLong(INDEX, LONG_VALUE); assertThat(buffer.getLongVolatile(INDEX), is(LONG_VALUE)); }
@Theory public void shouldPutLongOrderedToNativeBuffer(final AtomicBuffer buffer) { final ByteBuffer duplicateBuffer = byteBuffer(buffer); duplicateBuffer.order(ByteOrder.nativeOrder()); buffer.putLongOrdered(INDEX, LONG_VALUE); assertThat(duplicateBuffer.getLong(INDEX), is(LONG_VALUE)); }
@Theory public void shouldPutIntToNativeBuffer(final AtomicBuffer buffer) { final ByteBuffer duplicateBuffer = byteBuffer(buffer); duplicateBuffer.order(ByteOrder.nativeOrder()); buffer.putInt(INDEX, INT_VALUE); assertThat(duplicateBuffer.getInt(INDEX), is(INT_VALUE)); }
@Theory public void shouldGetCharFromNativeBuffer(final AtomicBuffer buffer) { final ByteBuffer duplicateBuffer = byteBuffer(buffer); duplicateBuffer.order(ByteOrder.nativeOrder()); duplicateBuffer.putChar(INDEX, CHAR_VALUE); assertThat(buffer.getChar(INDEX), is(CHAR_VALUE)); }
@Theory public void shouldPutBytesToBuffer(final AtomicBuffer buffer) { final byte[] testBytes = "Hello World".getBytes(); buffer.putBytes(INDEX, testBytes); final ByteBuffer duplicateBuffer = byteBuffer(buffer); duplicateBuffer.position(INDEX); final byte[] buff = new byte[testBytes.length]; duplicateBuffer.get(buff); assertThat(buff, is(testBytes)); }
@Theory public void shouldPutShortToNativeBuffer(final AtomicBuffer buffer) { final ByteBuffer duplicateBuffer = byteBuffer(buffer); duplicateBuffer.order(ByteOrder.nativeOrder()); buffer.putShort(INDEX, SHORT_VALUE); assertThat(duplicateBuffer.getShort(INDEX), is(SHORT_VALUE)); }
@Theory public void shouldPutCharToNativeBuffer(final AtomicBuffer buffer) { final ByteBuffer duplicateBuffer = byteBuffer(buffer); duplicateBuffer.order(ByteOrder.nativeOrder()); buffer.putChar(INDEX, CHAR_VALUE); assertThat(duplicateBuffer.getChar(INDEX), is(CHAR_VALUE)); }
@Theory public void shouldPutDoubleToNativeBuffer(final AtomicBuffer buffer) { final ByteBuffer duplicateBuffer = byteBuffer(buffer); duplicateBuffer.order(ByteOrder.nativeOrder()); buffer.putDouble(INDEX, DOUBLE_VALUE); assertThat(duplicateBuffer.getDouble(INDEX), is(DOUBLE_VALUE)); }
@Theory public void shouldPutFloatToNativeBuffer(final AtomicBuffer buffer) { final ByteBuffer duplicateBuffer = byteBuffer(buffer); duplicateBuffer.order(ByteOrder.nativeOrder()); buffer.putFloat(INDEX, FLOAT_VALUE); assertThat(duplicateBuffer.getFloat(INDEX), is(FLOAT_VALUE)); }
@Theory public void shouldRoundTripAsciiStringWithoutLength(final MutableDirectBuffer buffer) { final String value = "Hello World"; buffer.putStringWithoutLengthAscii(INDEX, value); assertThat(buffer.getStringWithoutLengthAscii(INDEX, value.length()), is(value)); }
@Theory public void theoryHaveSamePath(String path) throws Exception { Resource res = getResource(path); String result = res.path(); assertThat(result, is(equalTo(path))); }
@Theory public void shouldGetLongFromBuffer(final AtomicBuffer buffer) { final ByteBuffer duplicateBuffer = byteBuffer(buffer); duplicateBuffer.putLong(INDEX, LONG_VALUE); assertThat(buffer.getLong(INDEX, BYTE_ORDER), is(LONG_VALUE)); }
@Theory public void shouldPutIntToBuffer(final AtomicBuffer buffer) { final ByteBuffer duplicateBuffer = byteBuffer(buffer); buffer.putInt(INDEX, INT_VALUE, BYTE_ORDER); assertThat(duplicateBuffer.getInt(INDEX), is(INT_VALUE)); }
@Theory public void shouldPutDoubleToBuffer(final AtomicBuffer buffer) { final ByteBuffer duplicateBuffer = byteBuffer(buffer); buffer.putDouble(INDEX, DOUBLE_VALUE, BYTE_ORDER); assertThat(duplicateBuffer.getDouble(INDEX), is(DOUBLE_VALUE)); }
@Theory public void shouldPutByteToBuffer(final AtomicBuffer buffer) { final ByteBuffer duplicateBuffer = byteBuffer(buffer); buffer.putByte(INDEX, BYTE_VALUE); assertThat(duplicateBuffer.get(INDEX), is(BYTE_VALUE)); }