Skip to content

Commit

Permalink
compare TextOf using asString, remove redundant twice toFile call
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemGet committed Jan 10, 2025
1 parent 6137461 commit 48a7985
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions eo-maven-plugin/src/test/java/org/eolang/maven/PhiMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.yegor256.MktmpResolver;
import com.yegor256.WeAreOnline;
import com.yegor256.farea.Farea;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.FileTime;
Expand Down Expand Up @@ -262,8 +263,8 @@ void usesCache(
.execute(new FakeMaven.Phi())
.result()
.get("target/phi/foo/x/main.phi")
),
Matchers.equalTo(new TextOf(Files.readString(cached)))
).asString(),
Matchers.equalTo(new TextOf(cached).asString())
);
}

Expand All @@ -275,16 +276,16 @@ void invalidatesCache(
) throws Exception {
final Path cache = temp.resolve("cache");
final String hash = "123ZaRiFcHiK321";
final Path cached = new Saved(
final File cached = new Saved(
"some invalid phi (old) from cache",
new CachePath(
cache.resolve(PhiMojo.CACHE),
FakeMaven.pluginVersion(),
hash,
Path.of("foo/x/main.phi")
).get()
).value();
final long old = cached.toFile().lastModified();
).value().toFile();
final long old = cached.lastModified();
new FakeMaven(temp)
.with("cache", cache.toFile())
.withProgram(program)
Expand All @@ -293,7 +294,7 @@ void invalidatesCache(
MatcherAssert.assertThat(
"PHI cache not invalidated",
old,
Matchers.lessThan(cached.toFile().lastModified())
Matchers.lessThan(cached.lastModified())
);
}
}

0 comments on commit 48a7985

Please sign in to comment.