ProtectDelegator extends BaseDelegator implements IProtectDelegator { @Override public InputStream getProtectionsTable() throws P4JavaException { return execStreamCmd(PROTECT, new String[] { "-o" }); } ProtectDelegator(IOptionsServer server); @Override String createProtectionEntries(@Nonnull final List<IProtectionEntry> entryList); @Override String updateProtectionEntries(@Nonnull final List<IProtectionEntry> entryList); @Override InputStream getProtectionsTable();  }
@Test public void getProtectionsTable() throws Exception { InputStream mockedInputStream = mock(InputStream.class); when(server.execStreamCmd(eq(PROTECT.toString()), eq(GET_CMD_ARGUMENTS))) .thenReturn(mockedInputStream); InputStream protectionsTable = protectDelegator.getProtectionsTable(); assertThat(protectionsTable, is(mockedInputStream)); }