File: group_data_element_group_test.go

package info (click to toggle)
golang-github-mitch000001-go-hbci 0.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,468 kB
  • sloc: java: 1,092; makefile: 5
file content (35 lines) | stat: -rw-r--r-- 724 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package element

import (
	"testing"

	"github.com/mitch000001/go-hbci/domain"
)

func TestAccountConnectionUnmarshalHBCI(t *testing.T) {
	test := "abc:subacc:280:12345678"

	acc := &AccountConnectionDataElement{}

	err := acc.UnmarshalHBCI([]byte(test))

	if err != nil {
		t.Logf("Expected no error, got %T:%v\n", err, err)
		t.Fail()
	}

	expected := NewAccountConnection(
		domain.AccountConnection{
			AccountID:                 "abc",
			SubAccountCharacteristics: "subacc",
			CountryCode:               280,
			BankID:                    "12345678",
		},
	).String()
	actual := acc.String()

	if expected != actual {
		t.Logf("Expected unmarshaled value to equal\n%q\n\tgot\n%q\n", expected, actual)
		t.Fail()
	}
}