|
| 1 | +/******************************************************************************* |
| 2 | + * Copyright (c) 2024 Broadcom, Inc. |
| 3 | + * All rights reserved. This program and the accompanying materials |
| 4 | + * are made available under the terms of the Eclipse Public License v1.0 |
| 5 | + * which accompanies this distribution, and is available at |
| 6 | + * https://www.eclipse.org/legal/epl-v10.html |
| 7 | + * |
| 8 | + * Contributors: |
| 9 | + * Broadcom, Inc. - initial API and implementation |
| 10 | + *******************************************************************************/ |
| 11 | +package org.springframework.ide.vscode.boot.test; |
| 12 | + |
| 13 | + |
| 14 | +import static org.assertj.core.api.Assertions.assertThat; |
| 15 | + |
| 16 | +import java.net.URI; |
| 17 | + |
| 18 | +import org.junit.jupiter.api.Test; |
| 19 | +import org.junit.jupiter.api.extension.ExtendWith; |
| 20 | +import org.springframework.beans.factory.annotation.Autowired; |
| 21 | +import org.springframework.context.annotation.Import; |
| 22 | +import org.springframework.ide.vscode.boot.bootiful.BootLanguageServerTest; |
| 23 | +import org.springframework.ide.vscode.boot.bootiful.HoverTestConf; |
| 24 | +import org.springframework.ide.vscode.commons.languageserver.util.LanguageComputer; |
| 25 | +import org.springframework.ide.vscode.commons.util.text.LanguageId; |
| 26 | +import org.springframework.test.context.junit.jupiter.SpringExtension; |
| 27 | + |
| 28 | +@ExtendWith(SpringExtension.class) |
| 29 | +@BootLanguageServerTest |
| 30 | +@Import(HoverTestConf.class) |
| 31 | +public class LanguageComputerTest { |
| 32 | + |
| 33 | + @Autowired |
| 34 | + LanguageComputer languageComputer; |
| 35 | + |
| 36 | + @Test |
| 37 | + void jdtUri() { |
| 38 | + assertThat(languageComputer).isNotNull(); |
| 39 | + URI uri = URI.create("jdt://contents/spring-data-commons-1.11.4.RELEASE.jar/org.springframework.data.mapping.model/PropertyNameFieldNamingStrategy.class?%3Dboot13_with_mongo%2F%5C%2FUsers%5C%2Faboyko%5C%2F.m2%5C%2Frepository%5C%2Forg%5C%2Fspringframework%5C%2Fdata%5C%2Fspring-data-commons%5C%2F1.11.4.RELEASE%5C%2Fspring-data-commons-1.11.4.RELEASE.jar%3Corg.springframework.data.mapping.model%28PropertyNameFieldNamingStrategy.class"); |
| 40 | + assertThat(languageComputer.computeLanguage(uri)).isEqualTo(LanguageId.CLASS); |
| 41 | + |
| 42 | + uri = URI.create("file:///project/org.springframework.data.mapping.model/PropertyNameFieldNamingStrategy.java"); |
| 43 | + assertThat(languageComputer.computeLanguage(uri)).isEqualTo(LanguageId.JAVA); |
| 44 | + |
| 45 | + } |
| 46 | + |
| 47 | +} |
0 commit comments