Fixed that maxMessageSize may is an empty string
This commit is contained in:
parent
1a0df93e0c
commit
c300bd2b7b
|
@ -167,7 +167,7 @@ open class ResponseParser @JvmOverloads constructor(
|
|||
val supportedLanguages = parseLanguages(dataElementGroups[5])
|
||||
val supportedHbciVersions = parseHbciVersions(dataElementGroups[6])
|
||||
|
||||
val maxMessageSize = if (dataElementGroups.size > 7) parseInt(dataElementGroups[7]) else null
|
||||
val maxMessageSize = if (dataElementGroups.size > 7) parseIntToNullIfEmpty(dataElementGroups[7]) else null
|
||||
val minTimeout = if (dataElementGroups.size > 8) parseInt(dataElementGroups[8]) else null
|
||||
val maxTimeout = if (dataElementGroups.size > 9) parseInt(dataElementGroups[9]) else null
|
||||
|
||||
|
@ -680,6 +680,14 @@ open class ResponseParser @JvmOverloads constructor(
|
|||
return parseString(string).toInt()
|
||||
}
|
||||
|
||||
protected open fun parseIntToNullIfEmpty(string: String): Int? {
|
||||
if (string.isNotEmpty()) {
|
||||
return parseNullableInt(string)
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
protected open fun parseNullableInt(mayInt: String): Int? {
|
||||
try {
|
||||
return parseInt(mayInt)
|
||||
|
|
|
@ -312,6 +312,34 @@ class ResponseParserTest : FinTsTestBase() {
|
|||
?: run { Assert.fail("No segment of type BankParameters found in ${result.receivedSegments}") }
|
||||
}
|
||||
|
||||
// Baader Bank
|
||||
|
||||
@Test
|
||||
fun parseBankParameters_MaxMessageSizeIsAnEmptyString() {
|
||||
|
||||
// when
|
||||
val result = underTest.parse("HIBPA:3:3:3+0+280:70033100+Baader Bank AG+1+1+300++0+300'")
|
||||
|
||||
// then
|
||||
assertSuccessfullyParsedSegment(result, InstituteSegmentId.BankParameters, 5, 3, 3)
|
||||
|
||||
result.getFirstSegmentById<BankParameters>(InstituteSegmentId.BankParameters)?.let { segment ->
|
||||
assertThat(segment.bpdVersion).isEqualTo(34)
|
||||
assertThat(segment.bankCountryCode).isEqualTo(280)
|
||||
assertThat(segment.bankCode).isEqualTo("10070000")
|
||||
assertThat(segment.bankName).isEqualTo("Deutsche Bank")
|
||||
|
||||
assertThat(segment.countMaxJobsPerMessage).isEqualTo(0)
|
||||
assertThat(segment.supportedLanguages).containsExactly(Dialogsprache.German)
|
||||
assertThat(segment.supportedHbciVersions).containsExactly(HbciVersion.FinTs_3_0_0)
|
||||
|
||||
assertThat(segment.maxMessageSize).isEqualTo(0)
|
||||
assertThat(segment.minTimeout).isNull()
|
||||
assertThat(segment.maxTimeout).isNull()
|
||||
}
|
||||
?: run { Assert.fail("No segment of type BankParameters found in ${result.receivedSegments}") }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun parseSecurityMethods() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue