@Test void getCompletionSource() { assertEquals( completion.getCompletionSource( new MyDocumentModel( "", AnalysisResult.builder() .constantDefinitions( Map.of( "expected1", List.of( new Location( "uri", new Range(new Position(0, 1), new Position(1, 2))), new Location( "uri2", new Range(new Position(3, 4), new Position(5, 6)))), "expected2", List.of())) .constantUsages( Map.of( "non-expected", List.of( new Location( "uri", new Range(new Position(0, 1), new Position(1, 2)))))) .build())), Set.of("expected2", "expected1")); }
@Nonnull @Override public Collection<String> getCompletionSource(MyDocumentModel document) { return ofNullable(document) .map(MyDocumentModel::getAnalysisResult) .map(AnalysisResult::getConstants) .orElse(Set.of()); }
ConstantCompletion implements Completion { @Nonnull @Override public Collection<String> getCompletionSource(MyDocumentModel document) { return ofNullable(document) .map(MyDocumentModel::getAnalysisResult) .map(AnalysisResult::getConstants) .orElse(Set.of()); } }
ConstantCompletion implements Completion { @Nonnull @Override public Collection<String> getCompletionSource(MyDocumentModel document) { return ofNullable(document) .map(MyDocumentModel::getAnalysisResult) .map(AnalysisResult::getConstants) .orElse(Set.of()); }  }
ConstantCompletion implements Completion { @Nonnull @Override public Collection<String> getCompletionSource(MyDocumentModel document) { return ofNullable(document) .map(MyDocumentModel::getAnalysisResult) .map(AnalysisResult::getConstants) .orElse(Set.of()); }  @Nonnull @Override Collection<String> getCompletionSource(MyDocumentModel document); @Nonnull @Override String getSortOrderPrefix(); @Nonnull @Override CompletionItemKind getKind(); }
ConstantCompletion implements Completion { @Nonnull @Override public Collection<String> getCompletionSource(MyDocumentModel document) { return ofNullable(document) .map(MyDocumentModel::getAnalysisResult) .map(AnalysisResult::getConstants) .orElse(Set.of()); }  @Nonnull @Override Collection<String> getCompletionSource(MyDocumentModel document); @Nonnull @Override String getSortOrderPrefix(); @Nonnull @Override CompletionItemKind getKind();  }