-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error if only one of the two Parchment mapping versions is set
- Loading branch information
Showing
2 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/test/java/net/neoforged/moddevgradle/dsl/ParchmentTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package net.neoforged.moddevgradle.dsl; | ||
|
||
import org.gradle.api.Project; | ||
import org.gradle.testfixtures.ProjectBuilder; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
|
||
class ParchmentTest { | ||
Project project; | ||
Parchment parchment; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
project = ProjectBuilder.builder().build(); | ||
parchment = project.getObjects().newInstance(Parchment.class, project); | ||
} | ||
|
||
@Test | ||
void testNothingSetMeansNoArtifactAndNoError() { | ||
assertFalse(parchment.getParchmentArtifact().isPresent()); | ||
assertFalse(parchment.getEnabled().get()); | ||
} | ||
|
||
@Test | ||
void testSettingOnlyMinecraftVersionCausesError() { | ||
parchment.getMinecraftVersion().set("1.2.3"); | ||
assertThatThrownBy(() -> parchment.getParchmentArtifact().isPresent()) | ||
.hasRootCauseMessage("If you set neoForge.parchment.minecraftVersion, you also must set mappingVersion"); | ||
} | ||
|
||
@Test | ||
void testSettingOnlyMappingVersionCausesError() { | ||
parchment.getMappingsVersion().set("1.2.3"); | ||
assertThatThrownBy(() -> parchment.getParchmentArtifact().isPresent()) | ||
.hasRootCauseMessage("If you set neoForge.parchment.mappingVersion, you also must set minecraftVersion"); | ||
} | ||
|
||
@Test | ||
void testSettingBothMinecraftVersionAndMappingVersionResultsInArtifact() { | ||
parchment.getMappingsVersion().set("1.2.3"); | ||
parchment.getMinecraftVersion().set("2.3.4"); | ||
assertEquals("org.parchmentmc.data:parchment-2.3.4:1.2.3@zip", parchment.getParchmentArtifact().get()); | ||
} | ||
} |