|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + * contributor license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright ownership. |
| 5 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + * (the "License"); you may not use this file except in compliance with |
| 7 | + * the License. You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | +package org.apache.commons.validator.routines.checkdigit; |
| 18 | + |
| 19 | +import org.junit.jupiter.api.BeforeEach; |
| 20 | + |
| 21 | +/** |
| 22 | + * DE Tax Id Check Digit Tests. |
| 23 | + * |
| 24 | +Quelle: Bayerisches Landesamt für Steuern: |
| 25 | +<a href="https://download.elster.de/download/schnittstellen/Pruefung_der_Steuer_und_Steueridentifikatsnummer.pdf">Prüfung der Steuer- und Steueridentifikationsnummer</a> |
| 26 | +
|
| 27 | +Die Steueridentifikationsnummer ist eine elfstellige Ziffernfolge, // Check in TINValidator |
| 28 | +die elfte Stelle ist eine Prüfziffer. |
| 29 | +Die Steueridentifikationsnummer muss folgenden Kriterien entsprechen: |
| 30 | +
|
| 31 | + Keine führenden Nullen erlaubt, // Check in TINValidator |
| 32 | + außer es ist eine Testidentifikationsnummer |
| 33 | + In den ersten 10 Stellen der Identifikationsnummer muss genau eine Ziffer doppelt oder dreifach vorkommen. |
| 34 | + Existieren drei gleiche Ziffern an den Positionen 1 bis 10, |
| 35 | + dürfen diese gleichen Ziffern niemals an direkt aufeinander folgenden Stellen stehen. |
| 36 | +
|
| 37 | +Beispiele |
| 38 | +
|
| 39 | + 02476291358 : TestID da führende 0, doppelte Ziffer : 2 |
| 40 | + 86095742719 : doppelte Ziffer : 7 |
| 41 | + 47036892816 : doppelte Ziffer : 8 |
| 42 | + 65929970489 : keine doppelte Ziffer, dreifache Ziffer : 9 |
| 43 | + 57549285017 : keine doppelte Ziffer, dreifache Ziffer : 5 |
| 44 | + 25768131411 : keine doppelte Ziffer, dreifache Ziffer : 1 |
| 45 | +
|
| 46 | + */ |
| 47 | +public class TidDECheckDigitTest extends AbstractCheckDigitTest { |
| 48 | + |
| 49 | + /** |
| 50 | + * Sets up routine & valid codes. |
| 51 | + */ |
| 52 | + @BeforeEach |
| 53 | + protected void setUp() { |
| 54 | + routine = TidDECheckDigit.getInstance(); |
| 55 | + valid = new String[] {"81872495633" // aus http://www.pruefziffernberechnung.de/I/Identifikationsnummer.shtml |
| 56 | + , "02476291358" |
| 57 | + , "86095742719" |
| 58 | + , "47036892816" |
| 59 | + , "65929970489" |
| 60 | + , "57549285017" |
| 61 | + , "25768131411" |
| 62 | + , "11012234564" // 2 doppelt und 1 dreifach |
| 63 | + , "11234567890" // doppelte Ziffer : 1 direkt hintereinander |
| 64 | + , "11012345675" // dreifach Ziffer : 1 nicht direkt hintereinander |
| 65 | +/* diese Steuernummer wurde vergeben, sie hat aber zwei doppelte Ziffer |
| 66 | + , "12720320213" // 0 und 1 doppelt und 2 vierfach |
| 67 | + */ |
| 68 | + }; |
| 69 | + invalid = new String[] {"00000000010" // theoretical minimum |
| 70 | + , "99999999994" // theoretical maximum |
| 71 | + , "12345678903" // keine Ziffer doppelt oder dreifach |
| 72 | + , "98765432106" // keine Ziffer doppelt oder dreifach |
| 73 | + , "11012134569" // vierfache Ziffer : 1 |
| 74 | + , "11223456785" // zwei doppelte Ziffer : 1 und 2 |
| 75 | + , "11212234562" // zwei dreifache Ziffer : 1 und 2 |
| 76 | + , "11123456786" // dreifach Ziffer : 1 direkt hintereinander |
| 77 | + }; |
| 78 | + } |
| 79 | + |
| 80 | +} |
0 commit comments