You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2023/05/09 14:41:37 UTC

[plc4x] 01/02: test(plc4go/spi): replace temp mock with mockery mock in write buffer

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit c889e477b830ab3d48d1a57f212f80a61432bda6
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue May 9 13:43:13 2023 +0200

    test(plc4go/spi): replace temp mock with mockery mock in write buffer
---
 plc4go/spi/utils/WriteBufferByteBased_test.go | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/plc4go/spi/utils/WriteBufferByteBased_test.go b/plc4go/spi/utils/WriteBufferByteBased_test.go
index 475824f6bd..be1916ad7d 100644
--- a/plc4go/spi/utils/WriteBufferByteBased_test.go
+++ b/plc4go/spi/utils/WriteBufferByteBased_test.go
@@ -25,6 +25,7 @@ import (
 	"encoding/binary"
 	"fmt"
 	"github.com/icza/bitio"
+	"github.com/stretchr/testify/mock"
 	"math/big"
 	"testing"
 
@@ -842,17 +843,6 @@ func Test_byteWriteBuffer_WriteInt8(t *testing.T) {
 	}
 }
 
-type _Test_byteWriteBuffer_WriteSerializable_Serializable struct {
-}
-
-func (_Test_byteWriteBuffer_WriteSerializable_Serializable) Serialize() ([]byte, error) {
-	return nil, nil
-}
-
-func (_Test_byteWriteBuffer_WriteSerializable_Serializable) SerializeWithWriteBuffer(ctx context.Context, writeBuffer WriteBuffer) error {
-	return nil
-}
-
 func Test_byteWriteBuffer_WriteSerializable(t *testing.T) {
 	type fields struct {
 		data      *bytes.Buffer
@@ -883,7 +873,11 @@ func Test_byteWriteBuffer_WriteSerializable(t *testing.T) {
 				writer: bitio.NewWriter(new(bytes.Buffer)),
 			},
 			args: args{
-				serializable: _Test_byteWriteBuffer_WriteSerializable_Serializable{},
+				serializable: func() Serializable {
+					serializable := NewMockSerializable(t)
+					serializable.EXPECT().SerializeWithWriteBuffer(mock.Anything, mock.Anything).Return(nil)
+					return serializable
+				}(),
 			},
 			wantErr: assert.NoError,
 		},