Removed not needed assertNotNull before assertTrue for instanceof
https://stackoverflow.com/questions/2950319/is-null-check-needed-before-calling-instanceof
This commit is contained in:
parent
59d40251c7
commit
5aef2afb45
1 changed files with 12 additions and 14 deletions
|
|
@ -142,7 +142,7 @@ public class WorkerTest {
|
||||||
|
|
||||||
private static final String KINESIS_SHARD_ID_FORMAT = "kinesis-0-0-%d";
|
private static final String KINESIS_SHARD_ID_FORMAT = "kinesis-0-0-%d";
|
||||||
private static final String CONCURRENCY_TOKEN_FORMAT = "testToken-%d";
|
private static final String CONCURRENCY_TOKEN_FORMAT = "testToken-%d";
|
||||||
|
|
||||||
private RecordsFetcherFactory recordsFetcherFactory;
|
private RecordsFetcherFactory recordsFetcherFactory;
|
||||||
private KinesisClientLibConfiguration config;
|
private KinesisClientLibConfiguration config;
|
||||||
|
|
||||||
|
|
@ -170,7 +170,7 @@ public class WorkerTest {
|
||||||
private Future<TaskResult> taskFuture;
|
private Future<TaskResult> taskFuture;
|
||||||
@Mock
|
@Mock
|
||||||
private TaskResult taskResult;
|
private TaskResult taskResult;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
config = spy(new KinesisClientLibConfiguration("app", null, null, null));
|
config = spy(new KinesisClientLibConfiguration("app", null, null, null));
|
||||||
|
|
@ -179,7 +179,7 @@ public class WorkerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECKSTYLE:IGNORE AnonInnerLengthCheck FOR NEXT 50 LINES
|
// CHECKSTYLE:IGNORE AnonInnerLengthCheck FOR NEXT 50 LINES
|
||||||
private static final com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessorFactory SAMPLE_RECORD_PROCESSOR_FACTORY =
|
private static final com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessorFactory SAMPLE_RECORD_PROCESSOR_FACTORY =
|
||||||
new com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessorFactory() {
|
new com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessorFactory() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -212,8 +212,8 @@ public class WorkerTest {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final IRecordProcessorFactory SAMPLE_RECORD_PROCESSOR_FACTORY_V2 =
|
private static final IRecordProcessorFactory SAMPLE_RECORD_PROCESSOR_FACTORY_V2 =
|
||||||
new V1ToV2RecordProcessorFactoryAdapter(SAMPLE_RECORD_PROCESSOR_FACTORY);
|
new V1ToV2RecordProcessorFactoryAdapter(SAMPLE_RECORD_PROCESSOR_FACTORY);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -619,7 +619,7 @@ public class WorkerTest {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}).when(v2RecordProcessor).processRecords(any(ProcessRecordsInput.class));
|
}).when(v2RecordProcessor).processRecords(any(ProcessRecordsInput.class));
|
||||||
|
|
||||||
RecordsFetcherFactory recordsFetcherFactory = mock(RecordsFetcherFactory.class);
|
RecordsFetcherFactory recordsFetcherFactory = mock(RecordsFetcherFactory.class);
|
||||||
GetRecordsCache getRecordsCache = mock(GetRecordsCache.class);
|
GetRecordsCache getRecordsCache = mock(GetRecordsCache.class);
|
||||||
when(config.getRecordsFetcherFactory()).thenReturn(recordsFetcherFactory);
|
when(config.getRecordsFetcherFactory()).thenReturn(recordsFetcherFactory);
|
||||||
|
|
@ -659,7 +659,7 @@ public class WorkerTest {
|
||||||
* This test is testing the {@link Worker}'s shutdown behavior and by extension the behavior of
|
* This test is testing the {@link Worker}'s shutdown behavior and by extension the behavior of
|
||||||
* {@link ThreadPoolExecutor#shutdownNow()}. It depends on the thread pool sending an interrupt to the pool threads.
|
* {@link ThreadPoolExecutor#shutdownNow()}. It depends on the thread pool sending an interrupt to the pool threads.
|
||||||
* This behavior makes the test a bit racy, since we need to ensure a specific order of events.
|
* This behavior makes the test a bit racy, since we need to ensure a specific order of events.
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -1356,7 +1356,7 @@ public class WorkerTest {
|
||||||
executorService,
|
executorService,
|
||||||
metricsFactory,
|
metricsFactory,
|
||||||
taskBackoffTimeMillis,
|
taskBackoffTimeMillis,
|
||||||
failoverTimeMillis,
|
failoverTimeMillis,
|
||||||
false,
|
false,
|
||||||
shardPrioritization);
|
shardPrioritization);
|
||||||
|
|
||||||
|
|
@ -1432,7 +1432,7 @@ public class WorkerTest {
|
||||||
config,
|
config,
|
||||||
streamConfig,
|
streamConfig,
|
||||||
INITIAL_POSITION_TRIM_HORIZON,
|
INITIAL_POSITION_TRIM_HORIZON,
|
||||||
parentShardPollIntervalMillis,
|
parentShardPollIntervalMillis,
|
||||||
shardSyncIntervalMillis,
|
shardSyncIntervalMillis,
|
||||||
cleanupLeasesUponShardCompletion,
|
cleanupLeasesUponShardCompletion,
|
||||||
leaseCoordinator,
|
leaseCoordinator,
|
||||||
|
|
@ -1482,7 +1482,6 @@ public class WorkerTest {
|
||||||
.recordProcessorFactory(recordProcessorFactory)
|
.recordProcessorFactory(recordProcessorFactory)
|
||||||
.config(config)
|
.config(config)
|
||||||
.build();
|
.build();
|
||||||
Assert.assertNotNull(worker.getStreamConfig().getStreamProxy());
|
|
||||||
Assert.assertTrue(worker.getStreamConfig().getStreamProxy() instanceof KinesisProxy);
|
Assert.assertTrue(worker.getStreamConfig().getStreamProxy() instanceof KinesisProxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1496,7 +1495,6 @@ public class WorkerTest {
|
||||||
.config(config)
|
.config(config)
|
||||||
.kinesisProxy(kinesisProxy)
|
.kinesisProxy(kinesisProxy)
|
||||||
.build();
|
.build();
|
||||||
Assert.assertNotNull(worker.getStreamConfig().getStreamProxy());
|
|
||||||
Assert.assertTrue(worker.getStreamConfig().getStreamProxy() instanceof KinesisLocalFileProxy);
|
Assert.assertTrue(worker.getStreamConfig().getStreamProxy() instanceof KinesisLocalFileProxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1774,7 +1772,7 @@ public class WorkerTest {
|
||||||
TestStreamletFactory recordProcessorFactory = new TestStreamletFactory(recordCounter, shardSequenceVerifier);
|
TestStreamletFactory recordProcessorFactory = new TestStreamletFactory(recordCounter, shardSequenceVerifier);
|
||||||
|
|
||||||
ExecutorService executorService = Executors.newFixedThreadPool(threadPoolSize);
|
ExecutorService executorService = Executors.newFixedThreadPool(threadPoolSize);
|
||||||
|
|
||||||
WorkerThread workerThread = runWorker(
|
WorkerThread workerThread = runWorker(
|
||||||
shardList, initialLeases, callProcessRecordsForEmptyRecordList, failoverTimeMillis,
|
shardList, initialLeases, callProcessRecordsForEmptyRecordList, failoverTimeMillis,
|
||||||
numberOfRecordsPerShard, fileBasedProxy, recordProcessorFactory, executorService, nullMetricsFactory, clientConfig);
|
numberOfRecordsPerShard, fileBasedProxy, recordProcessorFactory, executorService, nullMetricsFactory, clientConfig);
|
||||||
|
|
@ -1830,7 +1828,7 @@ public class WorkerTest {
|
||||||
idleTimeInMilliseconds,
|
idleTimeInMilliseconds,
|
||||||
callProcessRecordsForEmptyRecordList,
|
callProcessRecordsForEmptyRecordList,
|
||||||
skipCheckpointValidationValue, InitialPositionInStreamExtended.newInitialPositionAtTimestamp(timestamp));
|
skipCheckpointValidationValue, InitialPositionInStreamExtended.newInitialPositionAtTimestamp(timestamp));
|
||||||
|
|
||||||
Worker worker =
|
Worker worker =
|
||||||
new Worker(stageName,
|
new Worker(stageName,
|
||||||
recordProcessorFactory,
|
recordProcessorFactory,
|
||||||
|
|
@ -1847,7 +1845,7 @@ public class WorkerTest {
|
||||||
failoverTimeMillis,
|
failoverTimeMillis,
|
||||||
KinesisClientLibConfiguration.DEFAULT_SKIP_SHARD_SYNC_AT_STARTUP_IF_LEASES_EXIST,
|
KinesisClientLibConfiguration.DEFAULT_SKIP_SHARD_SYNC_AT_STARTUP_IF_LEASES_EXIST,
|
||||||
shardPrioritization);
|
shardPrioritization);
|
||||||
|
|
||||||
WorkerThread workerThread = new WorkerThread(worker);
|
WorkerThread workerThread = new WorkerThread(worker);
|
||||||
workerThread.start();
|
workerThread.start();
|
||||||
return workerThread;
|
return workerThread;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue