-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
212 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...ons-lsp-extensions/src/test/java/org/springframework/ide/vscode/commons/VersionTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 VMware, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* VMware, Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.springframework.ide.vscode.commons; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class VersionTests { | ||
|
||
@Test | ||
void testVersionCalculation1() throws Exception { | ||
Version version = Version.parse("2.7.5"); | ||
assertEquals(2, version.getMajor()); | ||
assertEquals(7, version.getMinor()); | ||
assertEquals(5, version.getPatch()); | ||
assertNull(version.getQualifier()); | ||
|
||
version = Version.parse("3.0.0-SNAPSHOT"); | ||
assertEquals(3, version.getMajor()); | ||
assertEquals(0, version.getMinor()); | ||
assertEquals(0, version.getPatch()); | ||
assertEquals(version.getQualifier(), "SNAPSHOT"); | ||
|
||
|
||
version = Version.parse("2.6.14-RC2"); | ||
assertEquals(2, version.getMajor()); | ||
assertEquals(6, version.getMinor()); | ||
assertEquals(14, version.getPatch()); | ||
assertEquals(version.getQualifier(), "RC2"); | ||
} | ||
|
||
@Test | ||
void testVersionCalculation2() throws Exception { | ||
Version version = Version.parse("2.7"); | ||
assertEquals(2, version.getMajor()); | ||
assertEquals(7, version.getMinor()); | ||
assertEquals(0, version.getPatch()); | ||
assertNull(version.getQualifier()); | ||
|
||
version = Version.parse("2"); | ||
assertEquals(2, version.getMajor()); | ||
assertEquals(0, version.getMinor()); | ||
assertEquals(0, version.getPatch()); | ||
assertNull(version.getQualifier()); | ||
} | ||
|
||
|
||
} |
55 changes: 55 additions & 0 deletions
55
...ns/src/test/java/org/springframework/ide/vscode/commons/protocol/java/ClasspathTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 VMware, Inc. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* VMware, Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.springframework.ide.vscode.commons.protocol.java; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.ide.vscode.commons.Version; | ||
|
||
public class ClasspathTests { | ||
|
||
@Test | ||
void testDependencyVersionCalculation2() throws Exception { | ||
Version version = Classpath.getDependencyVersion("spring-boot-1.2.3.jar"); | ||
assertEquals(1, version.getMajor(), 1); | ||
assertEquals(2, version.getMinor(), 2); | ||
assertEquals(3, version.getPatch()); | ||
assertNull(version.getQualifier()); | ||
|
||
version = Classpath.getDependencyVersion("spring-boot-1.2.3-RELEASE.jar"); | ||
assertEquals(version.getMajor(), 1); | ||
assertEquals(version.getMinor(), 2); | ||
assertEquals(version.getPatch(), 3); | ||
assertEquals(version.getQualifier(), "RELEASE"); | ||
|
||
version = Classpath.getDependencyVersion("spring-boot-1.2.3.RELEASE.jar"); | ||
assertEquals(1, version.getMajor(), 1); | ||
assertEquals(2, version.getMinor(), 2); | ||
assertEquals(3, version.getPatch()); | ||
assertEquals("RELEASE", version.getQualifier()); | ||
|
||
version = Classpath.getDependencyVersion("spring-boot-1.2.3.BUILD-SNAPSHOT.jar"); | ||
assertEquals(1, version.getMajor(), 1); | ||
assertEquals(2, version.getMinor(), 2); | ||
assertEquals(3, version.getPatch()); | ||
assertEquals("BUILD-SNAPSHOT", version.getQualifier()); | ||
|
||
version = Classpath.getDependencyVersion("spring-boot-actuator-1.2.3.BUILD-SNAPSHOT.jar"); | ||
assertEquals(1, version.getMajor(), 1); | ||
assertEquals(2, version.getMinor(), 2); | ||
assertEquals(3, version.getPatch()); | ||
assertEquals("BUILD-SNAPSHOT", version.getQualifier()); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.