Skip to content

Commit

Permalink
apply new changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hajk1 committed Jun 25, 2024
1 parent c1aeb6f commit c3547f1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
7 changes: 7 additions & 0 deletions src/main/java/org/iban4j/bban/BbanStructure.java
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,13 @@ public class BbanStructure {
CountryCode.OM,
new BbanStructure(
BbanStructureEntry.bankCode(3, 'n'), BbanStructureEntry.accountNumber(16, 'c')));

structures.put(
CountryCode.BI,
new BbanStructure(
BbanStructureEntry.bankCode(5, 'n'),
BbanStructureEntry.branchCode(5, 'n'),
BbanStructureEntry.accountNumber(13, 'n')));
}

private final BbanStructureEntry[] entries;
Expand Down
37 changes: 15 additions & 22 deletions src/test/java/org/iban4j/IbanTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.util.Random;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

@DisplayName("Iban general test")
final class IbanTest {

private static void assertIbanBuilderRandomWithSeedEquals(final String expected, final int seed) {
final Iban generated = new Iban.Builder(new Random(seed)).buildRandom();
final String actual = generated.toFormattedString();
assertEquals(
expected, actual, "expect that creating an IBAN with seed '" + seed + "' is deterministic");
}

@Test
@DisplayName("IBANs With Same Data Should Be Equal")
public void ibansWithSameDataShouldBeEqual() {
Expand Down Expand Up @@ -294,10 +300,10 @@ public void ibanConstructionRandom() {

@Test
public void ibanConstructionSeeded() {
assertAll(() -> assertIbanUtilRandomWithSeedEquals("TN58 1908 31HJ ENIS JS33 9QZG", 1),
() -> assertIbanUtilRandomWithSeedEquals("LV92 QKBB C1OY WHST MPQA 7", 2),
() -> assertIbanUtilRandomWithSeedEquals("JO53 WQSM 2804 ERG8 WOUQ NLYT EEL7 3J", 3)
);
assertAll(
() -> assertIbanUtilRandomWithSeedEquals("FR46 1918 2083 691H JENI SJS3 364", 1),
() -> assertIbanUtilRandomWithSeedEquals("LC94 QKBB C1OY WHST MPQA 7GVB 4WBX VTP0", 2),
() -> assertIbanUtilRandomWithSeedEquals("DK23 0882 2804 1804 23", 3));
}

private void assertIbanUtilRandomWithSeedEquals(
Expand All @@ -314,23 +320,10 @@ private void assertIbanUtilRandomWithSeedEquals(

@Test
public void ibanBuilderConstructionSeeded() {
assertAll(() -> assertIbanBuilderRandomWithSeedEquals("TN58 1908 31HJ ENIS JS33 9QZG", 1),
() -> assertIbanBuilderRandomWithSeedEquals("LV92 QKBB C1OY WHST MPQA 7", 2),
() -> assertIbanBuilderRandomWithSeedEquals("JO53 WQSM 2804 ERG8 WOUQ NLYT EEL7 3J", 3)
);
}

private static void assertIbanBuilderRandomWithSeedEquals(
final String expected,
final int seed
) {
final Iban generated = new Iban.Builder(new Random(seed)).buildRandom();
final String actual = generated.toFormattedString();
assertEquals(
expected,
actual,
"expect that creating an IBAN with seed '" + seed + "' is deterministic"
);
assertAll(
() -> assertIbanBuilderRandomWithSeedEquals("FR46 1918 2083 691H JENI SJS3 364", 1),
() -> assertIbanBuilderRandomWithSeedEquals("LC94 QKBB C1OY WHST MPQA 7GVB 4WBX VTP0", 2),
() -> assertIbanBuilderRandomWithSeedEquals("DK23 0882 2804 1804 23", 3));
}

@Test
Expand Down

0 comments on commit c3547f1

Please sign in to comment.