File tree Expand file tree Collapse file tree 5 files changed +9
-21
lines changed
java/lsp/src/test/java/com/itsaky/androidide/lsp/java
testing/lspTest/src/main/java/com/itsaky/androidide/lsp/testing
main/java/com/itsaky/androidide/utils
test/java/com/itsaky/androidide/utils
xml/lsp/src/test/java/com/itsaky/androidide/lsp/xml Expand file tree Collapse file tree 5 files changed +9
-21
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ import org.junit.Ignore
2626
2727/* * @author Akash Yadav */
2828@Ignore(" Base singleton class" )
29- object JavaLSPTest : LSPTest() {
29+ object JavaLSPTest : LSPTest(" java " ) {
3030
3131 val server by lazy {
3232 ILanguageServerRegistry .getDefault().getServer(JavaLanguageServer .SERVER_ID )
Original file line number Diff line number Diff line change @@ -63,7 +63,9 @@ import java.nio.file.Path
6363 */
6464@RunWith(RobolectricTestRunner ::class )
6565@Config(manifest = Config .DEFAULT_VALUE_STRING )
66- abstract class LSPTest {
66+ abstract class LSPTest (
67+ private val sourceFileExt : String ,
68+ ) {
6769
6870 protected lateinit var toolingServer: IToolingApiServer
6971 protected lateinit var toolingProject: IProject
@@ -162,7 +164,7 @@ abstract class LSPTest {
162164 }
163165
164166 open fun openFile (fileName : String ) {
165- file = FileProvider .sourceFile(fileName).normalize()
167+ file = FileProvider .sourceFile(fileName, sourceFileExt ).normalize()
166168 contents = FileProvider .contents(file!! )
167169
168170 dispatchEvent(DocumentOpenEvent (file!! , contents.toString(), 0 ))
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ class FileProvider {
9393 * @return The path to the file.
9494 */
9595 @JvmStatic
96- fun sourceFile (name : String ): Path {
96+ fun sourceFile (name : String , extension : String = "" ): Path {
9797 return resources().resolve(" ${name} _template.$extension " ).normalize()
9898 }
9999
Original file line number Diff line number Diff line change @@ -26,29 +26,15 @@ class FileProviderTest {
2626
2727 @Test
2828 fun testPath () {
29- val path = FileProvider .sourceFile(" SourceFileTest" )
29+ val path = FileProvider .sourceFile(" SourceFileTest" , " java " )
3030 assertThat(Files .exists(path)).isTrue()
3131 assertThat(path.fileName.toString()).isEqualTo(" SourceFileTest_template.java" )
3232 }
3333
3434 @Test
3535 fun testNested () {
36- val path = FileProvider .sourceFile(" package/SourceFileTest" )
36+ val path = FileProvider .sourceFile(" package/SourceFileTest" , " java " )
3737 assertThat(Files .exists(path)).isTrue()
3838 assertThat(path.fileName.toString()).isEqualTo(" SourceFileTest_template.java" )
3939 }
40-
41- @Test
42- fun testExtension () {
43- val folder = File (" ." ).canonicalFile
44-
45- assertThat(FileProvider .extension).isNotEmpty()
46- assertThat(FileProvider .extension)
47- .isEqualTo(
48- when (folder.name) {
49- " xml" -> " xml"
50- else -> " java"
51- }
52- )
53- }
5440}
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ import org.junit.Ignore
2929
3030/* * @author Akash Yadav */
3131@Ignore(" Base class for XML tests" )
32- object XMLLSPTest : LSPTest() {
32+ object XMLLSPTest : LSPTest(" xml " ) {
3333
3434 @Before
3535 override fun initProjectIfNeeded () {
You can’t perform that action at this time.
0 commit comments