ExportDelegator extends BaseDelegator implements IExportDelegator { @Override public void getStreamingExportRecords( final ExportRecordsOptions opts, @Nonnull final IStreamingCallback callback, final int key) throws P4JavaException { Validate.notNull(callback); Map<String, Object> inMap = new HashMap<>(); if (nonNull(opts)) { inMap = opts.processFieldRules(); } server.execStreamingMapCommand( EXPORT.toString(), processParameters(opts, server), inMap, callback, key); } ExportDelegator(IOptionsServer server); @Override List<Map<String, Object>> getExportRecords(
            final boolean useJournal,
            final long maxRecs,
            final int sourceNum,
            final long offset,
            final boolean format,
            final String journalPrefix,
            final String filter); @Override List<Map<String, Object>> getExportRecords(final ExportRecordsOptions opts); @Override void getStreamingExportRecords(
            final ExportRecordsOptions opts,
            @Nonnull final IStreamingCallback callback,
            final int key);  }
@Test public void testGetStreamingExportRecordsExpectedThrownNullPointerExceptionWhenCallBackIsNull() throws Exception { assertThrows(NullPointerException.class, () -> { final int key = 10; exportDelegator.getStreamingExportRecords(mockOpts, null, key); }); }
@Test(expected = NullPointerException.class) public void testGetStreamingExportRecordsExpectedThrownNullPointerExceptionWhenCallBackIsNull() throws Exception { final int key = 10; exportDelegator.getStreamingExportRecords(mockOpts, null, key); }
@Test public void testGetStreamingExportRecords() throws Exception { when(mockOpts.processFieldRules()).thenReturn(resultMap); when(mockOpts.getSourceNum()).thenReturn(2); when(mockOpts.isImmutable()).thenReturn(true); String mockOptionsValue = "-jtoken123"; when(mockOpts.getOptions()).thenReturn(Arrays.asList(mockOptionsValue)); final int key = 10; exportDelegator.getStreamingExportRecords(mockOpts, mockCallback, key); verify(mockOpts).processFieldRules(); verify(server).execStreamingMapCommand(eq(EXPORT.toString()), eq(new String[] { mockOptionsValue }), eq(resultMap), eq(mockCallback), eq(key)); }
@Test public void testGetStreamingExportRecordsExpectedThrownNullPointerExceptionWhenCallBackIsNull() throws Exception { expectThrows(NullPointerException.class, () -> { final int key = 10; exportDelegator.getStreamingExportRecords(mockOpts, null, key); }); }
@Test public void testGetStreamingExportRecords() throws Exception { when(mockOpts.processFieldRules()).thenReturn(resultMap); when(mockOpts.getSourceNum()).thenReturn(2); when(mockOpts.isImmutable()).thenReturn(true); String mockOptionsValue = "-jtoken123"; when(mockOpts.getOptions()).thenReturn(Arrays.asList(mockOptionsValue)); final int key = 10; exportDelegator.getStreamingExportRecords(mockOpts, mockCallback, key); verify(mockOpts).processFieldRules(); verify(server).execStreamingMapCommand(eq(EXPORT.toString()), eq(new String[]{mockOptionsValue}), eq(resultMap), eq(mockCallback), eq(key)); }