// Path: src/main/java/com/rolfje/anonimatron/synonyms/Synonym.java
// public interface Synonym {
// 
// 	/**
// 	 * Indicates if this Synonym is short-lived or transient, meaning that
//      * it should not be stored in the synonyms file. Transient Synonyms
//      * are not stored, need to be calculated each run time.
// 	 *
// 	 * Transient synonyms are:
// 	 *
// 	 * <ol>
// 	 *     <li>Not stored in memory.</li>
// 	 *     <li>Not stored in the synonym file.</li>
// 	 * </ol>
// 	 *
// 	 * @return <code>true</code> if the synonym should be thrown away
// 	 * after use (not stored in the synonym file).
// 	 */
// 	boolean isShortLived();
// 
// 	/**
// 	 * @return The semantic data type of this Synonym, usually something
// 	 *         descriptive as "NAME" or "STREET".
// 	 */
// 	String getType();
// 
// 	/**
// 	 * @return The data which was in the original database for this Synonym
// 	 */
// 	Object getFrom();
// 
// 	/**
// 	 * 
// 	 * @return The data with which the original data in the database will be or
// 	 *         is replaced when the Anonymizer runs.
// 	 */
// 	Object getTo();
// }
// 
// Path: src/test/java/com/rolfje/junit/Asserts.java
// public class Asserts {
// 
//     public static void assertAnyOf(Object expected, Object... values) {
//         for (Object value : values) {
//             if (expected.equals(value)) {
//                 return;
//             }
//         }
//         fail(expected.toString() + " did not match any of "
//                 + Arrays.stream(values).map(Object::toString).collect(Collectors.joining(", "))
//                 + ".");
//     }
// 
//     public static void assertInstanceOf(Class<?> expectedClass, Object actualClass) {
//         Class<?> matchable = matchableClass(expectedClass);
//         assertTrue("Class " + actualClass.getClass().getSimpleName() + " is not an instance of " + expectedClass.getSimpleName(),
//                 matchable.isInstance(actualClass));
//     }
// 
//     private static Class<?> matchableClass(Class<?> expectedClass) {
//         if (boolean.class.equals(expectedClass)) return Boolean.class;
//         if (byte.class.equals(expectedClass)) return Byte.class;
//         if (char.class.equals(expectedClass)) return Character.class;
//         if (double.class.equals(expectedClass)) return Double.class;
//         if (float.class.equals(expectedClass)) return Float.class;
//         if (int.class.equals(expectedClass)) return Integer.class;
//         if (long.class.equals(expectedClass)) return Long.class;
//         if (short.class.equals(expectedClass)) return Short.class;
//         return expectedClass;
//     }
// }
// 
// Path: src/main/java/com/rolfje/anonimatron/anonymizer/DutchBSNAnononymizer.java
// public static boolean isValidBSN(String burgerServiceNummer) {
//     // Number must be at least 7 at maximum 9 characters in length,
//     if (burgerServiceNummer == null
//             || burgerServiceNummer.length() > 9
//             || burgerServiceNummer.length() < 7) {
//         return false;
//     }
// 
//     // Numbers shorter than 9 characters are padded with zeroes.
//     burgerServiceNummer = StringUtils.leftPad(burgerServiceNummer, 9, "0");
// 
//     // The leftmost character dan not be higher than 3
//     if (burgerServiceNummer.charAt(0) > '3') {
//         return false;
//     }
// 
//     return isBSNElevenProof(burgerServiceNummer);
// }


