@Test public void filterLinkWithoutLabel() { ResourceReference reference = new ResourceReference("file name.txt", ResourceType.ATTACHMENT); LinkBlock emptyLink = new LinkBlock(Collections.emptyList(), reference, false); List<Block> result = filter.filter(emptyLink); assertIterableEquals(Collections.singletonList(new WordBlock("file name.txt")), result); }
@Override public List<Block> filter(Block block) { if (VALID_PLAINTEXT_BLOCKS.contains(block.getClass())) { return Collections.singletonList(block); } if (LinkBlock.class.isAssignableFrom(block.getClass()) && block.getChildren().isEmpty()) { ResourceReference reference = ((LinkBlock) block).getReference(); return filterLinkBlock(reference); } return Collections.emptyList(); }
PlainTextBlockFilter implements BlockFilter { @Override public List<Block> filter(Block block) { if (VALID_PLAINTEXT_BLOCKS.contains(block.getClass())) { return Collections.singletonList(block); } if (LinkBlock.class.isAssignableFrom(block.getClass()) && block.getChildren().isEmpty()) { ResourceReference reference = ((LinkBlock) block).getReference(); return filterLinkBlock(reference); } return Collections.emptyList(); } }
PlainTextBlockFilter implements BlockFilter { @Override public List<Block> filter(Block block) { if (VALID_PLAINTEXT_BLOCKS.contains(block.getClass())) { return Collections.singletonList(block); } if (LinkBlock.class.isAssignableFrom(block.getClass()) && block.getChildren().isEmpty()) { ResourceReference reference = ((LinkBlock) block).getReference(); return filterLinkBlock(reference); } return Collections.emptyList(); } PlainTextBlockFilter(Parser plainTextParser, LinkLabelGenerator linkLabelGenerator); }
PlainTextBlockFilter implements BlockFilter { @Override public List<Block> filter(Block block) { if (VALID_PLAINTEXT_BLOCKS.contains(block.getClass())) { return Collections.singletonList(block); } if (LinkBlock.class.isAssignableFrom(block.getClass()) && block.getChildren().isEmpty()) { ResourceReference reference = ((LinkBlock) block).getReference(); return filterLinkBlock(reference); } return Collections.emptyList(); } PlainTextBlockFilter(Parser plainTextParser, LinkLabelGenerator linkLabelGenerator); @Override List<Block> filter(Block block); }
PlainTextBlockFilter implements BlockFilter { @Override public List<Block> filter(Block block) { if (VALID_PLAINTEXT_BLOCKS.contains(block.getClass())) { return Collections.singletonList(block); } if (LinkBlock.class.isAssignableFrom(block.getClass()) && block.getChildren().isEmpty()) { ResourceReference reference = ((LinkBlock) block).getReference(); return filterLinkBlock(reference); } return Collections.emptyList(); } PlainTextBlockFilter(Parser plainTextParser, LinkLabelGenerator linkLabelGenerator); @Override List<Block> filter(Block block);  }