use of org.junit.jupiter.api.function.Executable in project neo4j by neo4j.
the class TokenIndexAccessorTest method updaterShouldHandleRandomizedUpdatesWithCheckpoint.
@Test
void updaterShouldHandleRandomizedUpdatesWithCheckpoint() throws Throwable {
Executable additionalOperation = this::maybeCheckpoint;
updaterShouldHandleRandomizedUpdates(additionalOperation);
}
use of org.junit.jupiter.api.function.Executable in project netty by netty.
the class DecoratingHttp2ConnectionEncoderTest method testConsumeReceivedSettingsThrows.
@Test
public void testConsumeReceivedSettingsThrows() {
Http2ConnectionEncoder encoder = mock(Http2ConnectionEncoder.class);
final DecoratingHttp2ConnectionEncoder decoratingHttp2ConnectionEncoder = new DecoratingHttp2ConnectionEncoder(encoder);
assertThrows(IllegalStateException.class, new Executable() {
@Override
public void execute() {
decoratingHttp2ConnectionEncoder.consumeReceivedSettings(Http2Settings.defaultSettings());
}
});
}
use of org.junit.jupiter.api.function.Executable in project netty by netty.
the class DefaultHttp2ConnectionDecoderTest method windowUpdateReadForUnknownStreamShouldThrow.
@Test
public void windowUpdateReadForUnknownStreamShouldThrow() throws Exception {
when(connection.streamMayHaveExisted(STREAM_ID)).thenReturn(false);
when(connection.stream(STREAM_ID)).thenReturn(null);
assertThrows(Http2Exception.class, new Executable() {
@Override
public void execute() throws Throwable {
decode().onWindowUpdateRead(ctx, STREAM_ID, 10);
}
});
}
use of org.junit.jupiter.api.function.Executable in project netty by netty.
the class DefaultHttp2ConnectionDecoderTest method dataContentLengthInvalid.
private void dataContentLengthInvalid(boolean negative) throws Exception {
final ByteBuf data = dummyData();
final int padding = 10;
int processedBytes = data.readableBytes() + padding;
mockFlowControl(processedBytes);
try {
if (negative) {
assertThrows(Http2Exception.StreamException.class, new Executable() {
@Override
public void execute() throws Throwable {
decode().onHeadersRead(ctx, STREAM_ID, new DefaultHttp2Headers().setLong(HttpHeaderNames.CONTENT_LENGTH, -1L), padding, false);
}
});
} else {
decode().onHeadersRead(ctx, STREAM_ID, new DefaultHttp2Headers().setLong(HttpHeaderNames.CONTENT_LENGTH, 1L), padding, false);
assertThrows(Http2Exception.StreamException.class, new Executable() {
@Override
public void execute() throws Throwable {
decode().onDataRead(ctx, STREAM_ID, data, padding, true);
}
});
verify(localFlow).receiveFlowControlledFrame(eq(stream), eq(data), eq(padding), eq(true));
verify(localFlow).consumeBytes(eq(stream), eq(processedBytes));
verify(listener, times(1)).onHeadersRead(eq(ctx), anyInt(), any(Http2Headers.class), eq(0), eq(DEFAULT_PRIORITY_WEIGHT), eq(false), eq(padding), eq(false));
}
// Verify that the event was absorbed and not propagated to the observer.
verify(listener, never()).onDataRead(eq(ctx), anyInt(), any(ByteBuf.class), anyInt(), anyBoolean());
} finally {
data.release();
}
}
use of org.junit.jupiter.api.function.Executable in project netty by netty.
the class DefaultHttp2ConnectionDecoderTest method headersContentLength.
private void headersContentLength(final boolean negative) throws Exception {
final int padding = 10;
when(connection.isServer()).thenReturn(true);
assertThrows(Http2Exception.StreamException.class, new Executable() {
@Override
public void execute() throws Throwable {
decode().onHeadersRead(ctx, STREAM_ID, new DefaultHttp2Headers().setLong(HttpHeaderNames.CONTENT_LENGTH, negative ? -1L : 1L), padding, true);
}
});
// Verify that the event was absorbed and not propagated to the observer.
verify(listener, never()).onHeadersRead(eq(ctx), anyInt(), any(Http2Headers.class), anyInt(), anyShort(), anyBoolean(), anyInt(), anyBoolean());
}
Aggregations