Skip to content

Sample Solution for WS of Unit Testing 2

Martin Kropp requested to merge unitTesting2 into develop

To be able to raise discussion about possible solutions, I created this merge request

  • fixed bug in the constructor

    thanks to the additional boundary tests, we found another bug in the constructor

  • add a test for Person constructor with invalid boundary values for its name.

  • clean up redundant empty string test

    and rename test method to null test

  • add boundary value test for zip code

    using parameterized tests is very handy for this

  • rename test method to a more meaningful name

  • add person test with invalid zip boundary values

    using parameterized test for bulk data

  • removed redundant test

  • add person test with valid birthdate boundary values

    for custom types we can use MethodSource concept to generat the required bulk test data

  • add person test with invalid bithdate boundary values

    using MethodSource to create birthdate objects. Note: null is also an invalid type, buit cannot be passed as an argument with the Argument Stream. So we use the @NullSource annotation to pass also null as an invalid data for the test.

  • remove redundant invalid birthdate test

    this test is now covered with the parameterized test.

Merge request reports