| | |
| | | |
| | | /** |
| | | * Once-only initialization. |
| | | * |
| | | * |
| | | * @throws Exception |
| | | * If an unexpected error occurred. |
| | | */ |
| | |
| | | |
| | | /** |
| | | * Create test strings for the {@link StaticUtils#getBytes(String)}. |
| | | * |
| | | * |
| | | * @return Returns an array of test strings. |
| | | */ |
| | | @DataProvider(name = "getBytesTestData") |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#getBytes(String)} method. |
| | | * |
| | | * |
| | | * @param inputString |
| | | * The input string. |
| | | * @throws Exception |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#getBytes(char[])} method. |
| | | * |
| | | * |
| | | * @param inputString |
| | | * The input string. |
| | | * @throws Exception |
| | |
| | | |
| | | /** |
| | | * Create test strings for the {@link StaticUtils#byteToHex(byte)}. |
| | | * |
| | | * |
| | | * @return Returns an array of test strings. |
| | | */ |
| | | @DataProvider(name = "byteToHexTestData") |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#byteToHex(byte)} method. |
| | | * |
| | | * |
| | | * @param b |
| | | * The input byte. |
| | | * @throws Exception |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#byteToLowerHex(byte)} method. |
| | | * |
| | | * |
| | | * @param b |
| | | * The input byte. |
| | | * @throws Exception |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#byteToASCII(byte)} method. |
| | | * |
| | | * |
| | | * @param b |
| | | * The input byte. |
| | | * @throws Exception |
| | |
| | | |
| | | /** |
| | | * Create test strings for the {@link StaticUtils#bytesToHex(byte[])}. |
| | | * |
| | | * |
| | | * @return Returns an array of test data. |
| | | */ |
| | | @DataProvider(name = "bytesToHexTestData") |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#bytesToHex(byte[])} method. |
| | | * |
| | | * |
| | | * @param bytes |
| | | * The input byte array. |
| | | * @param expected |
| | |
| | | /** |
| | | * Tests the {@link StaticUtils#bytesToHex(java.nio.ByteBuffer)} |
| | | * method. |
| | | * |
| | | * |
| | | * @param bytes |
| | | * The input byte array. |
| | | * @param expected |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#byteToBinary(byte)} method. |
| | | * |
| | | * |
| | | * @param b |
| | | * The input byte. |
| | | * @throws Exception |
| | |
| | | |
| | | /** |
| | | * Create test strings for the {@link StaticUtils#isDigit(char)}. |
| | | * |
| | | * |
| | | * @return Returns an array of test data. |
| | | */ |
| | | @DataProvider(name = "isDigitTestData") |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#isDigit(char)} method. |
| | | * |
| | | * |
| | | * @param c |
| | | * The test char. |
| | | * @param result |
| | |
| | | |
| | | /** |
| | | * Create test strings for the {@link StaticUtils#isAlpha(char)}. |
| | | * |
| | | * |
| | | * @return Returns an array of test data. |
| | | */ |
| | | @DataProvider(name = "isAlphaTestData") |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#isAlpha(char)} method. |
| | | * |
| | | * |
| | | * @param c |
| | | * The test char. |
| | | * @param result |
| | |
| | | |
| | | /** |
| | | * Create test strings for the {@link StaticUtils#isHexDigit(char)}. |
| | | * |
| | | * |
| | | * @return Returns an array of test data. |
| | | */ |
| | | @DataProvider(name = "isHexDigitTestData") |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#isHexDigit(char)} method. |
| | | * |
| | | * |
| | | * @param c |
| | | * The test char. |
| | | * @param result |
| | |
| | | /** |
| | | * Create invalid test strings for the |
| | | * {@link StaticUtils#hexStringToByteArray(String)}. |
| | | * |
| | | * |
| | | * @return Returns an array of test data. |
| | | */ |
| | | @DataProvider(name = "hexStringToByteArrayInvalidTestData") |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#hexStringToByteArray(String)} method. |
| | | * |
| | | * |
| | | * @param hexString |
| | | * The test string. |
| | | * @throws Exception |
| | |
| | | /** |
| | | * Create test strings for the |
| | | * {@link StaticUtils#hexStringToByteArray(String)}. |
| | | * |
| | | * |
| | | * @return Returns an array of test data. |
| | | */ |
| | | @DataProvider(name = "hexStringToByteArrayTestData") |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#hexStringToByteArray(String)} method. |
| | | * |
| | | * |
| | | * @param hexString |
| | | * The test string. |
| | | * @param bytes |
| | |
| | | /** |
| | | * Create test strings for the |
| | | * {@link StaticUtils#needsBase64Encoding(String)}. |
| | | * |
| | | * |
| | | * @return Returns an array of test data. |
| | | */ |
| | | @DataProvider(name = "needsBase64EncodingTestData") |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#needsBase64Encoding(String)} method. |
| | | * |
| | | * |
| | | * @param s |
| | | * The test string. |
| | | * @param result |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#needsBase64Encoding(byte[])} method. |
| | | * |
| | | * |
| | | * @param s |
| | | * The test string. |
| | | * @param result |
| | |
| | | /** |
| | | * Create test strings for the |
| | | * {@link StaticUtils#isRelativePath(String)}. |
| | | * |
| | | * |
| | | * @return Returns an array of test data. |
| | | */ |
| | | @DataProvider(name = "isRelativePathTestData") |
| | | public Object[][] createIsRelativePathTestData() { |
| | | return new Object[][] { { "", true }, { "/", false }, |
| | | { "/foo", false }, { "foo", true }, { "foo/bar", true }, |
| | | { "/foo/bar", false }, { ".", true }, { "..", true }, |
| | | { "/foo/.", false }, { "/foo/..", false } }; |
| | | String root = File.listRoots()[0].getPath(); |
| | | return new Object[][] { { "", true }, { root, false }, |
| | | { root + "foo", false }, { "foo", true }, |
| | | { "foo" + File.separator + "bar", true }, |
| | | { root + "foo" + File.separator + "bar", false }, |
| | | { ".", true }, { "..", true }, |
| | | { root + "foo" + File.separator + ".", false }, |
| | | { root + "foo" + File.separator + "..", false } }; |
| | | } |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#isRelativePath(String)} method. |
| | | * |
| | | * |
| | | * @param path |
| | | * The test string. |
| | | * @param result |
| | |
| | | |
| | | /** |
| | | * Create test lists for the {@link StaticUtils#listToArray(List)}. |
| | | * |
| | | * |
| | | * @return Returns an array of test data. |
| | | */ |
| | | @DataProvider(name = "listToArrayTestData") |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#listToArray(List)} method. |
| | | * |
| | | * |
| | | * @param strings |
| | | * The test string list. |
| | | * @throws Exception |
| | |
| | | /** |
| | | * Tests the {@link StaticUtils#moveFile(java.io.File, java.io.File)} |
| | | * method. |
| | | * |
| | | * |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | |
| | | /** |
| | | * Tests the {@link StaticUtils#moveFile(java.io.File, java.io.File)} |
| | | * method. |
| | | * |
| | | * |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | |
| | | /** |
| | | * Tests the {@link StaticUtils#moveFile(java.io.File, java.io.File)} |
| | | * method. |
| | | * |
| | | * |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | |
| | | /** |
| | | * Tests the {@link StaticUtils#moveFile(java.io.File, java.io.File)} |
| | | * method. |
| | | * |
| | | * |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | |
| | | |
| | | /** |
| | | * Create test content for {@link StaticUtils#moveFile(File, File)}. |
| | | * |
| | | * |
| | | * @return Returns an array of test data. |
| | | */ |
| | | @DataProvider(name = "moveFileTestData") |
| | |
| | | /** |
| | | * Tests the {@link StaticUtils#moveFile(java.io.File, java.io.File)} |
| | | * method. |
| | | * |
| | | * |
| | | * @param lines |
| | | * The test file contents. |
| | | * @throws Exception |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#recursiveDelete(File)} method. |
| | | * |
| | | * |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#recursiveDelete(File)} method. |
| | | * |
| | | * |
| | | * @throws Exception |
| | | * If the test failed unexpectedly. |
| | | */ |
| | |
| | | /** |
| | | * Create test strings for the {@link StaticUtils#toLowerCase(String)} |
| | | * related methods. |
| | | * |
| | | * |
| | | * @return Returns an array of test data. |
| | | */ |
| | | @DataProvider(name = "stringCaseConversionTestData") |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#toLowerCase(String)} method. |
| | | * |
| | | * |
| | | * @param input |
| | | * The test string. |
| | | * @param lower |
| | |
| | | * Tests the |
| | | * {@link StaticUtils#toLowerCase(byte[], StringBuilder, boolean)} |
| | | * method. |
| | | * |
| | | * |
| | | * @param input |
| | | * The test string. |
| | | * @param lower |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#toUpperCase(String)} method. |
| | | * |
| | | * |
| | | * @param input |
| | | * The test string. |
| | | * @param lower |
| | |
| | | * Tests the |
| | | * {@link StaticUtils#toUpperCase(byte[], StringBuilder, boolean)} |
| | | * method. |
| | | * |
| | | * |
| | | * @param input |
| | | * The test string. |
| | | * @param lower |
| | |
| | | * Create test strings for the |
| | | * {@link StaticUtils#toRFC3641StringValue(StringBuilder, String)} |
| | | * method. |
| | | * |
| | | * |
| | | * @return Returns an array of test data. |
| | | */ |
| | | @DataProvider(name = "toRFC3641StringValueTestData") |
| | |
| | | * Tests the |
| | | * {@link StaticUtils#toRFC3641StringValue(StringBuilder, String)} |
| | | * method. |
| | | * |
| | | * |
| | | * @param input |
| | | * The test string. |
| | | * @param expected |
| | |
| | | /** |
| | | * Create test lists for the |
| | | * {@link StaticUtils#listsAreEqual(List, List)} method. |
| | | * |
| | | * |
| | | * @return Returns an array of test data. |
| | | */ |
| | | @DataProvider(name = "listsAreEqualTestData") |
| | |
| | | |
| | | /** |
| | | * Tests the {@link StaticUtils#listsAreEqual(List, List)} method. |
| | | * |
| | | * |
| | | * @param list1 |
| | | * The first list. |
| | | * @param list2 |