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
Michail Plushnikov
committed
Apr 17, 2016
1 parent
856fab9
commit 34b038c
Showing
2 changed files
with
86 additions
and
12 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
75 changes: 75 additions & 0 deletions
75
src/test/java/de/plushnikov/intellij/plugin/LombokPluginProjectValidatorComponentTest.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,75 @@ | |||
package de.plushnikov.intellij.plugin; | |||
|
|||
import com.intellij.openapi.roots.OrderEntry; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
|
|||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertNull; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
|
|||
public class LombokPluginProjectValidatorComponentTest { | |||
|
|||
private LombokPluginProjectValidatorComponent component; | |||
private OrderEntry orderEntry; | |||
|
|||
@Before | |||
public void setUp() throws Exception { | |||
component = new LombokPluginProjectValidatorComponent(null); | |||
orderEntry = mock(OrderEntry.class); | |||
} | |||
|
|||
@Test | |||
public void parseLombokVersionFromGradle() throws Exception { | |||
when(orderEntry.getPresentableName()).thenReturn("Gradle: org.projectlombok:lombok:1.16.8"); | |||
assertEquals("1.16.8", component.parseLombokVersion(orderEntry)); | |||
} | |||
|
|||
@Test | |||
public void parseLombokVersionFromMaven() throws Exception { | |||
when(orderEntry.getPresentableName()).thenReturn("Maven: org.projectlombok:lombok:1.16.6"); | |||
assertEquals("1.16.6", component.parseLombokVersion(orderEntry)); | |||
} | |||
|
|||
@Test | |||
public void parseLombokVersionFromUnknown() throws Exception { | |||
when(orderEntry.getPresentableName()).thenReturn("lombok"); | |||
assertNull(component.parseLombokVersion(orderEntry)); | |||
} | |||
|
|||
@Test | |||
public void compareVersionString1_2() throws Exception { | |||
assertEquals(-1, component.compareVersionString("1", "2")); | |||
} | |||
|
|||
@Test | |||
public void compareVersionString__2() throws Exception { | |||
assertEquals(-1, component.compareVersionString("", "2")); | |||
} | |||
|
|||
@Test | |||
public void compareVersionString123_121() throws Exception { | |||
assertEquals(1, component.compareVersionString("1.2.3", "1.2.1")); | |||
} | |||
|
|||
@Test | |||
public void compareVersionString1166_1168() throws Exception { | |||
assertEquals(-1, component.compareVersionString("1.16.6", "1.16.8")); | |||
} | |||
|
|||
@Test | |||
public void compareVersionString1168_1168() throws Exception { | |||
assertEquals(0, component.compareVersionString("1.16.8", "1.16.8")); | |||
} | |||
|
|||
@Test | |||
public void compareVersionString0102_1168() throws Exception { | |||
assertEquals(-1, component.compareVersionString("0.10.2", "1.16.8")); | |||
} | |||
|
|||
@Test | |||
public void compareVersionString1169_1168() throws Exception { | |||
assertEquals(1, component.compareVersionString("1.16.9", "1.16.8")); | |||
} | |||
} |