Skip to content

Commit

Permalink
simplify assertion in test method
Browse files Browse the repository at this point in the history
  • Loading branch information
jaikiran committed Dec 20, 2024
1 parent 93c2a9f commit fd97b4d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions test/jdk/tools/jar/JarCreateFileNameTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

/*
* @test
Expand Down Expand Up @@ -61,12 +62,8 @@ void testCreate(final String targetJarFileName) throws Exception {
assertEquals(0, exitCode, "jar command failed");
// verify the JAR file is created and contains the expected entry
try (final JarFile jarFile = new JarFile(new File(targetJarFileName))) {
jarFile.stream()
.map(ZipEntry::getName)
.filter(fileName::equals)
.findFirst()
.orElseThrow(() -> new AssertionError("missing " + fileName
+ " entry in JAR file " + targetJarFileName));
final ZipEntry entry = jarFile.getEntry(fileName);
assertNotNull(entry, "missing " + fileName + " entry in JAR file " + targetJarFileName);
}
}
}
Expand Down

0 comments on commit fd97b4d

Please sign in to comment.