Search in sources :

Example 1 with IsInstanceOf

use of org.hamcrest.core.IsInstanceOf in project druid by druid-io.

the class StupidPoolTest method testTake.

@Test
public void testTake() {
    Assert.assertThat(resourceHolderObj, new IsInstanceOf(ResourceHolder.class));
    Object expectedObject = resourceHolderObj.get();
    Assert.assertEquals(expectedObject, defaultString);
}
Also used : IsInstanceOf(org.hamcrest.core.IsInstanceOf) Test(org.junit.Test)

Example 2 with IsInstanceOf

use of org.hamcrest.core.IsInstanceOf in project kafka by apache.

the class GlobalProcessorContextImplTest method shouldReturnGlobalOrNullStore.

@Test
public void shouldReturnGlobalOrNullStore() {
    assertThat(globalContext.getStateStore(GLOBAL_STORE_NAME), new IsInstanceOf(StateStore.class));
    assertNull(globalContext.getStateStore(UNKNOWN_STORE));
}
Also used : StateStore(org.apache.kafka.streams.processor.StateStore) IsInstanceOf(org.hamcrest.core.IsInstanceOf) Test(org.junit.Test)

Example 3 with IsInstanceOf

use of org.hamcrest.core.IsInstanceOf in project beam by apache.

the class AvroByteReaderFactoryTest method testCreatePlainAvroByteReader.

@Test
public void testCreatePlainAvroByteReader() throws Exception {
    Coder<?> coder = WindowedValue.getFullCoder(BigEndianIntegerCoder.of(), GlobalWindow.Coder.INSTANCE);
    NativeReader<?> reader = runTestCreateAvroReader(pathToAvroFile, null, null, CloudObjects.asCloudObject(coder, /*sdkComponents=*/
    null));
    assertThat(reader, new IsInstanceOf(AvroByteReader.class));
    AvroByteReader avroReader = (AvroByteReader) reader;
    Assert.assertEquals(pathToAvroFile, avroReader.avroSource.getFileOrPatternSpec());
    Assert.assertEquals(0L, avroReader.startPosition);
    Assert.assertEquals(Long.MAX_VALUE, avroReader.endPosition);
    Assert.assertEquals(coder, avroReader.coder);
}
Also used : IsInstanceOf(org.hamcrest.core.IsInstanceOf) Test(org.junit.Test)

Example 4 with IsInstanceOf

use of org.hamcrest.core.IsInstanceOf in project beam by apache.

the class AvroByteReaderFactoryTest method testCreateRichAvroByteReader.

@Test
public void testCreateRichAvroByteReader() throws Exception {
    Coder<?> coder = WindowedValue.getFullCoder(BigEndianIntegerCoder.of(), GlobalWindow.Coder.INSTANCE);
    NativeReader<?> reader = runTestCreateAvroReader(pathToAvroFile, 200L, 500L, CloudObjects.asCloudObject(coder, /*sdkComponents=*/
    null));
    assertThat(reader, new IsInstanceOf(AvroByteReader.class));
    AvroByteReader avroReader = (AvroByteReader) reader;
    Assert.assertEquals(pathToAvroFile, avroReader.avroSource.getFileOrPatternSpec());
    Assert.assertEquals(200L, avroReader.startPosition);
    Assert.assertEquals(500L, avroReader.endPosition);
    Assert.assertEquals(coder, avroReader.coder);
}
Also used : IsInstanceOf(org.hamcrest.core.IsInstanceOf) Test(org.junit.Test)

Example 5 with IsInstanceOf

use of org.hamcrest.core.IsInstanceOf in project beam by apache.

the class SinkRegistryTest method testCreatePredefinedSink.

@Test
public void testCreatePredefinedSink() throws Exception {
    CloudObject spec = CloudObject.forClassName("AvroSink");
    addString(spec, "filename", "/path/to/file.txt");
    SizeReportingSinkWrapper<?> sink = SinkRegistry.defaultRegistry().create(spec, StringUtf8Coder.of(), options, BatchModeExecutionContext.forTesting(options, "testStage"), TestOperationContext.create());
    assertThat(sink.getUnderlyingSink(), new IsInstanceOf(AvroByteSink.class));
}
Also used : CloudObject(org.apache.beam.runners.dataflow.util.CloudObject) IsInstanceOf(org.hamcrest.core.IsInstanceOf) Test(org.junit.Test)

Aggregations

IsInstanceOf (org.hamcrest.core.IsInstanceOf)11 Test (org.junit.Test)8 CloudObject (org.apache.beam.runners.dataflow.util.CloudObject)4 Source (com.google.api.services.dataflow.model.Source)3 PipelineOptions (org.apache.beam.sdk.options.PipelineOptions)2 StateStore (org.apache.kafka.streams.processor.StateStore)1