Package org.shredzone.acme4j.toolbox
Class AcmeUtilsTest
java.lang.Object
org.shredzone.acme4j.toolbox.AcmeUtilsTest
Unit tests for
AcmeUtils
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
setup()
void
Test base64 URL decode.void
Test base64 URL encode.void
Test base64 URL validation for invalid valuesvoid
testBase64UrlValid
(String url) Test base64 URL validation for valid valuesvoid
TestAcmeUtils.getContentType(String)
with other types.void
testGetContentTypeForJson
(String contentType) TestAcmeUtils.getContentType(String)
for JSON types.void
Test invalid strings.void
Test that locales are correctly converted to language headers.void
testParser
(String input, String expected) Test valid strings.void
Test that constructor is private.void
Test sha-256 hash and hex encode.void
Test that error prefix is correctly removed.void
Test ACE conversion.void
Test thatAcmeUtils.validateContact(java.net.URI)
refuses invalid contacts.void
Test thatAcmeUtils.writeToPem(byte[], PemLabel, Writer)
writes a correct PEM file.
-
Constructor Details
-
AcmeUtilsTest
public AcmeUtilsTest()
-
-
Method Details
-
setup
-
testPrivateConstructor
Test that constructor is private.- Throws:
Exception
-
testSha256HashHexEncode
Test sha-256 hash and hex encode. -
testBase64UrlEncode
Test base64 URL encode. -
testBase64UrlDecode
Test base64 URL decode. -
testBase64UrlValid
@ParameterizedTest @ValueSource(strings={"","Zg","Zm9v"}) public void testBase64UrlValid(String url) Test base64 URL validation for valid values -
testBase64UrlInvalid
@ParameterizedTest @ValueSource(strings={" ","Zg=","Zg=="," Zm9v ","<some>.illegal#Text"}) @NullSource public void testBase64UrlInvalid(String url) Test base64 URL validation for invalid values -
testToAce
Test ACE conversion. -
testParser
@ParameterizedTest @MethodSource("provideTimestamps") public void testParser(String input, String expected) Test valid strings. -
testInvalid
Test invalid strings. -
testLocaleToLanguageHeader
Test that locales are correctly converted to language headers. -
testStripErrorPrefix
Test that error prefix is correctly removed. -
testWriteToPem
Test thatAcmeUtils.writeToPem(byte[], PemLabel, Writer)
writes a correct PEM file. -
testGetContentTypeForJson
@ParameterizedTest @ValueSource(strings={"application/json","application/json; charset=utf-8","application/json; charset=utf-8 (Plain text)","application/json; charset=\"utf-8\"","application/json; charset=\"UTF-8\"; foo=4"," application/json ;foo=4"}) public void testGetContentTypeForJson(String contentType) TestAcmeUtils.getContentType(String)
for JSON types. -
testGetContentType
TestAcmeUtils.getContentType(String)
with other types. -
testValidateContact
Test thatAcmeUtils.validateContact(java.net.URI)
refuses invalid contacts.
-