-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-Authored-By: Llewellyn Falco <[email protected]>
- Loading branch information
1 parent
47e90e4
commit ce041e3
Showing
1 changed file
with
24 additions
and
27 deletions.
There are no files selected for viewing
51 changes: 24 additions & 27 deletions
51
approvaltests-tests/src/test/java/org/approvaltests/reporters/IntelliJResolverTest.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 |
---|---|---|
@@ -1,37 +1,34 @@ | ||
package org.approvaltests.reporters; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.lambda.functions.Function1; | ||
import org.lambda.functions.Function2; | ||
import org.lambda.query.Queryable; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotEquals; | ||
|
||
class IntelliJResolverTest | ||
{ | ||
@Test | ||
void testFindItOnMac() | ||
{ | ||
String userHome = "Users/lars"; | ||
Queryable<String> validPaths = Queryable.as("/Applications/IntelliJ IDEA.app/Contents/MacOS/idea", | ||
"Users/lars/Applications/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea", | ||
"Users/lars/Applications/IntelliJ IDEA Community.app/Contents/MacOS/idea", | ||
"Users/lars/Applications/IntelliJ IDEA Community Edition.app/Contents/MacOS/idea"); | ||
for (String path : validPaths) | ||
{ | ||
DiffInfo diffInfo = IntelliJToolboxResolver.getDiffInfoMac(userHome, f -> f.equals(path)); | ||
assertNotEquals("", diffInfo.diffProgram, path); | ||
class IntelliJResolverTest { | ||
@Test | ||
void testFindItOnMac() { | ||
Queryable<String> validPaths = Queryable.as("/Applications/IntelliJ IDEA.app/Contents/MacOS/idea", | ||
"Users/lars/Applications/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea", | ||
"Users/lars/Applications/IntelliJ IDEA Community.app/Contents/MacOS/idea", | ||
"Users/lars/Applications/IntelliJ IDEA Community Edition.app/Contents/MacOS/idea"); | ||
verifyPaths(IntelliJToolboxResolver::getDiffInfoMac, "Users/lars", validPaths); | ||
} | ||
} | ||
@Test | ||
void testFindItOnLinux() | ||
{ | ||
String userHome = "/home/lars"; | ||
Queryable<String> validPaths = Queryable.as( | ||
"/home/lars/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate/bin/idea.sh", | ||
"/home/lars/.local/share/JetBrains/Toolbox/apps/intellij-idea-community-edition/bin/idea.sh"); | ||
for (String path : validPaths) | ||
{ | ||
DiffInfo diffInfo = IntelliJToolboxResolver.getDiffInfoLinux(userHome, f -> f.equals(path)); | ||
assertNotEquals("", diffInfo.diffProgram, path); | ||
|
||
private static void verifyPaths(Function2<String, Function1<String, Boolean>, DiffInfo> finder, String userHome, Queryable<String> validPaths) { | ||
for (String path : validPaths) { | ||
DiffInfo diffInfo = finder.call(userHome, f -> f.equals(path)); | ||
assertNotEquals("", diffInfo.diffProgram, path); | ||
} | ||
} | ||
|
||
@Test | ||
void testFindItOnLinux() { | ||
Queryable<String> validPaths = Queryable.as( | ||
"/home/lars/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate/bin/idea.sh", | ||
"/home/lars/.local/share/JetBrains/Toolbox/apps/intellij-idea-community-edition/bin/idea.sh"); | ||
verifyPaths(IntelliJToolboxResolver::getDiffInfoLinux, "/home/lars", validPaths); | ||
} | ||
} | ||
} |