-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add BedrockNetwork protocolVersion option
Does not have any affect currently, but safeguards against format changes being introduced in the future.
- Loading branch information
1 parent
660abd0
commit e50b560
Showing
4 changed files
with
50 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
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
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
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,20 @@ | ||
package net.benwoodworth.knbt | ||
|
||
import com.benwoodworth.parameterize.parameterOf | ||
import net.benwoodworth.knbt.test.parameterizeTest | ||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertFailsWith | ||
|
||
class BedrockNetworkNbtTest { | ||
@Test | ||
fun negative_protocol_version_should_throw() = parameterizeTest { | ||
val protocolVersion by parameterOf(-1, Int.MIN_VALUE) | ||
|
||
val failure = assertFailsWith<IllegalArgumentException> { | ||
BedrockNetworkNbt { this.protocolVersion = protocolVersion } | ||
} | ||
|
||
assertEquals("Protocol version must be non-negative, but is $protocolVersion", failure.message) | ||
} | ||
} |