NativeCollectorOnlyHandler implements CommandDispatcher, Closeable { public void collect(K key, V value, int partition) throws IOException { kvPusher.collect(key, value, partition); } protected  NativeCollectorOnlyHandler(TaskContext context, INativeHandler nativeHandler,
      BufferPusher<K, V> kvPusher, ICombineHandler combiner); static NativeCollectorOnlyHandler<K, V> create(TaskContext context); void collect(K key, V value, int partition); void flush(); @Override void close(); @Override ReadWriteBuffer onCall(Command command, ReadWriteBuffer parameter); static final String NAME; static final Command GET_OUTPUT_PATH; static final Command GET_OUTPUT_INDEX_PATH; static final Command GET_SPILL_PATH; static final Command GET_COMBINE_HANDLER; }
@Test public void testCollect() throws IOException { this.handler = new NativeCollectorOnlyHandler(taskContext, nativeHandler, pusher, combiner); handler.collect(new BytesWritable(), new BytesWritable(), 100); handler.close(); handler.close(); Mockito.verify(pusher, Mockito.times(1)).collect(any(BytesWritable.class), any(BytesWritable.class), anyInt()); Mockito.verify(pusher, Mockito.times(1)).close(); Mockito.verify(combiner, Mockito.times(1)).close(); Mockito.verify(nativeHandler, Mockito.times(1)).close(); }