Skip to content

Commit 0846b04

Browse files
committed
fix(plc4go/bacnetip): fix trapped state machine
1 parent f9a1258 commit 0846b04

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

plc4go/internal/bacnetip/bacgopes/tests/test_utilities/test_state_machine_test.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ func TestState(t *testing.T) {
284284
}
285285

286286
func TestStateMachine(t *testing.T) {
287-
t.Skip("Something is competely broken") // TODO: fixme
288287
t.Run("test_state_machine_run", func(t *testing.T) {
289288
testingLogger := testutils.ProduceTestingLogger(t)
290289

@@ -392,7 +391,7 @@ func TestStateMachine(t *testing.T) {
392391

393392
// check the transaction log
394393
require.Equal(t, 1, len(tsm.GetTransactionLog()))
395-
assert.Contains(t, tsm.GetTransactionLog()[0].Pdu, pdu)
394+
assert.Equal(t, tsm.GetTransactionLog()[0].Pdu, pdu)
396395
})
397396
t.Run("test_state_machine_unexpected", func(t *testing.T) {
398397
testingLogger := testutils.ProduceTestingLogger(t)
@@ -567,8 +566,8 @@ func TestStateMachine(t *testing.T) {
567566
t.Log("callbacks passed")
568567

569568
// check the transaction log
570-
assert.Contains(t, tsm.GetTransactionLog()[0].Pdu, firstPdu)
571-
assert.Contains(t, tsm.GetTransactionLog()[1].Pdu, secondPdu)
569+
assert.Equal(t, tsm.GetTransactionLog()[0].Pdu, firstPdu)
570+
assert.Equal(t, tsm.GetTransactionLog()[1].Pdu, secondPdu)
572571
})
573572
}
574573

plc4go/internal/bacnetip/bacgopes/tests/trapped_classes/trapped_classes_TrappedStateMachine.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (t *TrappedStateMachine) GetSent() PDU {
6161
}
6262

6363
func (t *TrappedStateMachine) BeforeSend(pdu PDU) {
64-
t.StateMachineContract.BeforeSend(pdu)
64+
t.Trapper.BeforeSend(pdu)
6565
}
6666

6767
func (t *TrappedStateMachine) Send(args Args, kwArgs KWArgs) error {
@@ -77,19 +77,19 @@ func (t *TrappedStateMachine) Send(args Args, kwArgs KWArgs) error {
7777
}
7878

7979
func (t *TrappedStateMachine) AfterSend(pdu PDU) {
80-
t.StateMachineContract.AfterSend(pdu)
80+
t.Trapper.AfterSend(pdu)
8181
}
8282

8383
func (t *TrappedStateMachine) BeforeReceive(pdu PDU) {
84-
t.StateMachineContract.BeforeReceive(pdu)
84+
t.Trapper.BeforeReceive(pdu)
8585
}
8686

8787
func (t *TrappedStateMachine) AfterReceive(pdu PDU) {
88-
t.StateMachineContract.AfterReceive(pdu)
88+
t.Trapper.AfterReceive(pdu)
8989
}
9090

9191
func (t *TrappedStateMachine) UnexpectedReceive(pdu PDU) {
92-
t.StateMachineContract.UnexpectedReceive(pdu)
92+
t.Trapper.UnexpectedReceive(pdu)
9393
}
9494

9595
func (t *TrappedStateMachine) DecorateState(state state_machine.State) state_machine.State {

0 commit comments

Comments
 (0)