Closed hienkwan closed 10 months ago
I'm contemplating about establishing a well-defined testing structure for Strings,
- For test data : We can use a string randomizer to output a random string with a defined rule (blank, contains [aA-Zz] and [0-9] and [any special char], or contains only the defined characters we input ( only spaces , etc ), a partial-buildable string value might be necessary.
- For code structure: I'm considering on this template:
@Test public void testDummy() { int length = 10; boolean useLetters = true; boolean useNumbers = false; String generatedString = RandomStringUtils.random(length, useLetters, useNumbers); final Function<String, Boolean> testNoneBlank = StringUtils::isNoneBlank; assertTrue(testNoneBlank.apply(generatedString)); }
RandomStringUtils
is imported from apache-commons-langI'm planning on BaseTest.java, TestCase.java classes as well.
sth like : https://examples.javacodegeeks.com/java-development/core-java/junit/junit-setup-teardown-example/ to be more readable and maintainable
We can make use of this, and better serve for other string-related method testing. What's your suggestion?
I'm contemplating about establishing a well-defined testing structure for Strings,
- For test data : We can use a string randomizer to output a random string with a defined rule (blank, contains [aA-Zz] and [0-9] and [any special char], or contains only the defined characters we input ( only spaces , etc ), a partial-buildable string value might be necessary.
- For code structure: I'm considering on this template:
@Test public void testDummy() { int length = 10; boolean useLetters = true; boolean useNumbers = false; String generatedString = RandomStringUtils.random(length, useLetters, useNumbers); final Function<String, Boolean> testNoneBlank = StringUtils::isNoneBlank; assertTrue(testNoneBlank.apply(generatedString)); }
RandomStringUtils
is imported from apache-commons-langI'm planning on BaseTest.java, TestCase.java classes as well.
sth like : https://examples.javacodegeeks.com/java-development/core-java/junit/junit-setup-teardown-example/ to be more readable and maintainable
We can make use of this, and better serve for other string-related method testing. What's your suggestion?
It's good for me. So let's follow your suggestion
@hienkwan , please find and review the latest commit hash that addressed what we'd previously discussed in this PR. Thank you for your time.
This PR for adding unit test for isNoneBlank method in stringUtils
Participant : @trgpnt