### Question:
MyTextDocumentService implements TextDocumentService, EventObserver<RunAnalysisEvent> { @Override public void didChange(DidChangeTextDocumentParams params) { String uri = params.getTextDocument().getUri(); outlineMap.put(uri, new CompletableFuture<>()); String text = params.getContentChanges().get(0).getText(); String fileExtension = extractExtension(uri); if (fileExtension != null && isCobolFile(fileExtension)) { analyzeChanges(uri, text); } } @Inject @Builder  MyTextDocumentService(
      Communications communications,
      LanguageEngineFacade engine,
      Formations formations,
      Completions completions,
      Occurrences occurrences,
      DataBusBroker dataBus,
      CodeActions actions); @Override CompletableFuture<Either<List<CompletionItem>, CompletionList>> completion(
      CompletionParams params); @Override CompletableFuture<CompletionItem> resolveCompletionItem(CompletionItem unresolved); @Override CompletableFuture<List<? extends Location>> definition(
      TextDocumentPositionParams position); @Override CompletableFuture<List<? extends Location>> references(ReferenceParams params); @Override CompletableFuture<List<? extends DocumentHighlight>> documentHighlight(
      TextDocumentPositionParams position); @Override CompletableFuture<List<? extends TextEdit>> formatting(DocumentFormattingParams params); @Override CompletableFuture<List<Either<Command, CodeAction>>> codeAction(CodeActionParams params); @Override void didOpen(DidOpenTextDocumentParams params); @Override void didChange(DidChangeTextDocumentParams params); @Override void didClose(DidCloseTextDocumentParams params); @Override void didSave(DidSaveTextDocumentParams params); @Override void observerCallback(@Nonnull RunAnalysisEvent event); @Override CompletableFuture<List<Either<SymbolInformation, DocumentSymbol>>> documentSymbol(DocumentSymbolParams params);  }### Answer:
@Test void testDidChange() { List<TextDocumentContentChangeEvent> textEdits = new ArrayList<>(); textEdits.add(new TextDocumentContentChangeEvent(INCORRECT_TEXT_EXAMPLE)); service.didChange( new DidChangeTextDocumentParams( new VersionedTextDocumentIdentifier(DOCUMENT_URI, 0), textEdits)); UseCaseUtils.waitForDiagnostics(client); Range range = retrieveRange(client); assertRange(range); }
@Test void enableCopybooksOnDidChangeTest() { LanguageEngineFacade engine = mock(LanguageEngineFacade.class); MyTextDocumentService service = buildServiceWithMockEngine(engine); service.didChange( new DidChangeTextDocumentParams( new VersionedTextDocumentIdentifier(DOCUMENT_URI, 0), List.of(new TextDocumentContentChangeEvent(INCORRECT_TEXT_EXAMPLE)))); verify(engine, timeout(1000)).analyze(eq(DOCUMENT_URI), anyString(), eq(SKIP)); }