Skip to content

Commit

Permalink
objectionary#2297 jtcop version up and assertThrows message resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
c71n93 committed Apr 16, 2024
1 parent af896ac commit 57fb112
Show file tree
Hide file tree
Showing 17 changed files with 44 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ void binarizesWithoutErrors(@TempDir final Path temp) throws Exception {
.withProgram(BinarizeMojoTest.SRC.resolve("twice-rust.eo"));
}
Assertions.assertDoesNotThrow(
() -> maven.execute(new FakeMaven.Binarize())
() -> maven.execute(new FakeMaven.Binarize()),
"TO ADD ASSERTION MESSAGE"
);
}

Expand All @@ -85,7 +86,8 @@ void failsWithIncorrectInsert(@TempDir final Path temp) throws IOException {
}
Assertions.assertThrows(
IllegalStateException.class,
() -> maven.execute(new FakeMaven.Binarize())
() -> maven.execute(new FakeMaven.Binarize()),
"TO ADD ASSERTION MESSAGE"
);
}

Expand Down Expand Up @@ -121,7 +123,8 @@ void savesToCache(@TempDir final Path temp) throws IOException {
)
);
Assertions.assertDoesNotThrow(
() -> maven.execute(new FakeMaven.Binarize())
() -> maven.execute(new FakeMaven.Binarize()),
"TO ADD ASSERTION MESSAGE"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ void failsOnTimeout(@TempDir final Path temp) {
() -> new FakeMaven(temp)
.withHelloWorld()
.with("timeout", 0)
.execute(InfiniteMojo.class)
.execute(InfiniteMojo.class),
"TO ADD ASSERTION MESSAGE"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ void convertsXmirsToPhiWithoutErrors(final String xmir, @TempDir final Path temp
throws IOException {
final FakeMaven maven = new FakeMaven(temp);
new HmBase(temp).save(xmir, Paths.get("target/2-optimize/test.xmir"));
Assertions.assertDoesNotThrow(() -> maven.execute(PhiMojo.class));
Assertions.assertDoesNotThrow(
() -> maven.execute(PhiMojo.class),
"TO ADD ASSERTION MESSAGE"
);
}

@ParameterizedTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ void throwsExceptionWithTransitiveDependency(@TempDir final Path temp) {
dependency
)
)
.execute(new FakeMaven.Resolve())
.execute(new FakeMaven.Resolve()),
"TO ADD ASSERTION MESSAGE"

);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ void logsStackTrace(final Logs out, @TempDir final Path temp) {
Assertions.assertDoesNotThrow(
() -> new FakeMaven(temp)
.withProgram("something > is definitely wrong here")
.execute(new FakeMaven.Parse())
.execute(new FakeMaven.Parse()),
"TO ADD ASSERTION MESSAGE"
);
MatcherAssert.assertThat(
"TO ADD ASSERTION MESSAGE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ void throwsExpectionIfWasNotVerified(
.execute(ParseMojo.class)
.execute(OptimizeMojo.class)
.execute(ShakeMojo.class)
.execute(TranspileMojo.class)
.execute(TranspileMojo.class),
"TO ADD ASSERTION MESSAGE"
);
Assertions.assertTrue(
out.captured().stream().anyMatch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ void failsOptimizationOnCritical(@TempDir final Path temp) {
" TRUE > x",
" FALSE > x"
).with("trackOptimizationSteps", true)
.execute(new FakeMaven.Verify())
.execute(new FakeMaven.Verify()),
"TO ADD ASSERTION MESSAGE"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ void failsIfHasTransitiveDependencies() {
() -> new DcsEachWithoutTransitive(
new DcsFake(),
dep -> new DcsFake(100)
).iterator().next()
).iterator().next(),
"TO ADD ASSERTION MESSAGE"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ void cutsHashCorrectly(final String input, final String output) {
void throwsExceptionIfEmpty() {
Assertions.assertThrows(
IllegalArgumentException.class,
() -> new ChNarrow(new CommitHash.ChConstant("")).value()
() -> new ChNarrow(new CommitHash.ChConstant("")).value(),
"TO ADD ASSERTION MESSAGE"
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ void getsCommitHashOldTag() {
void throwsCommitHashException() {
Assertions.assertThrows(
ChText.NotFound.class,
() -> new ChRemote("nonsense").value()
() -> new ChRemote("nonsense").value(),
"TO ADD ASSERTION MESSAGE"
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ void readsHashByNonExistedTag() {
() -> new ChText(
() -> "434868a411b9741fdd4f8a38a5c576e8733345c9 gh-pages",
"non-existent-tag"
).value()
).value(),
"TO ADD ASSERTION MESSAGE"
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ void putsObjectToLocalCache(@TempDir final Path path) throws Exception {
Assertions.assertTrue(
path.resolve("pulled/master/org/example/main.eo")
.toFile()
.exists()
.exists(),
"TO ADD ASSERTION MESSAGE"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ final class OyEmptyTest {
void resolvesObject() {
Assertions.assertThrows(
IOException.class,
() -> new OyEmpty().get("org.eolang.io.stdin")
() -> new OyEmpty().get("org.eolang.io.stdin"),
"TO ADD ASSERTION MESSAGE"
);
}

@Test
void checksPresenceOfObject() {
Assertions.assertThrows(
IOException.class,
() -> new OyEmpty().contains("org.eolang.io.stdin")
() -> new OyEmpty().contains("org.eolang.io.stdin"),
"TO ADD ASSERTION MESSAGE"
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ void throwsExceptionOnInvalidUrl() {
() -> new OyRemote.UrlOy(
"hts:raw.githubusercontent.com/objectionary/home/%s/objects/%s.eo",
"abcde"
).value("org.eolang.app")
).value("org.eolang.app"),
"TO ADD ASSERTION MESSAGE"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,17 @@ void loadsBytesFromExistingFile(@TempDir final Path temp) throws IOException {
void loadsFromAbsentFile(@TempDir final Path temp) {
Assertions.assertThrows(
NoSuchFileException.class,
() -> new HmBase(temp).load(Paths.get("nonexistent"))
() -> new HmBase(temp).load(Paths.get("nonexistent")),
"TO ADD ASSERTION MESSAGE"
);
}

@Test
void throwsExceptionOnAbsolute(@TempDir final Path temp) {
Assertions.assertThrows(
IllegalArgumentException.class,
() -> new HmBase(temp).exists(temp.toAbsolutePath())
() -> new HmBase(temp).exists(temp.toAbsolutePath()),
"TO ADD ASSERTION MESSAGE"
);
}
}
3 changes: 2 additions & 1 deletion eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ void parsesSuccessfully(final String code) {
new InputOf(code)
);
Assertions.assertDoesNotThrow(
syntax::parsed
syntax::parsed,
EoSyntaxTest.EMPTY_MSG
);
}

Expand Down
14 changes: 1 addition & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -388,21 +388,9 @@ SOFTWARE.
<plugin>
<groupId>com.github.volodya-lombrozo</groupId>
<artifactId>jtcop-maven-plugin</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
<configuration>
<ignoreGeneratedTests>true</ignoreGeneratedTests>
<exclusions>
<!--
@todo #2171:30min Enable RuleAssertionMessage.
This rule is disabled because lots of tests in the
project are written without assertion messages. We have
to add all messages for all assertions and then enable
that rule and remove that puzzle.
-->
<exclusion>
JTCOP.RuleAssertionMessage
</exclusion>
</exclusions>
</configuration>
<executions>
<execution>
Expand Down

0 comments on commit 57fb112

Please sign in to comment.