summaryrefslogtreecommitdiff
path: root/src/test/java/org/javacs/FormattingTest.java
blob: 97974a4c936d9997db0bbbe5bd306d75c622344b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package org.javacs;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;

import java.util.List;
import org.javacs.lsp.DocumentFormattingParams;
import org.javacs.lsp.TextDocumentIdentifier;
import org.javacs.lsp.TextEdit;
import org.junit.Test;

public class FormattingTest {

    private static final JavaLanguageServer server = LanguageServerFixture.getJavaLanguageServer();

    private List<TextEdit> formatting(String file) {
        var uri = FindResource.uri(file);
        var params = new DocumentFormattingParams();
        params.textDocument = new TextDocumentIdentifier(uri);
        return server.formatting(params);
    }

    @Test
    public void addOverride() {
        var edits = formatting("/org/javacs/example/AddOverride.java");
        assertThat(edits, not(empty()));
    }
}