Skip to content

Commit cd17398

Browse files
authored
Improve Bigbank AS PDF-Importer (#5745)
- Fix hasItem import to use CoreMatchers instead of Matchers - Add missing hasTaxes and hasFees assertions to interest test
1 parent bab5044 commit cd17398

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/bigbank/BigbankPDFExtractorTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.deposit;
44
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasAmount;
55
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasDate;
6+
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasFees;
67
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasNote;
78
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasSource;
9+
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasTaxes;
810
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.interest;
911
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.removal;
1012
import static name.abuchen.portfolio.datatransfer.ExtractorTestUtilities.countAccountTransactions;
@@ -13,9 +15,9 @@
1315
import static name.abuchen.portfolio.datatransfer.ExtractorTestUtilities.countItemsWithFailureMessage;
1416
import static name.abuchen.portfolio.datatransfer.ExtractorTestUtilities.countSecurities;
1517
import static name.abuchen.portfolio.datatransfer.ExtractorTestUtilities.countSkippedItems;
18+
import static org.hamcrest.CoreMatchers.hasItem;
1619
import static org.hamcrest.CoreMatchers.is;
1720
import static org.hamcrest.MatcherAssert.assertThat;
18-
import static org.hamcrest.Matchers.hasItem;
1921
import static org.hamcrest.collection.IsEmptyCollection.empty;
2022

2123
import java.util.ArrayList;
@@ -120,6 +122,7 @@ public void testKontoauszug03()
120122

121123
// assert transaction
122124
assertThat(results, hasItem(interest(hasDate("2024-12-31"), hasAmount("EUR", 99.01), //
123-
hasSource("Kontoauszug03.txt"), hasNote(null))));
125+
hasSource("Kontoauszug03.txt"), hasNote(null), //
126+
hasTaxes("EUR", 0.00), hasFees("EUR", 0.00))));
124127
}
125128
}

name.abuchen.portfolio/src/name/abuchen/portfolio/datatransfer/pdf/BigbankPDFExtractor.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public String getLabel()
2929

3030
private void addAccountStatementTransaction()
3131
{
32-
final DocumentType type = new DocumentType("Kontoauszug",
33-
documentContext -> documentContext
32+
final var type = new DocumentType("Kontoauszug", //
33+
documentContext -> documentContext //
3434
// @formatter:off
3535
// Datum Gegenkonto Buchung Name Betrag in EUR
3636
// @formatter:on
@@ -43,7 +43,7 @@ private void addAccountStatementTransaction()
4343
// @formatter:off
4444
// 21.03.2024 AT123456789101112131 Einzahlung oDkoRVZEb TxDUxE +1 500,34
4545
// @formatter:on
46-
Block depositBlock = new Block("^[\\d]{2}\\.[\\d]{2}\\.[\\d]{4}.*Einzahlung.* \\+[\\.,\\d\\s]+$");
46+
var depositBlock = new Block("^[\\d]{2}\\.[\\d]{2}\\.[\\d]{4}.*Einzahlung.* \\+[\\.,\\d\\s]+$");
4747
type.addBlock(depositBlock);
4848
depositBlock.set(new Transaction<AccountTransaction>()
4949

@@ -64,8 +64,7 @@ private void addAccountStatementTransaction()
6464
// 25.03.2024 AT123456789101112131 Auszahlung sUBHAKqzf vNNKxT -10,12
6565
// 28.03.2024 EE123456789101112132 Interne Belastung wMGSJi WajHthpvl -3 500,00
6666
// @formatter:on
67-
Block removalBlock = new Block(
68-
"^[\\d]{2}\\.[\\d]{2}\\.[\\d]{4}.*(Auszahlung|Interne Belastung).* \\-[\\.,\\d\\s]+$");
67+
var removalBlock = new Block("^[\\d]{2}\\.[\\d]{2}\\.[\\d]{4}.*(Auszahlung|Interne Belastung).* \\-[\\.,\\d\\s]+$");
6968
type.addBlock(removalBlock);
7069
removalBlock.set(new Transaction<AccountTransaction>()
7170

@@ -85,7 +84,7 @@ private void addAccountStatementTransaction()
8584
// @formatter:off
8685
// 31.12.2024 Zinsgutschrift +99,01
8786
// @formatter:on
88-
Block interestBlock = new Block("^[\\d]{2}\\.[\\d]{2}\\.[\\d]{4}.*Zinsgutschrift.* \\+[\\.,\\d\\s]+$");
87+
var interestBlock = new Block("^[\\d]{2}\\.[\\d]{2}\\.[\\d]{4}.*Zinsgutschrift.* \\+[\\.,\\d\\s]+$");
8988
type.addBlock(interestBlock);
9089
interestBlock.set(new Transaction<AccountTransaction>()
9190

0 commit comments

Comments
 (0)