@Test public void registerWritesUrlEncodedFiltersAndNewlineToOutputStream() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); FilterRegistry registry = new FilterRegistry(anyInputStream(), outputStream); registry.register(FILTERS); assertEquals(URL_ENCODED_FILTERS + NEW_LINE, new String(outputStream.toByteArray())); }
boolean isAcknowledged = registry.register(filters); if (isAcknowledged) { log.debug("Received \'ACK\' from Ryuk");
@Test public void registerReturnsTrueIfAcknowledgementIsReadFromInputStream() throws IOException { FilterRegistry registry = new FilterRegistry(inputStream(ACKNOWLEDGEMENT), anyOutputStream()); boolean successful = registry.register(FILTERS); assertTrue(successful); }
@Test public void registerReturnsFalseIfNoAcknowledgementIsReadFromInputStream() throws IOException { FilterRegistry registry = new FilterRegistry(inputStream(NO_ACKNOWLEDGEMENT), anyOutputStream()); boolean successful = registry.register(FILTERS); assertFalse(successful); }