| 1 |
package segment |
| 2 |
|
| 3 |
import ( |
| 4 |
"testing" |
| 5 |
|
| 6 |
"github.com/mitch000001/go-hbci/element" |
| 7 |
) |
| 8 |
|
| 9 |
func TestCommonUserParameterDataSegmentUnmarshalHBCI(t *testing.T) { |
| 10 |
test := "HIUPA:5:2:7+12345+4+0'" |
| 11 |
|
| 12 |
segment := &CommonUserParameterDataSegment{} |
| 13 |
|
| 14 |
err := segment.UnmarshalHBCI([]byte(test)) |
| 15 |
|
| 16 |
if err != nil { |
| 17 |
t.Logf("Expected no error, got %T:%v\n", err, err) |
| 18 |
t.Fail() |
| 19 |
} |
| 20 |
|
| 21 |
v2 := &CommonUserParameterDataV2{ |
| 22 |
UserID: element.NewIdentification("12345"), |
| 23 |
UPDVersion: element.NewNumber(4, 3), |
| 24 |
UPDUsage: element.NewNumber(0, 1), |
| 25 |
} |
| 26 |
v2.Segment = NewReferencingBasicSegment(5, 7, v2) |
| 27 |
expected := &CommonUserParameterDataSegment{v2} |
| 28 |
|
| 29 |
expectedString := expected.String() |
| 30 |
actualString := segment.String() |
| 31 |
|
| 32 |
if expectedString != actualString { |
| 33 |
t.Logf("Expected unmarshaled value to equal\n%q\n\tgot\n%q\n", expectedString, actualString) |
| 34 |
t.Fail() |
| 35 |
} |
| 36 |
} |