@Test public void testCanParseNotCreateProgram() { final List<String> source = Arrays.asList("DROP PROGRAM TEST", ""); when(parser.canParse(source.get(1))).thenReturn(Boolean.TRUE); assertThat(factory.canParse(1, source)).isFalse(); }
@Override public boolean canParse(final int currentIndex, final List<String> source) { int previousNonEmptyIndex = -1; for (int previousIndex = currentIndex - 1; previousIndex > -1; previousIndex--) { if (!StringUtils.strip(source.get(previousIndex)).isEmpty()) { previousNonEmptyIndex = previousIndex; break; } } return parser.canParse(source.get(currentIndex)) && previousNonEmptyIndex > -1 && StringUtils .startsWithIgnoreCase(StringUtils.strip(source.get(previousNonEmptyIndex)), "CREATE PROGRAM "); }
ScriptDocumentationFactory implements TopLevelDocumentationFactory<ScriptDocumentation> { @Override public boolean canParse(final int currentIndex, final List<String> source) { int previousNonEmptyIndex = -1; for (int previousIndex = currentIndex - 1; previousIndex > -1; previousIndex--) { if (!StringUtils.strip(source.get(previousIndex)).isEmpty()) { previousNonEmptyIndex = previousIndex; break; } } return parser.canParse(source.get(currentIndex)) && previousNonEmptyIndex > -1 && StringUtils .startsWithIgnoreCase(StringUtils.strip(source.get(previousNonEmptyIndex)), "CREATE PROGRAM "); } }
ScriptDocumentationFactory implements TopLevelDocumentationFactory<ScriptDocumentation> { @Override public boolean canParse(final int currentIndex, final List<String> source) { int previousNonEmptyIndex = -1; for (int previousIndex = currentIndex - 1; previousIndex > -1; previousIndex--) { if (!StringUtils.strip(source.get(previousIndex)).isEmpty()) { previousNonEmptyIndex = previousIndex; break; } } return parser.canParse(source.get(currentIndex)) && previousNonEmptyIndex > -1 && StringUtils .startsWithIgnoreCase(StringUtils.strip(source.get(previousNonEmptyIndex)), "CREATE PROGRAM "); } ScriptDocumentationFactory();  ScriptDocumentationFactory(final ScriptDocumentationParser parser); }
ScriptDocumentationFactory implements TopLevelDocumentationFactory<ScriptDocumentation> { @Override public boolean canParse(final int currentIndex, final List<String> source) { int previousNonEmptyIndex = -1; for (int previousIndex = currentIndex - 1; previousIndex > -1; previousIndex--) { if (!StringUtils.strip(source.get(previousIndex)).isEmpty()) { previousNonEmptyIndex = previousIndex; break; } } return parser.canParse(source.get(currentIndex)) && previousNonEmptyIndex > -1 && StringUtils .startsWithIgnoreCase(StringUtils.strip(source.get(previousNonEmptyIndex)), "CREATE PROGRAM "); } ScriptDocumentationFactory();  ScriptDocumentationFactory(final ScriptDocumentationParser parser); @Override boolean canParse(final int currentIndex, final List<String> source); @Override int getEndingIndex(); @Override ScriptDocumentation parse(final int currentIndex, final List<String> source); }
ScriptDocumentationFactory implements TopLevelDocumentationFactory<ScriptDocumentation> { @Override public boolean canParse(final int currentIndex, final List<String> source) { int previousNonEmptyIndex = -1; for (int previousIndex = currentIndex - 1; previousIndex > -1; previousIndex--) { if (!StringUtils.strip(source.get(previousIndex)).isEmpty()) { previousNonEmptyIndex = previousIndex; break; } } return parser.canParse(source.get(currentIndex)) && previousNonEmptyIndex > -1 && StringUtils .startsWithIgnoreCase(StringUtils.strip(source.get(previousNonEmptyIndex)), "CREATE PROGRAM "); } ScriptDocumentationFactory();  ScriptDocumentationFactory(final ScriptDocumentationParser parser); @Override boolean canParse(final int currentIndex, final List<String> source); @Override int getEndingIndex(); @Override ScriptDocumentation parse(final int currentIndex, final List<String> source);  }