本文整理了Java中org.junit.experimental.theories.Theory.<init>()
方法的一些代码示例,展示了Theory.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Theory.<init>()
方法的具体详情如下:
包路径:org.junit.experimental.theories.Theory
类名称:Theory
方法名:<init>
暂无
代码示例来源:origin: real-logic/agrona
@Theory
public void shouldGetCapacity(final AtomicBuffer buffer)
{
assertThat(buffer.capacity(), is(BUFFER_CAPACITY));
}
代码示例来源:origin: real-logic/agrona
@Theory
public void shouldGetSizeWhenEmpty(final Fixture fixture)
{
final Queue<Integer> queue = fixture.newInstance();
assertThat(queue.size(), is(0));
}
代码示例来源:origin: real-logic/agrona
@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));
}
代码示例来源:origin: real-logic/agrona
@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));
}
代码示例来源:origin: real-logic/agrona
@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));
}
代码示例来源:origin: real-logic/agrona
@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));
}
代码示例来源:origin: real-logic/agrona
@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));
}
代码示例来源:origin: real-logic/agrona
@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));
}
代码示例来源:origin: real-logic/agrona
@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));
}
代码示例来源:origin: real-logic/agrona
@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));
}
代码示例来源:origin: real-logic/agrona
@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));
}
代码示例来源:origin: real-logic/agrona
@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));
}
代码示例来源:origin: real-logic/agrona
@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));
}
代码示例来源:origin: real-logic/agrona
@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));
}
代码示例来源:origin: real-logic/agrona
@Theory
public void shouldRoundTripAsciiStringWithoutLength(final MutableDirectBuffer buffer)
{
final String value = "Hello World";
buffer.putStringWithoutLengthAscii(INDEX, value);
assertThat(buffer.getStringWithoutLengthAscii(INDEX, value.length()), is(value));
}
代码示例来源:origin: geoserver/geoserver
@Theory
public void theoryHaveSamePath(String path) throws Exception {
Resource res = getResource(path);
String result = res.path();
assertThat(result, is(equalTo(path)));
}
代码示例来源:origin: real-logic/agrona
@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));
}
代码示例来源:origin: real-logic/agrona
@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));
}
代码示例来源:origin: real-logic/agrona
@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));
}
代码示例来源:origin: real-logic/agrona
@Theory
public void shouldPutByteToBuffer(final AtomicBuffer buffer)
{
final ByteBuffer duplicateBuffer = byteBuffer(buffer);
buffer.putByte(INDEX, BYTE_VALUE);
assertThat(duplicateBuffer.get(INDEX), is(BYTE_VALUE));
}
内容来源于网络,如有侵权,请联系作者删除!