import com.rolfje.anonimatron.synonyms.Synonym;
import com.rolfje.junit.Asserts;
import org.junit.Before;
import org.junit.Test;
import java.math.BigDecimal;
import java.math.BigInteger;
import static com.rolfje.anonimatron.anonymizer.DutchBSNAnononymizer.isValidBSN;
import static org.junit.Assert.*;
            Synonym synonym = bsnAnonymizer.anonymize(originalAsNumber, 9, shortlived);
            assertEquals(originalAsNumber, synonym.getFrom());
            assertNotEquals(originalAsNumber, synonym.getTo());
            Class<?> expectedClass = originalAsNumber.getClass();
            Object actualClass = synonym.getTo();
            Asserts.assertInstanceOf(expectedClass, actualClass);
            assertEquals(shortlived, synonym.isShortLived());
            validate(synonym);
        }
    }


    @Test
    public void testLength() {
        bsnAnonymizer.anonymize("dummy", 10000, false);
        bsnAnonymizer.anonymize("dummy", 9, false);

        try {
            bsnAnonymizer.anonymize("dummy", 8, false);
            fail("should throw exception");
        } catch (UnsupportedOperationException e) {
            // ok
        }
    }

    @Test
    public void testGenerateBSN() {
        boolean hadNonZeroLastDigit = false;
        for (int i = 0; i < 1000; i++) {
            String bsn = bsnAnonymizer.generateBSN(9);
// Path: src/main/java/com/rolfje/anonimatron/synonyms/Synonym.java
// public interface Synonym {
// 
// 	/**
// 	 * Indicates if this Synonym is short-lived or transient, meaning that
//      * it should not be stored in the synonyms file. Transient Synonyms
//      * are not stored, need to be calculated each run time.
// 	 *
// 	 * Transient synonyms are:
// 	 *
// 	 * <ol>
// 	 *     <li>Not stored in memory.</li>
// 	 *     <li>Not stored in the synonym file.</li>
// 	 * </ol>
// 	 *
// 	 * @return <code>true</code> if the synonym should be thrown away
// 	 * after use (not stored in the synonym file).
// 	 */
// 	boolean isShortLived();
// 
// 	/**
// 	 * @return The semantic data type of this Synonym, usually something
// 	 *         descriptive as "NAME" or "STREET".
// 	 */
// 	String getType();
// 
// 	/**
// 	 * @return The data which was in the original database for this Synonym
// 	 */
// 	Object getFrom();
// 
// 	/**
// 	 * 
// 	 * @return The data with which the original data in the database will be or
// 	 *         is replaced when the Anonymizer runs.
// 	 */
// 	Object getTo();
// }
// 
// Path: src/test/java/com/rolfje/junit/Asserts.java
// public class Asserts {
// 
//     public static void assertAnyOf(Object expected, Object... values) {
//         for (Object value : values) {
//             if (expected.equals(value)) {
//                 return;
//             }
//         }
//         fail(expected.toString() + " did not match any of "
//                 + Arrays.stream(values).map(Object::toString).collect(Collectors.joining(", "))
//                 + ".");
//     }
// 
//     public static void assertInstanceOf(Class<?> expectedClass, Object actualClass) {
//         Class<?> matchable = matchableClass(expectedClass);
//         assertTrue("Class " + actualClass.getClass().getSimpleName() + " is not an instance of " + expectedClass.getSimpleName(),
//                 matchable.isInstance(actualClass));
//     }
// 
//     private static Class<?> matchableClass(Class<?> expectedClass) {
//         if (boolean.class.equals(expectedClass)) return Boolean.class;
//         if (byte.class.equals(expectedClass)) return Byte.class;
//         if (char.class.equals(expectedClass)) return Character.class;
//         if (double.class.equals(expectedClass)) return Double.class;
//         if (float.class.equals(expectedClass)) return Float.class;
//         if (int.class.equals(expectedClass)) return Integer.class;
//         if (long.class.equals(expectedClass)) return Long.class;
//         if (short.class.equals(expectedClass)) return Short.class;
//         return expectedClass;
//     }
// }
// 
// Path: src/main/java/com/rolfje/anonimatron/anonymizer/DutchBSNAnononymizer.java
// public static boolean isValidBSN(String burgerServiceNummer) {
//     // Number must be at least 7 at maximum 9 characters in length,
//     if (burgerServiceNummer == null
//             || burgerServiceNummer.length() > 9
//             || burgerServiceNummer.length() < 7) {
//         return false;
//     }
// 
//     // Numbers shorter than 9 characters are padded with zeroes.
//     burgerServiceNummer = StringUtils.leftPad(burgerServiceNummer, 9, "0");
// 
//     // The leftmost character dan not be higher than 3
//     if (burgerServiceNummer.charAt(0) > '3') {
//         return false;
//     }
// 
//     return isBSNElevenProof(burgerServiceNummer);
// }


// Path: src/test/java/com/rolfje/anonimatron/anonymizer/DutchBSNAnononymizerTest.java
import com.rolfje.anonimatron.synonyms.Synonym;
import com.rolfje.junit.Asserts;
import org.junit.Before;
import org.junit.Test;
import java.math.BigDecimal;
import java.math.BigInteger;
import static com.rolfje.anonimatron.anonymizer.DutchBSNAnononymizer.isValidBSN;
import static org.junit.Assert.*;

            Synonym synonym = bsnAnonymizer.anonymize(originalAsNumber, 9, shortlived);
            assertEquals(originalAsNumber, synonym.getFrom());
            assertNotEquals(originalAsNumber, synonym.getTo());
            Class<?> expectedClass = originalAsNumber.getClass();
            Object actualClass = synonym.getTo();
            Asserts.assertInstanceOf(expectedClass, actualClass);
            assertEquals(shortlived, synonym.isShortLived());
            validate(synonym);
        }
    }


    @Test
    public void testLength() {
        bsnAnonymizer.anonymize("dummy", 10000, false);
        bsnAnonymizer.anonymize("dummy", 9, false);

        try {
            bsnAnonymizer.anonymize("dummy", 8, false);
            fail("should throw exception");
        } catch (UnsupportedOperationException e) {
            // ok
        }
    }

    @Test
    public void testGenerateBSN() {
        boolean hadNonZeroLastDigit = false;
        for (int i = 0; i < 1000; i++) {
            String bsn = bsnAnonymizer.generateBSN(9);
            assertTrue("Incorrect BSN " + bsn, isValidBSN(bsn));