diff --git a/accountCreditedDrawdown_test.go b/accountCreditedDrawdown_test.go index 4dd19806..5ed64ca5 100644 --- a/accountCreditedDrawdown_test.go +++ b/accountCreditedDrawdown_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -94,7 +95,7 @@ func TestStringAccountCreditedDrawdownVariableLength(t *testing.T) { r.line = line err = r.parseAccountCreditedDrawdown() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{5400} *" r = NewReader(strings.NewReader(line)) diff --git a/accountDebitedDrawdown_test.go b/accountDebitedDrawdown_test.go index aabf6422..fc3eb7fb 100644 --- a/accountDebitedDrawdown_test.go +++ b/accountDebitedDrawdown_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -179,7 +180,7 @@ func TestStringAccountDebitedDrawdownVariableLength(t *testing.T) { r.line = line err = r.parseAccountDebitedDrawdown() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{4400}***" r = NewReader(strings.NewReader(line)) diff --git a/actualAmountPaid_test.go b/actualAmountPaid_test.go index 7f4992ce..de77ed05 100644 --- a/actualAmountPaid_test.go +++ b/actualAmountPaid_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -115,14 +116,14 @@ func TestStringActualAmountPaidVariableLength(t *testing.T) { r.line = line err = r.parseActualAmountPaid() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8450}****" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseActualAmountPaid() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8450}**" r = NewReader(strings.NewReader(line)) diff --git a/adjustment_test.go b/adjustment_test.go index 0f62bc1e..0c3cfe73 100644 --- a/adjustment_test.go +++ b/adjustment_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -158,14 +159,14 @@ func TestStringAdjustmentVariableLength(t *testing.T) { r.line = line err = r.parseAdjustment() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8600}01CRDTUSD1234.56****" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseAdjustment() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8600}01CRDTUSD1234.56*" r = NewReader(strings.NewReader(line)) diff --git a/amountNegotiatedDiscount_test.go b/amountNegotiatedDiscount_test.go index 8ce9bb15..744745d2 100644 --- a/amountNegotiatedDiscount_test.go +++ b/amountNegotiatedDiscount_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -115,14 +116,14 @@ func TestStringAmountNegotiatedDiscountVariableLength(t *testing.T) { r.line = line err = r.parseAmountNegotiatedDiscount() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8550}USD1234.56***" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseAmountNegotiatedDiscount() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8550}USD1234.56*" r = NewReader(strings.NewReader(line)) diff --git a/beneficiaryCustomer_test.go b/beneficiaryCustomer_test.go index 02a9cea9..ade5f0d6 100644 --- a/beneficiaryCustomer_test.go +++ b/beneficiaryCustomer_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -148,14 +149,14 @@ func TestStringBeneficiaryCustomerVariableLength(t *testing.T) { r.line = line err = r.parseBeneficiaryCustomer() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{7059}********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseBeneficiaryCustomer() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{7059}******" r = NewReader(strings.NewReader(line)) diff --git a/beneficiaryFI_test.go b/beneficiaryFI_test.go index e881a592..63a4ddb0 100644 --- a/beneficiaryFI_test.go +++ b/beneficiaryFI_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -169,14 +170,14 @@ func TestStringBeneficiaryFIVariableLength(t *testing.T) { r.line = line err = r.parseBeneficiaryFI() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{4100}D123456789*******" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseBeneficiaryFI() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{4100}D123456789****" r = NewReader(strings.NewReader(line)) diff --git a/beneficiaryIntermediaryFI_test.go b/beneficiaryIntermediaryFI_test.go index 6bba6e27..ce7003c5 100644 --- a/beneficiaryIntermediaryFI_test.go +++ b/beneficiaryIntermediaryFI_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -172,14 +173,14 @@ func TestStringBeneficiaryIntermediaryFIVariableLength(t *testing.T) { r.line = line err = r.parseBeneficiaryIntermediaryFI() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{4000}D123456789*******" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseBeneficiaryIntermediaryFI() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{4000}D123456789****" r = NewReader(strings.NewReader(line)) diff --git a/beneficiaryReference_test.go b/beneficiaryReference_test.go index dac9550f..8ba5c0e2 100644 --- a/beneficiaryReference_test.go +++ b/beneficiaryReference_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -83,14 +84,14 @@ func TestStringBeneficiaryReferenceVariableLength(t *testing.T) { r.line = line err = r.parseBeneficiaryReference() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{4320}***" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseBeneficiaryReference() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{4320}*" r = NewReader(strings.NewReader(line)) diff --git a/beneficiary_test.go b/beneficiary_test.go index 2d892e0f..1e71793a 100644 --- a/beneficiary_test.go +++ b/beneficiary_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -159,14 +160,14 @@ func TestStringBeneficiaryVariableLength(t *testing.T) { r.line = line err = r.parseBeneficiary() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{4200}31234*******" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseBeneficiary() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{4200}31234*****" r = NewReader(strings.NewReader(line)) diff --git a/businessFunctionCode_test.go b/businessFunctionCode_test.go index 5ea2ebf6..1c85d0e1 100644 --- a/businessFunctionCode_test.go +++ b/businessFunctionCode_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -95,14 +96,14 @@ func TestStringBusinessFunctionCodeVariableLength(t *testing.T) { r.line = line err = r.parseBusinessFunctionCode() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3600}BTR***" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseBusinessFunctionCode() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3600}BTR*" r = NewReader(strings.NewReader(line)) diff --git a/charges_test.go b/charges_test.go index 2abf1477..4f3e7248 100644 --- a/charges_test.go +++ b/charges_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -58,14 +59,14 @@ func TestStringChargesVariableLength(t *testing.T) { r.line = line err = r.parseCharges() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3700}B******" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseCharges() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3700}B*" r = NewReader(strings.NewReader(line)) diff --git a/converters.go b/converters.go index 84cf058f..ee5723a5 100644 --- a/converters.go +++ b/converters.go @@ -8,7 +8,6 @@ import ( "fmt" "strconv" "strings" - "unicode/utf8" ) // converters handles golang to WIRE type Converters @@ -153,7 +152,7 @@ func (c *converters) stripDelimiters(data string) string { // verify input data with read length func (c *converters) verifyDataWithReadLength(data string, expected int) error { - n := utf8.RuneCountInString(data) + n := len(data) // utf8.RuneCountInString(data) if n == expected { return nil } diff --git a/currencyInstructedAmount_test.go b/currencyInstructedAmount_test.go index c96ca274..5f2815e0 100644 --- a/currencyInstructedAmount_test.go +++ b/currencyInstructedAmount_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -96,7 +97,7 @@ func TestStringCurrencyInstructedAmountVariableLength(t *testing.T) { r.line = line err = r.parseCurrencyInstructedAmount() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) } // TestStringCurrencyInstructedAmountOptions validates Format() formatted according to the FormatOptions diff --git a/errorWire_test.go b/errorWire_test.go index ba00047d..d9d5f244 100644 --- a/errorWire_test.go +++ b/errorWire_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -63,14 +64,14 @@ func TestStringErrorWireAmountVariableLength(t *testing.T) { r.line = line err = r.parseErrorWire() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{1130}1XYZData Error***" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseErrorWire() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{1130}1XYZData Error*" r = NewReader(strings.NewReader(line)) diff --git a/exchangeRate_test.go b/exchangeRate_test.go index 198c1f27..30e83c1e 100644 --- a/exchangeRate_test.go +++ b/exchangeRate_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -85,14 +86,14 @@ func TestStringErrorExchangeRateVariableLength(t *testing.T) { r.line = line err = r.parseExchangeRate() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3720}123***" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseExchangeRate() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3720}123*" r = NewReader(strings.NewReader(line)) diff --git a/fIBeneficiaryFIAdvice_test.go b/fIBeneficiaryFIAdvice_test.go index 667da391..2c098564 100644 --- a/fIBeneficiaryFIAdvice_test.go +++ b/fIBeneficiaryFIAdvice_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -149,14 +150,14 @@ func TestStringFIBeneficiaryFIAdviceVariableLength(t *testing.T) { r.line = line err = r.parseFIBeneficiaryFIAdvice() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6310}HLD********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseFIBeneficiaryFIAdvice() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6310}HLD*" r = NewReader(strings.NewReader(line)) diff --git a/fiAdditionalFIToFI_test.go b/fiAdditionalFIToFI_test.go index f734f81e..ecc1c829 100644 --- a/fiAdditionalFIToFI_test.go +++ b/fiAdditionalFIToFI_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -137,14 +138,14 @@ func TestStringFIAdditionalFIToFIVariableLength(t *testing.T) { r.line = line err = r.parseFIAdditionalFIToFI() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6500}********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseFIAdditionalFIToFI() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6500}*" r = NewReader(strings.NewReader(line)) diff --git a/fiBeneficiaryAdvice_test.go b/fiBeneficiaryAdvice_test.go index 851443ea..201e9e0f 100644 --- a/fiBeneficiaryAdvice_test.go +++ b/fiBeneficiaryAdvice_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -140,14 +141,14 @@ func TestStringFIBeneficiaryAdviceVariableLength(t *testing.T) { r.line = line err = r.parseFIBeneficiaryAdvice() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6410}HLD********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseFIBeneficiaryAdvice() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6410}HLD*" r = NewReader(strings.NewReader(line)) diff --git a/fiBeneficiaryFI_test.go b/fiBeneficiaryFI_test.go index 93c2d80b..cc0db3ae 100644 --- a/fiBeneficiaryFI_test.go +++ b/fiBeneficiaryFI_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -138,14 +139,14 @@ func TestStringFIBeneficiaryFIVariableLength(t *testing.T) { r.line = line err = r.parseFIBeneficiaryFI() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6300}********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseFIBeneficiaryFI() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6300}*" r = NewReader(strings.NewReader(line)) diff --git a/fiBeneficiary_test.go b/fiBeneficiary_test.go index b525cf84..81bfb504 100644 --- a/fiBeneficiary_test.go +++ b/fiBeneficiary_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -137,14 +138,14 @@ func TestStringFIBeneficiaryVariableLength(t *testing.T) { r.line = line err = r.parseFIBeneficiary() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6400}********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseFIBeneficiary() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6400}*" r = NewReader(strings.NewReader(line)) diff --git a/fiDrawdownDebitAccountAdvice_test.go b/fiDrawdownDebitAccountAdvice_test.go index bbe3a5e5..1645b1d5 100644 --- a/fiDrawdownDebitAccountAdvice_test.go +++ b/fiDrawdownDebitAccountAdvice_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -149,14 +150,14 @@ func TestStringFIDrawdownDebitAccountAdviceVariableLength(t *testing.T) { r.line = line err = r.parseFIDrawdownDebitAccountAdvice() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6110}HLD********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseFIDrawdownDebitAccountAdvice() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6110}HLD*" r = NewReader(strings.NewReader(line)) diff --git a/fiIntermediaryFIAdvice_test.go b/fiIntermediaryFIAdvice_test.go index 5add769c..95134732 100644 --- a/fiIntermediaryFIAdvice_test.go +++ b/fiIntermediaryFIAdvice_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -148,14 +149,14 @@ func TestStringFIIntermediaryFIAdviceVariableLength(t *testing.T) { r.line = line err = r.parseFIIntermediaryFIAdvice() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6210}HLD********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseFIIntermediaryFIAdvice() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6210}HLD*" r = NewReader(strings.NewReader(line)) diff --git a/fiIntermediaryFI_test.go b/fiIntermediaryFI_test.go index cfe29793..158c1145 100644 --- a/fiIntermediaryFI_test.go +++ b/fiIntermediaryFI_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -137,14 +138,14 @@ func TestStringFIIntermediaryFIVariableLength(t *testing.T) { r.line = line err = r.parseFIIntermediaryFI() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6200}********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseFIIntermediaryFI() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6200}*" r = NewReader(strings.NewReader(line)) diff --git a/fiPaymentMethodToBeneficiary_test.go b/fiPaymentMethodToBeneficiary_test.go index dfcf6b1b..7c4219fd 100644 --- a/fiPaymentMethodToBeneficiary_test.go +++ b/fiPaymentMethodToBeneficiary_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -93,14 +94,14 @@ func TestStringFIPaymentMethodToBeneficiaryVariableLength(t *testing.T) { r.line = line err = r.parseFIPaymentMethodToBeneficiary() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6420}CHECK***" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseFIPaymentMethodToBeneficiary() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6420}CHECK*" r = NewReader(strings.NewReader(line)) diff --git a/fiReceiverFI_test.go b/fiReceiverFI_test.go index 25e667bd..06793075 100644 --- a/fiReceiverFI_test.go +++ b/fiReceiverFI_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -137,14 +138,14 @@ func TestStringFIReceiverFIVariableLength(t *testing.T) { r.line = line err = r.parseFIReceiverFI() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6100}********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseFIReceiverFI() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6100}*" r = NewReader(strings.NewReader(line)) diff --git a/grossAmountRemittanceDocument_test.go b/grossAmountRemittanceDocument_test.go index 4f72a6ee..31c728bd 100644 --- a/grossAmountRemittanceDocument_test.go +++ b/grossAmountRemittanceDocument_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -104,14 +105,14 @@ func TestStringGrossAmountRemittanceDocumentVariableLength(t *testing.T) { r.line = line err = r.parseGrossAmountRemittanceDocument() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8500}USD1234.56***" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseGrossAmountRemittanceDocument() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8500}USD1234.56*" r = NewReader(strings.NewReader(line)) diff --git a/institutionAccount_test.go b/institutionAccount_test.go index a920425e..e0e750fe 100644 --- a/institutionAccount_test.go +++ b/institutionAccount_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -144,14 +145,14 @@ func TestStringInstitutionAccountVariableLength(t *testing.T) { r.line = line err = r.parseInstitutionAccount() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{7057}********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseInstitutionAccount() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{7057}*" r = NewReader(strings.NewReader(line)) diff --git a/instructedAmount_test.go b/instructedAmount_test.go index bc65e9ca..f411c086 100644 --- a/instructedAmount_test.go +++ b/instructedAmount_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -110,14 +111,14 @@ func TestStringInstructedAmountVariableLength(t *testing.T) { r.line = line err = r.parseInstructedAmount() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3710}USD4567,89***" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseInstructedAmount() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3710}USD4567,89*" r = NewReader(strings.NewReader(line)) diff --git a/instructingFI_test.go b/instructingFI_test.go index c3ace991..ab36706d 100644 --- a/instructingFI_test.go +++ b/instructingFI_test.go @@ -1,9 +1,11 @@ package wire import ( - "github.com/stretchr/testify/require" + "errors" "strings" "testing" + + "github.com/stretchr/testify/require" ) // mockInstructingFI creates a InstructingFI @@ -163,14 +165,14 @@ func TestStringInstructingFIVariableLength(t *testing.T) { r.line = line err = r.parseInstructingFI() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{5200}D12***********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseInstructingFI() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{5200}D12*" r = NewReader(strings.NewReader(line)) diff --git a/intermediaryInstitution_test.go b/intermediaryInstitution_test.go index c243ddcd..f80274e3 100644 --- a/intermediaryInstitution_test.go +++ b/intermediaryInstitution_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -144,14 +145,14 @@ func TestStringIntermediaryInstitutionVariableLength(t *testing.T) { r.line = line err = r.parseIntermediaryInstitution() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{7056}***********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseIntermediaryInstitution() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{7056}*" r = NewReader(strings.NewReader(line)) diff --git a/localInstrument_test.go b/localInstrument_test.go index a9cb94f4..705090f0 100644 --- a/localInstrument_test.go +++ b/localInstrument_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -101,14 +102,14 @@ func TestStringLocalInstrumentVariableLength(t *testing.T) { r.line = line err = r.parseLocalInstrument() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3610}***********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseLocalInstrument() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3610}ANSI*" r = NewReader(strings.NewReader(line)) diff --git a/messageDisposition_test.go b/messageDisposition_test.go index 174f7414..f5131972 100644 --- a/messageDisposition_test.go +++ b/messageDisposition_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -73,14 +74,14 @@ func TestStringMessageDispositionVariableLength(t *testing.T) { r.line = line err = r.parseMessageDisposition() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{1100}*******" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseMessageDisposition() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{1100}*" r = NewReader(strings.NewReader(line)) diff --git a/orderingCustomer_test.go b/orderingCustomer_test.go index 90e0d0f4..20162843 100644 --- a/orderingCustomer_test.go +++ b/orderingCustomer_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -144,14 +145,14 @@ func TestStringOrderingCustomerVariableLength(t *testing.T) { r.line = line err = r.parseOrderingCustomer() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{7050}********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseOrderingCustomer() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{7050}*" r = NewReader(strings.NewReader(line)) diff --git a/orderingInstitution_test.go b/orderingInstitution_test.go index 7763a46d..08be0050 100644 --- a/orderingInstitution_test.go +++ b/orderingInstitution_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -143,14 +144,14 @@ func TestStringOrderingInstitutionVariableLength(t *testing.T) { r.line = line err = r.parseOrderingInstitution() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{7052}********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseOrderingInstitution() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{7052}*" r = NewReader(strings.NewReader(line)) diff --git a/originator.go b/originator.go index a890910b..09e2c98e 100644 --- a/originator.go +++ b/originator.go @@ -6,6 +6,7 @@ package wire import ( "encoding/json" + "fmt" "strings" "unicode/utf8" ) @@ -42,6 +43,7 @@ func (o *Originator) Parse(record string) error { o.tag = record[:6] o.Personal.IdentificationCode = o.parseStringField(record[6:7]) + fmt.Printf("o.tag=%q o.Personal.IdentificationCode=%q\n", o.tag, o.Personal.IdentificationCode) length := 7 value, read, err := o.parseVariableStringField(record[length:], 34) @@ -50,6 +52,7 @@ func (o *Originator) Parse(record string) error { } o.Personal.Identifier = value length += read + fmt.Printf("value=%q read=%d length=%d\n", value, read, length) value, read, err = o.parseVariableStringField(record[length:], 35) if err != nil { @@ -57,6 +60,7 @@ func (o *Originator) Parse(record string) error { } o.Personal.Name = value length += read + fmt.Printf("value=%q read=%d length=%d\n", value, read, length) value, read, err = o.parseVariableStringField(record[length:], 35) if err != nil { @@ -64,6 +68,7 @@ func (o *Originator) Parse(record string) error { } o.Personal.Address.AddressLineOne = value length += read + fmt.Printf("value=%q read=%d length=%d\n", value, read, length) value, read, err = o.parseVariableStringField(record[length:], 35) if err != nil { @@ -71,6 +76,7 @@ func (o *Originator) Parse(record string) error { } o.Personal.Address.AddressLineTwo = value length += read + fmt.Printf("value=%q read=%d length=%d\n", value, read, length) value, read, err = o.parseVariableStringField(record[length:], 35) if err != nil { @@ -78,6 +84,7 @@ func (o *Originator) Parse(record string) error { } o.Personal.Address.AddressLineThree = value length += read + fmt.Printf("value=%q read=%d length=%d\n", value, read, length) if err := o.verifyDataWithReadLength(record, length); err != nil { return NewTagMaxLengthErr(err) diff --git a/originatorFI_test.go b/originatorFI_test.go index baa66fa3..9c7d4cbb 100644 --- a/originatorFI_test.go +++ b/originatorFI_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -164,14 +165,14 @@ func TestStringOriginatorFIVariableLength(t *testing.T) { r.line = line err = r.parseOriginatorFI() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{5100}B1*******" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseOriginatorFI() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{5100}B1*" r = NewReader(strings.NewReader(line)) diff --git a/originatorOptionF_test.go b/originatorOptionF_test.go index 20edcf37..0d2935aa 100644 --- a/originatorOptionF_test.go +++ b/originatorOptionF_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -188,14 +189,14 @@ func TestStringOriginatorOptionFVariableLength(t *testing.T) { r.line = line err = r.parseOriginatorOptionF() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{5010}TXID/123-45-6789*1/Name********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseOriginatorOptionF() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{5010}TXID/123-45-6789*1/Name*" r = NewReader(strings.NewReader(line)) diff --git a/originatorToBeneficiary_test.go b/originatorToBeneficiary_test.go index 69415418..3a7a30f2 100644 --- a/originatorToBeneficiary_test.go +++ b/originatorToBeneficiary_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -112,14 +113,14 @@ func TestStringOriginatorToBeneficiaryVariableLength(t *testing.T) { r.line = line err = r.parseOriginatorToBeneficiary() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6000}********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseOriginatorToBeneficiary() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{6000}*" r = NewReader(strings.NewReader(line)) diff --git a/originator_test.go b/originator_test.go index a852a245..3895a072 100644 --- a/originator_test.go +++ b/originator_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -157,14 +158,14 @@ func TestStringOriginatorVariableLength(t *testing.T) { r.line = line err = r.parseOriginator() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{5000}B1*******" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseOriginator() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{5000}B1*" r = NewReader(strings.NewReader(line)) diff --git a/outputMessageAccountabilityData_test.go b/outputMessageAccountabilityData_test.go index 0a1b5b66..5d243373 100644 --- a/outputMessageAccountabilityData_test.go +++ b/outputMessageAccountabilityData_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -77,14 +78,14 @@ func TestStringOutputMessageAccountabilityDataVariableLength(t *testing.T) { r.line = line err = r.parseOutputMessageAccountabilityData() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{1120}**000001********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseOutputMessageAccountabilityData() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{1120}**000001*" r = NewReader(strings.NewReader(line)) diff --git a/paymentNotification_test.go b/paymentNotification_test.go index 35dd6ac1..71c1dcde 100644 --- a/paymentNotification_test.go +++ b/paymentNotification_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -145,14 +146,14 @@ func TestStringPaymentNotificationVariableLength(t *testing.T) { r.line = line err = r.parsePaymentNotification() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3620}*********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parsePaymentNotification() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3620}*" r = NewReader(strings.NewReader(line)) diff --git a/previousMessageIdentifier_test.go b/previousMessageIdentifier_test.go index 7f9f556d..df5a16c3 100644 --- a/previousMessageIdentifier_test.go +++ b/previousMessageIdentifier_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -79,14 +80,14 @@ func TestStringPreviousMessageIdentifierVariableLength(t *testing.T) { r.line = line err = r.parsePreviousMessageIdentifier() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3500}********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parsePreviousMessageIdentifier() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3500}*" r = NewReader(strings.NewReader(line)) diff --git a/primaryRemittanceDocument_test.go b/primaryRemittanceDocument_test.go index 48bf42f2..a325312c 100644 --- a/primaryRemittanceDocument_test.go +++ b/primaryRemittanceDocument_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -145,14 +146,14 @@ func TestStringPrimaryRemittanceDocumentVariableLength(t *testing.T) { r.line = line err = r.parsePrimaryRemittanceDocument() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8400}CMCN********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parsePrimaryRemittanceDocument() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8400}AROI*Issuer*" r = NewReader(strings.NewReader(line)) diff --git a/receiptTimeStamp_test.go b/receiptTimeStamp_test.go index e2ba40eb..d47fd986 100644 --- a/receiptTimeStamp_test.go +++ b/receiptTimeStamp_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -71,14 +72,14 @@ func TestStringReceiptTimeStampVariableLength(t *testing.T) { r.line = line err = r.parseReceiptTimeStamp() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{1110}********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseReceiptTimeStamp() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{1110}*" r = NewReader(strings.NewReader(line)) diff --git a/receiverDepositoryInstitution_test.go b/receiverDepositoryInstitution_test.go index 3d9fbb74..464bb612 100644 --- a/receiverDepositoryInstitution_test.go +++ b/receiverDepositoryInstitution_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -100,14 +101,14 @@ func TestStringReceiverDepositoryInstitutionVariableLength(t *testing.T) { r.line = line err = r.parseReceiverDepositoryInstitution() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3400}1*A********" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseReceiverDepositoryInstitution() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3400}1*A*" r = NewReader(strings.NewReader(line)) diff --git a/relatedRemittance_test.go b/relatedRemittance_test.go index 15d86d85..753f0346 100644 --- a/relatedRemittance_test.go +++ b/relatedRemittance_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -299,14 +300,14 @@ func TestStringRelatedRemittanceVariableLength(t *testing.T) { r.line = line err = r.parseRelatedRemittance() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8250}*EDIC*A*ADDR***************************" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseRelatedRemittance() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8250}*EDIC*A*ADDR*" r = NewReader(strings.NewReader(line)) diff --git a/remittanceBeneficiary_test.go b/remittanceBeneficiary_test.go index 8262fe71..01deb0ac 100644 --- a/remittanceBeneficiary_test.go +++ b/remittanceBeneficiary_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -388,14 +389,14 @@ func TestStringRemittanceBeneficiaryVariableLength(t *testing.T) { r.line = line err = r.parseRemittanceBeneficiary() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8350}Name*PIARNU***ADDR****************************" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseRemittanceBeneficiary() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8350}Name*PIARNU***ADDR*" r = NewReader(strings.NewReader(line)) diff --git a/remittanceFreeText_test.go b/remittanceFreeText_test.go index 6ba9262e..2c98e271 100644 --- a/remittanceFreeText_test.go +++ b/remittanceFreeText_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -101,14 +102,14 @@ func TestStringRemittanceFreeTextVariableLength(t *testing.T) { r.line = line err = r.parseRemittanceFreeText() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8750}****************************" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseRemittanceFreeText() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8750}*" r = NewReader(strings.NewReader(line)) diff --git a/remittanceOriginator_test.go b/remittanceOriginator_test.go index 12b927d2..16c04000 100644 --- a/remittanceOriginator_test.go +++ b/remittanceOriginator_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -456,14 +457,14 @@ func TestStringRemittanceOriginatorVariableLength(t *testing.T) { r.line = line err = r.parseRemittanceOriginator() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8300}OICUSTName****ADDR*****************************" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseRemittanceOriginator() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8300}OICUSTName****ADDR*" r = NewReader(strings.NewReader(line)) diff --git a/remittance_test.go b/remittance_test.go index 7ad72f49..edb64d45 100644 --- a/remittance_test.go +++ b/remittance_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -143,14 +144,14 @@ func TestStringRemittanceVariableLength(t *testing.T) { r.line = line err = r.parseRemittance() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{7070}************" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseRemittance() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{7070}*" r = NewReader(strings.NewReader(line)) diff --git a/secondaryRemittanceDocument_test.go b/secondaryRemittanceDocument_test.go index 3dbaa0c9..d85e08fb 100644 --- a/secondaryRemittanceDocument_test.go +++ b/secondaryRemittanceDocument_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -145,14 +146,14 @@ func TestStringSecondaryRemittanceDocumentVariableLength(t *testing.T) { r.line = line err = r.parseSecondaryRemittanceDocument() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8700}AROI*A******************************" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseSecondaryRemittanceDocument() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{8700}AROI*A*" r = NewReader(strings.NewReader(line)) diff --git a/senderDepositoryInstitution_test.go b/senderDepositoryInstitution_test.go index 244d07b4..c6a5258e 100644 --- a/senderDepositoryInstitution_test.go +++ b/senderDepositoryInstitution_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -103,14 +104,14 @@ func TestStringSenderDepositoryInstitutionVariableLength(t *testing.T) { r.line = line err = r.parseSenderDepositoryInstitution() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3100}1*A***" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseSenderDepositoryInstitution() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3100}1*A*" r = NewReader(strings.NewReader(line)) diff --git a/senderReference_test.go b/senderReference_test.go index eb7cd5a1..202efc25 100644 --- a/senderReference_test.go +++ b/senderReference_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -79,14 +80,14 @@ func TestStringSenderReferenceVariableLength(t *testing.T) { r.line = line err = r.parseSenderReference() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3320}***" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseSenderReference() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{3320}*" r = NewReader(strings.NewReader(line)) diff --git a/senderSupplied_test.go b/senderSupplied_test.go index d7889c7e..f7b9f8fd 100644 --- a/senderSupplied_test.go +++ b/senderSupplied_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -133,14 +134,14 @@ func TestStringSenderSuppliedVariableLength(t *testing.T) { r.line = line err = r.parseSenderSupplied() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{1500}301*T** " r = NewReader(strings.NewReader(line)) r.line = line err = r.parseSenderSupplied() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{1500}301*T " r = NewReader(strings.NewReader(line)) diff --git a/senderToReceiver_test.go b/senderToReceiver_test.go index 165dc33a..ce3de9c4 100644 --- a/senderToReceiver_test.go +++ b/senderToReceiver_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -145,14 +146,14 @@ func TestStringSenderToReceiverVariableLength(t *testing.T) { r.line = line err = r.parseSenderToReceiver() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{7072}**************" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseSenderToReceiver() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{7072}*" r = NewReader(strings.NewReader(line)) diff --git a/serviceMessage_test.go b/serviceMessage_test.go index a00a9d00..5c8f0519 100644 --- a/serviceMessage_test.go +++ b/serviceMessage_test.go @@ -1,6 +1,7 @@ package wire import ( + "errors" "strings" "testing" @@ -369,14 +370,14 @@ func TestStringServiceMessageVariableLength(t *testing.T) { r.line = line err = r.parseServiceMessage() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{9000}**************" r = NewReader(strings.NewReader(line)) r.line = line err = r.parseServiceMessage() - require.EqualError(t, err, r.parseError(NewTagMaxLengthErr()).Error()) + require.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(""))).Error()) line = "{9000}A*" r = NewReader(strings.NewReader(line))