flink-instrumentation/workspace/flink-1.4.1-instrumented/flink-1.4.1/flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/ResultPartitionTest.java
/**
	 * Tests {@link ResultPartition#add} on a partition which has already finished.
	 *
	 * @param pipelined the result partition type to set up
	 */
Tests  ResultPartition#add on a partition which has already finished.
@param pipelined the result partition type to set up
Tests ResultPartition#add on a partition which has already finished . @param pipelined the result partition type to set up
protected void testAddOnFinishedPartition(final ResultPartitionType pipelined)
		throws Exception {
		Buffer buffer = TestBufferFactory.createBuffer();
		ResultPartitionConsumableNotifier notifier = mock(ResultPartitionConsumableNotifier.class);
		try {
			ResultPartition partition = createPartition(notifier, pipelined, true);
			partition.finish();
			reset(notifier);
			partition.add(buffer, 0);
			Assert.fail("exception expected");
		} catch (IllegalStateException e) {
		} finally {
			if (!buffer.isRecycled()) {
				Assert.fail("buffer not recycled");
				buffer.recycle();
			}
			verify(notifier, never()).notifyPartitionConsumable(any(JobID.class), any(ResultPartitionID.class), any(TaskActions.class));
		}
	}
protected void testAddOnFinishedPartition ( final ResultPartitionType pipelined ) throws Exception { Buffer buffer = TestBufferFactory . createBuffer ( ) ; ResultPartitionConsumableNotifier notifier = mock ( ResultPartitionConsumableNotifier . class ) ; try { ResultPartition partition = createPartition ( notifier , pipelined , true ) ; partition . finish ( ) ; reset ( notifier ) ; partition . add ( buffer , 0 ) ; Assert . fail ( "exception expected" ) ; } catch ( IllegalStateException e ) { } finally { if ( ! buffer . isRecycled ( ) ) { Assert . fail ( "buffer not recycled" ) ; buffer . recycle ( ) ; } verify ( notifier , never ( ) ) . notifyPartitionConsumable ( any ( JobID . class ) , any ( ResultPartitionID . class ) , any ( TaskActions . class ) ) ; } }
Tests {@link ResultPartition#add} on a partition which has already finished.
Tests { @link ResultPartition#add } on a partition which has already finished .
// partition.add() should fail // expected => ignored // should not have notified either