Skip to content

Commit

Permalink
adding Oman country IBAN (#135)
Browse files Browse the repository at this point in the history
* adding Oman country IBAN

* modify tests to cover the random seed
  • Loading branch information
hajk1 authored Apr 27, 2024
1 parent 8630676 commit a7833cc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
3 changes: 3 additions & 0 deletions src/main/java/org/iban4j/bban/BbanStructure.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.EnumMap;
import java.util.List;
import java.util.Optional;

import org.iban4j.CountryCode;

/**
Expand Down Expand Up @@ -537,6 +538,8 @@ private BbanStructure(final BbanStructureEntry... entries) {
BbanStructureEntry.bankCode(4, 'n'),
BbanStructureEntry.branchCode(4, 'n'),
BbanStructureEntry.accountNumber(13, 'c')));

structures.put(CountryCode.OM, new BbanStructure(BbanStructureEntry.bankCode(3, 'n'), BbanStructureEntry.accountNumber(16, 'c')));
}

/**
Expand Down
16 changes: 8 additions & 8 deletions src/test/java/org/iban4j/IbanTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.util.Random;

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

Expand Down Expand Up @@ -292,10 +294,9 @@ public void ibanConstructionRandom() {

@Test
public void ibanConstructionSeeded() {
assertAll(
() -> assertIbanUtilRandomWithSeedEquals("GL41 1918 0836 9682 13", 1),
() -> assertIbanUtilRandomWithSeedEquals("FR17 0679 7098 8804 5NYW S75F D50", 2),
() -> assertIbanUtilRandomWithSeedEquals("EG45 0882 2804 0304 6660 9507 6091 3", 3)
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)
);
}

Expand All @@ -313,10 +314,9 @@ private void assertIbanUtilRandomWithSeedEquals(

@Test
public void ibanBuilderConstructionSeeded() {
assertAll(
() -> assertIbanBuilderRandomWithSeedEquals("GL41 1918 0836 9682 13", 1),
() -> assertIbanBuilderRandomWithSeedEquals("FR17 0679 7098 8804 5NYW S75F D50", 2),
() -> assertIbanBuilderRandomWithSeedEquals("EG45 0882 2804 0304 6660 9507 6091 3", 3)
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)
);
}

Expand Down
6 changes: 4 additions & 2 deletions src/test/java/org/iban4j/TestDataHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,10 @@ public static Collection<Object[]> getIbanData() {
.countryCode(CountryCode.CV)
.bankCode("0002")
.branchCode("0000")
.accountNumber("0311180710148")
.build(), "CV64000200000311180710148"}
.accountNumber("0311180710148").build(), "CV64000200000311180710148" }, { new Iban.Builder().countryCode(CountryCode.OM)
.bankCode("028")
.accountNumber("12345678901")
.leftPadding(true).build(), "OM040280000012345678901" }
});
}

Expand Down

0 comments on commit a7833cc

Please sign in to comment.