Skip to content

Commit

Permalink
Switch order of literals to prevent NullPointerException
Browse files Browse the repository at this point in the history
  • Loading branch information
pixeebot authored and marcphilipp committed Oct 7, 2023
1 parent 3f8f075 commit 1301818
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static CloseablePath create(URI uri, FileSystemProvider fileSystemProvider) thro
return createForJarFileSystem(new URI(jarUri), fileSystem -> fileSystem.getPath(jarEntry),
fileSystemProvider);
}
if (uri.getScheme().equals(FILE_URI_SCHEME) && uri.getPath().endsWith(JAR_FILE_EXTENSION)) {
if (FILE_URI_SCHEME.equals(uri.getScheme()) && uri.getPath().endsWith(JAR_FILE_EXTENSION)) {
return createForJarFileSystem(new URI(JAR_URI_SCHEME + ':' + uri),
fileSystem -> fileSystem.getRootDirectories().iterator().next(), fileSystemProvider);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ final Optional<Segment> getRoot() {
* @see #forEngine(String)
*/
public final Optional<String> getEngineId() {
return getRoot().filter(segment -> segment.getType().equals(ENGINE_SEGMENT_TYPE)).map(Segment::getValue);
return getRoot().filter(segment -> ENGINE_SEGMENT_TYPE.equals(segment.getType())).map(Segment::getValue);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ private static boolean validateReservedIds(TestEngine testEngine) {
if (!engineId.startsWith("junit-")) {
return true;
}
if (engineId.equals("junit-jupiter")) {
if ("junit-jupiter".equals(engineId)) {
validateWellKnownClassName(testEngine, "org.junit.jupiter.engine.JupiterTestEngine");
return true;
}
if (engineId.equals("junit-vintage")) {
if ("junit-vintage".equals(engineId)) {
validateWellKnownClassName(testEngine, "org.junit.vintage.engine.VintageTestEngine");
return true;
}
if (engineId.equals("junit-platform-suite")) {
if ("junit-platform-suite".equals(engineId)) {
validateWellKnownClassName(testEngine, "org.junit.platform.suite.engine.SuiteTestEngine");
return true;
}
Expand Down

0 comments on commit 1301818

Please sign in to comment.