Skip to content

Commit

Permalink
Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Jan 4, 2025
1 parent d71a924 commit de997b3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ class ApplicationTest : BasePluginTest() {

val installedJar = jarPath("build/install/myapp-shadow/lib/myapp-1.0-all.jar")
assertThat(installedJar).exists()
assertThat(installedJar).containsEntries(listOf("a.properties", "a2.properties", "myapp/Main.class"))
assertThat(installedJar).containsEntries(
listOf("a.properties", "a2.properties", "myapp/Main.class"),
)
assertThat(installedJar.manifest.mainAttributes.getValue("Main-Class"))
.isEqualTo("myapp.Main")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ class RelocationTest : BasePluginTest() {
"junit/framework/TestSuite.class",
),
)

assertThat(outputShadowJar.manifest.mainAttributes.getValue("TEST-VALUE")).isEqualTo("FOO")
assertThat(outputShadowJar.manifest.mainAttributes.getValue("TEST-VALUE"))
.isEqualTo("FOO")
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ class ShadowPluginTest : BasePluginTest() {
)

run(shadowJarTask)
val outputShadowJar = jarPath("build/libs/shadow.jar")

val outputShadowJar = jarPath("build/libs/shadow.jar")
assertThat(outputShadowJar).exists()
assertThat(outputShadowJar).containsEntries(
listOf("shadow/Passed.class", "junit/framework/Test.class"),
Expand Down Expand Up @@ -283,8 +283,8 @@ class ShadowPluginTest : BasePluginTest() {
writeApiLibAndImplModules()

run(":impl:$shadowJarTask")
val implOutput = jarPath("impl/build/libs/impl-all.jar")

val implOutput = jarPath("impl/build/libs/impl-all.jar")
assertThat(implOutput).exists()
assertThat(implOutput).containsEntries(
listOf("impl/SimpleEntity.class", "api/Entity.class", "api/UnusedEntity.class", "lib/LibEntity.class"),
Expand Down Expand Up @@ -313,8 +313,8 @@ class ShadowPluginTest : BasePluginTest() {
)

run(":impl:$shadowJarTask")
val implOutput = jarPath("impl/build/libs/impl-all.jar")

val implOutput = jarPath("impl/build/libs/impl-all.jar")
assertThat(implOutput).exists()
assertThat(implOutput).containsEntries(
listOf(
Expand All @@ -335,9 +335,8 @@ class ShadowPluginTest : BasePluginTest() {
writeShadowedClientAndServerModules()

run(":server:jar")
val serverOutput = jarPath("server/build/libs/server-1.0.jar")
val clientOutput = jarPath("client/build/libs/client-all.jar")

val serverOutput = jarPath("server/build/libs/server-1.0.jar")
assertThat(serverOutput).exists()
assertThat(serverOutput).containsEntries(
listOf("server/Server.class"),
Expand All @@ -346,6 +345,7 @@ class ShadowPluginTest : BasePluginTest() {
listOf("client/Client.class", "junit/framework/Test.class", "client/junit/framework/Test.class"),
)

val clientOutput = jarPath("client/build/libs/client-all.jar")
assertThat(clientOutput).exists()
assertThat(clientOutput).containsEntries(
listOf("client/Client.class", "client/junit/framework/Test.class"),
Expand All @@ -357,7 +357,6 @@ class ShadowPluginTest : BasePluginTest() {
writeShadowedClientAndServerModules()

run(serverShadowJarTask)
val clientOutput = jarPath("client/build/libs/client-all.jar")

assertThat(outputServerShadowJar).exists()
assertThat(outputServerShadowJar).containsEntries(
Expand All @@ -366,6 +365,8 @@ class ShadowPluginTest : BasePluginTest() {
assertThat(outputServerShadowJar).doesNotContainEntries(
listOf("junit/framework/Test.class"),
)

val clientOutput = jarPath("client/build/libs/client-all.jar")
assertThat(clientOutput).exists()
assertThat(clientOutput).containsEntries(
listOf("client/Client.class", "client/junit/framework/Test.class"),
Expand Down Expand Up @@ -757,11 +758,10 @@ class ShadowPluginTest : BasePluginTest() {
)

val result = run(testShadowJarTask)
val testJar = jarPath("build/libs/shadow-1.0-tests.jar")

assertThat(result.task(":$testShadowJarTask")).isNotNull()
.transform { it.outcome }.isEqualTo(TaskOutcome.SUCCESS)

val testJar = jarPath("build/libs/shadow-1.0-tests.jar")
assertThat(testJar).exists()
assertThat(testJar.getEntry("junit")).isNotNull()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ class TransformersTest : BaseTransformerTest() {
run(shadowJarTask)

assertThat(outputShadowJar).exists()

val mf = outputShadowJar.manifest
assertThat(mf).isNotNull()
assertThat(mf.mainAttributes.getValue("Test-Entry")).isEqualTo("PASSED")
Expand Down Expand Up @@ -197,16 +196,15 @@ class TransformersTest : BaseTransformerTest() {

run("jar", shadowJarTask)

val outputJar = jarPath("build/libs/shadow-1.0.jar")
assertThat(outputJar).exists()
assertThat(outputShadowJar).exists()

val mf1 = outputShadowJar.manifest
assertThat(mf1).isNotNull()
assertThat(mf1.mainAttributes.getValue("Test-Entry")).isEqualTo("PASSED")
assertThat(mf1.mainAttributes.getValue("Main-Class")).isEqualTo("shadow.Main")
assertThat(mf1.mainAttributes.getValue("New-Entry")).isEqualTo("NEW")

val outputJar = jarPath("build/libs/shadow-1.0.jar")
assertThat(outputJar).exists()
val mf2 = outputJar.manifest
assertThat(mf2).isNotNull()
assertThat(mf2.mainAttributes.getValue("Test-Entry")).isEqualTo("FAILED")
Expand Down

0 comments on commit de997b3

Please sign in to comment.