Skip to content
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
be76674
#4585 fix errors
uchitsa Sep 25, 2025
d45aa84
#4585 fix errors
uchitsa Sep 25, 2025
3af3cab
#4585 fix errors
uchitsa Sep 25, 2025
2b0c091
#4585 fix errors
uchitsa Sep 25, 2025
ed011a3
#4585 fix errors
uchitsa Sep 26, 2025
253852f
#4585 fix errors
uchitsa Sep 26, 2025
9f6dd55
#4585 fix errors
uchitsa Sep 26, 2025
2c35d34
#4585 fix errors
uchitsa Sep 26, 2025
a5bda47
#4585 fix errors
uchitsa Sep 26, 2025
dfdaf14
#4585 fix errors
uchitsa Sep 26, 2025
c5cf5a7
#4585 fix errors
uchitsa Sep 26, 2025
21197db
#4585 fix errors
uchitsa Sep 26, 2025
a7fc317
#4585 fix errors
uchitsa Sep 26, 2025
853bb12
#4585 fix errors
uchitsa Sep 27, 2025
7d1739b
#4585 fix errors
uchitsa Sep 27, 2025
82746fc
#4585 fix errors
uchitsa Sep 27, 2025
d8db084
#4585 fix errors
uchitsa Sep 27, 2025
3d73b20
#4585 fix errors
uchitsa Sep 27, 2025
52e0ded
Merge remote-tracking branch 'origin/master' into 4182-2
uchitsa Sep 29, 2025
6137927
#4182 fix qulice warnings
uchitsa Sep 29, 2025
313e70c
#4182 fix qulice warnings
uchitsa Sep 29, 2025
1309cb9
#4182 fix qulice warnings
uchitsa Sep 29, 2025
a8b1d94
#4182 fix qulice warnings
uchitsa Sep 29, 2025
2ae64f0
#4182 fix qulice warnings
uchitsa Sep 29, 2025
72d1770
#4182 fix qulice warnings
uchitsa Sep 29, 2025
34da808
#4182 fix qulice warnings
uchitsa Sep 29, 2025
1a4e975
#4182 fix qulice warnings
uchitsa Sep 29, 2025
b6e281d
#4182 Update ChTextTest.java
uchitsa Oct 1, 2025
77aa5b5
#4182 fix qulice warnings
uchitsa Oct 1, 2025
514a2ab
#4182 fix qulice warnings
uchitsa Oct 1, 2025
3a936f6
#4182 fix qulice warnings
uchitsa Oct 1, 2025
b15f5bc
Merge remote-tracking branch 'origin/master' into 4182-2
uchitsa Oct 2, 2025
8742ded
#4182 fix qulice warnings
uchitsa Oct 2, 2025
0cbffee
#4182 fix qulice warnings
uchitsa Oct 2, 2025
b9cf032
#4182 fix qulice warnings
uchitsa Oct 2, 2025
a925fe8
#4182 fix qulice warnings
uchitsa Oct 2, 2025
0539583
#4182 fix qulice warnings
uchitsa Oct 2, 2025
9df86ff
#4182 fix qulice warnings
uchitsa Oct 2, 2025
31c0af3
Merge branch 'objectionary:master' into 4182-2
uchitsa Oct 6, 2025
428a022
Revert "#4585 fix errors"
uchitsa Oct 6, 2025
3da605e
Revert "#4182 fix qulice warnings"
uchitsa Oct 6, 2025
aafff06
Merge branch 'objectionary:master' into 4182-2
uchitsa Oct 12, 2025
e4d4cd5
Merge branch 'objectionary:master' into 4182-2
uchitsa Oct 15, 2025
846cc1e
Merge remote-tracking branch 'origin/4182-2' into 4182-2
uchitsa Oct 15, 2025
0047120
#4182 fix errors
uchitsa Oct 15, 2025
26d2e84
#4182 fix tests
uchitsa Oct 15, 2025
a4e6801
#4182 Update MjPullTest.java
uchitsa Oct 16, 2025
c0f5440
#4182 Update OyIndexedTest.java
uchitsa Oct 16, 2025
6e691a2
Merge remote-tracking branch 'origin/master' into 4182-2
uchitsa Oct 16, 2025
7bd066d
Merge branch 'objectionary:master' into 4182-2
uchitsa Oct 17, 2025
6bf5b1f
Merge branch 'objectionary:master' into 4182-2
uchitsa Oct 20, 2025
12dea2e
Merge branch 'objectionary:master' into 4182-2
uchitsa Oct 22, 2025
3aecf33
Merge branch 'master' into 4182-2
uchitsa Oct 23, 2025
60a51c2
Merge branch 'objectionary:master' into 4182-2
uchitsa Oct 28, 2025
9501c6f
#4182 fix qulice warnings
uchitsa Oct 28, 2025
d357f34
#4182 fix
uchitsa Oct 28, 2025
1c23d33
#4182 fix
uchitsa Oct 28, 2025
320b65e
#4182 fix
uchitsa Oct 28, 2025
3a2cf03
#4182 version jtcop up to 1.4.1
uchitsa Oct 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 45 additions & 49 deletions eo-maven-plugin/src/test/java/org/eolang/maven/FpDefaultTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,13 @@
@SuppressWarnings("PMD.TooManyMethods")
@ExtendWith(MktmpResolver.class)
final class FpDefaultTest {
/**
* Lambda content.
*/
private static final String LAMBDA_CONTENT = "Footprint content";

/**
* Target content.
*/
private static final String TARGET_CONTENT = "Target content";

/**
* Cache content.
*/
private static final String CACHE_CONTENT = "Cache content";

/**
* Snapshot.
*/
private static final String SNAPSHOT = "SNAPSHOT";

@Test
void failsIfSourcePathNotExists() {
Assertions.assertThrows(
IllegalStateException.class,
() -> new FpDefault(
src -> FpDefaultTest.LAMBDA_CONTENT,
src -> this.footprintContent(),
Paths.get(""),
"",
"",
Expand All @@ -66,7 +47,7 @@ void doesNothingWhenTargetIsOlderThanSource(@Mktmp final Path temp) throws Excep
final Path target = FpDefaultTest.existedTarget(temp);
FpDefaultTest.makeOlder(target);
final Path result = new FpDefault(
src -> FpDefaultTest.LAMBDA_CONTENT,
src -> this.footprintContent(),
temp,
"1.2.3",
"abcdef",
Expand All @@ -80,7 +61,7 @@ void doesNothingWhenTargetIsOlderThanSource(@Mktmp final Path temp) throws Excep
MatcherAssert.assertThat(
"The content of target file has not to be changed",
new TextOf(target).asString(),
Matchers.equalTo(FpDefaultTest.TARGET_CONTENT)
Matchers.equalTo("Target content")
);
}

Expand All @@ -92,20 +73,20 @@ void updatesOnlyTargetFromSourceIfNoTargetAndCacheIsNotCacheable(
final Path target = FpDefaultTest.notExistedTarget(temp);
assert Files.notExists(target);
new FpDefault(
src -> FpDefaultTest.LAMBDA_CONTENT,
src -> this.footprintContent(),
temp,
FpDefaultTest.SNAPSHOT,
"SNAPSHOT",
"",
Paths.get("cache1.txt")
).apply(source, target);
MatcherAssert.assertThat(
"Target file must be updated from content function, but it didn't",
new TextOf(target).asString(),
Matchers.equalTo(FpDefaultTest.LAMBDA_CONTENT)
Matchers.equalTo(this.footprintContent())
);
MatcherAssert.assertThat(
"Cache file has not to be updated",
temp.resolve(FpDefaultTest.SNAPSHOT).resolve("cache.txt").toFile().exists(),
temp.resolve("SNAPSHOT").resolve("cache.txt").toFile().exists(),
Matchers.equalTo(false)
);
}
Expand All @@ -118,20 +99,20 @@ void updatesOnlyTargetFromSourceIfYoungerTargetAndCacheIsNotCacheable(
final Path target = FpDefaultTest.existedTarget(temp);
FpDefaultTest.makeOlder(source);
new FpDefault(
src -> FpDefaultTest.LAMBDA_CONTENT,
src -> this.footprintContent(),
temp,
FpDefaultTest.SNAPSHOT,
"SNAPSHOT",
"",
Paths.get("cache2.txt")
).apply(source, target);
MatcherAssert.assertThat(
"Target file must be updated from content function, but it didn't",
new TextOf(target).asString(),
Matchers.equalTo(FpDefaultTest.LAMBDA_CONTENT)
Matchers.equalTo(this.footprintContent())
);
MatcherAssert.assertThat(
"Cache file has not to be updated",
temp.resolve(FpDefaultTest.SNAPSHOT).resolve("cache.txt").toFile().exists(),
temp.resolve("SNAPSHOT").resolve("cache.txt").toFile().exists(),
Matchers.equalTo(false)
);
}
Expand All @@ -149,12 +130,12 @@ void updatesBothIfTargetYoungerAndNotExistedCacheableCache(
MatcherAssert.assertThat(
"Target content must be updated from lambda, but it didn't",
new TextOf(target).asString(),
Matchers.equalTo(FpDefaultTest.LAMBDA_CONTENT)
Matchers.equalTo(this.footprintContent())
);
MatcherAssert.assertThat(
"Cache content must be updated from lambda, but it didn't",
new TextOf(cache.path()).asString(),
Matchers.equalTo(FpDefaultTest.LAMBDA_CONTENT)
Matchers.equalTo(this.footprintContent())
);
}

Expand All @@ -168,12 +149,12 @@ void updatesBothNoTargetAndNotExistedCacheableCache(@Mktmp final Path temp) thro
MatcherAssert.assertThat(
"Target content must be updated from lambda, but it didn't",
new TextOf(target).asString(),
Matchers.equalTo(FpDefaultTest.LAMBDA_CONTENT)
Matchers.equalTo(this.footprintContent())
);
MatcherAssert.assertThat(
"Cache content must be updated from lambda, but it didn't",
new TextOf(cache.path()).asString(),
Matchers.equalTo(FpDefaultTest.LAMBDA_CONTENT)
Matchers.equalTo(this.footprintContent())
);
}

Expand All @@ -190,12 +171,12 @@ void updatesBothIfTargetYoungerAndExistedCacheableCacheIsYounger(
MatcherAssert.assertThat(
"Target content must be updated from lambda, but it didn't",
new TextOf(target).asString(),
Matchers.equalTo(FpDefaultTest.LAMBDA_CONTENT)
Matchers.equalTo(this.footprintContent())
);
MatcherAssert.assertThat(
"Cache content must be updated from lambda, but it didn't",
new TextOf(cache.path()).asString(),
Matchers.equalTo(FpDefaultTest.LAMBDA_CONTENT)
Matchers.equalTo(this.footprintContent())
);
}

Expand All @@ -212,12 +193,12 @@ void updatesBothIfNoTargetAndExistedCacheableCacheIsYounger(
MatcherAssert.assertThat(
"Target content must be updated from lambda, but it didn't",
new TextOf(target).asString(),
Matchers.equalTo(FpDefaultTest.LAMBDA_CONTENT)
Matchers.equalTo(this.footprintContent())
);
MatcherAssert.assertThat(
"Cache content must be updated from lambda, but it didn't",
new TextOf(cache.path()).asString(),
Matchers.equalTo(FpDefaultTest.LAMBDA_CONTENT)
Matchers.equalTo(this.footprintContent())
);
}

Expand All @@ -234,12 +215,12 @@ void copiesFromCacheIfTargetYoungerAndExistedCacheableCacheOlder(
MatcherAssert.assertThat(
"Target content must be updated from cache, but it didn't",
new TextOf(target).asString(),
Matchers.equalTo(FpDefaultTest.CACHE_CONTENT)
Matchers.equalTo(this.cacheContent())
);
MatcherAssert.assertThat(
"Cache content must not be changed, but it did",
new TextOf(cache.path()).asString(),
Matchers.equalTo(FpDefaultTest.CACHE_CONTENT)
Matchers.equalTo(this.cacheContent())
);
}

Expand All @@ -257,12 +238,12 @@ void copiesFromCacheIfNoTaretAndExistedCacheableCacheOlder(
MatcherAssert.assertThat(
"Target content must be updated from cache, but it didn't",
new TextOf(target).asString(),
Matchers.equalTo(FpDefaultTest.CACHE_CONTENT)
Matchers.equalTo(this.cacheContent())
);
MatcherAssert.assertThat(
"Cache content must not be changed, but it did",
new TextOf(cache.path()).asString(),
Matchers.equalTo(FpDefaultTest.CACHE_CONTENT)
Matchers.equalTo(this.cacheContent())
);
}

Expand All @@ -275,7 +256,7 @@ void skipsCacheIfItIsNotEnabled(@Mktmp final Path temp) throws Exception {
FpDefaultTest.makeOlder(source);
FpDefaultTest.makeOlder(cache.path(), 100_000);
new FpDefault(
src -> FpDefaultTest.LAMBDA_CONTENT,
src -> this.footprintContent(),
cache.base,
cache.semver,
() -> cache.hash,
Expand All @@ -286,8 +267,8 @@ void skipsCacheIfItIsNotEnabled(@Mktmp final Path temp) throws Exception {
"Global cache must be skipped because of the boolean flag",
new TextOf(target).asString(),
Matchers.allOf(
Matchers.equalTo(FpDefaultTest.LAMBDA_CONTENT),
Matchers.not(Matchers.equalTo(FpDefaultTest.CACHE_CONTENT))
Matchers.equalTo(this.footprintContent()),
Matchers.not(Matchers.equalTo(this.cacheContent()))
)
);
}
Expand All @@ -300,7 +281,7 @@ void throwsNpeIfHashIsNull(@Mktmp final Path temp) throws IOException {
Assertions.assertThrows(
NullPointerException.class,
() -> new FpDefault(
src1 -> FpDefaultTest.LAMBDA_CONTENT,
src1 -> this.footprintContent(),
cache.base,
cache.semver,
null,
Expand All @@ -310,6 +291,20 @@ void throwsNpeIfHashIsNull(@Mktmp final Path temp) throws IOException {
);
}

/**
* Returns the cache content.
*/
private String cacheContent() {
return "Cache content";
}

/**
* Returns the footprint content.
*/
private String footprintContent() {
return "Footprint content";
}

/**
* Apply default footprint.
* @param cache Cache
Expand All @@ -320,8 +315,9 @@ void throwsNpeIfHashIsNull(@Mktmp final Path temp) throws IOException {
private static void defaultFootprint(
final Cache cache, final Path source, final Path target
) throws Exception {
final String footprint = "Footprint content";
new FpDefault(
src -> FpDefaultTest.LAMBDA_CONTENT,
src -> footprint,
cache.base,
cache.semver,
cache.hash,
Expand Down Expand Up @@ -368,7 +364,7 @@ private static Path notExistedSource(final Path temp) {
*/
private static Path existedTarget(final Path temp) throws IOException {
final Path source = FpDefaultTest.notExistedTarget(temp);
return FpDefaultTest.existedFile(source, FpDefaultTest.TARGET_CONTENT);
return FpDefaultTest.existedFile(source, "Target content");
}

/**
Expand Down Expand Up @@ -410,7 +406,7 @@ private static void makeOlder(final Path file, final long time) throws IOExcepti
*/
private static Cache existedCache(final Path temp) throws IOException {
final Cache cache = FpDefaultTest.notExistedCache(temp);
FpDefaultTest.existedFile(cache.path(), FpDefaultTest.CACHE_CONTENT);
FpDefaultTest.existedFile(cache.path(), "Cache content");
return cache;
}

Expand Down
Loading
Loading