Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Adds documentation and extra test cases to Lithuanian LicensePlate
Browse files Browse the repository at this point in the history
  • Loading branch information
vanherpen committed Jul 18, 2019
1 parent 6dab221 commit a53f898
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
package net.contargo.types.truck;

/**
* Can handle Lithuanian {@link LicensePlate}s.
*
* <p>Examples of Lithuanian license plates:</p>
*
* <ul>
* <li>KRK 365</li>
* <li>DFZ 289</li>
* </ul>
*
* <p>For more more information: <a href="https://en.wikipedia.org/wiki/Vehicle_registration_plates_of_Lithuania" ></a>
* </p>
*
* <p>Lithiuania also allows so called vanity plates. Those are not correctly validated, as they don't follow the
* structure of a normal license plate.</p>
*
* @author Marius van Herpen - [email protected]
*/
public class LithuanianLicensePlateHandler implements LicensePlateHandler {
Expand Down Expand Up @@ -35,7 +50,6 @@ public String normalize(String value) {
*
* @return {@code true} if the given {@link LicensePlate} is valid, else {@code false}
*/

@Override
public boolean validate(String value) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public void ensureLicensePlateIsNormalizedCorrectly() {
assertIsNormalizedFromTo.accept("abc-123", "ABC 123");
assertIsNormalizedFromTo.accept("abc 123", "ABC 123");
assertIsNormalizedFromTo.accept("abc--123", "ABC 123");
assertIsNormalizedFromTo.accept("abc123", "ABC 123");
}


Expand All @@ -34,6 +35,7 @@ public void assertCorrectlyGroupedIsValid() {

assertIsValid.accept("ABC 123");
assertIsValid.accept("KRK 365");
assertIsValid.accept("JKS645");
}


Expand All @@ -46,5 +48,8 @@ public void assertIncorrectGroupsInvalid() {
assertIsNotValid.accept("JKR 65");
assertIsNotValid.accept("JKR 6435");
assertIsNotValid.accept("JK 645");
assertIsNotValid.accept("JKST 645");
assertIsNotValid.accept("JH-TL-05");
assertIsNotValid.accept("JHTL505");
}
}

0 comments on commit a53f898

Please sign in to comment.