FILE / ScuroNeko/mtg

internal/testlib/net_conn_mock.go

Исходный файл и его история в репозитории.
FILE a0aabf2391ead23bc6831b74457168a1091c5b0d
Files
mtg/internal/testlib/net_conn_mock.go
T
2022-08-08 15:54:38 +03:00

57 lines
1.2 KiB
Go

package testlib
import (
"net"
"time"
"github.com/stretchr/testify/mock"
)
type EssentialsConnMock struct {
mock.Mock
}
func (n *EssentialsConnMock) Read(b []byte) (int, error) {
args := n.Called(b)
return args.Int(0), args.Error(1)
}
func (n *EssentialsConnMock) Write(b []byte) (int, error) {
args := n.Called(b)
return args.Int(0), args.Error(1)
}
func (n *EssentialsConnMock) Close() error {
return n.Called().Error(0) //nolint: wrapcheck
}
func (n *EssentialsConnMock) CloseRead() error {
return n.Called().Error(0) //nolint: wrapcheck
}
func (n *EssentialsConnMock) CloseWrite() error {
return n.Called().Error(0) //nolint: wrapcheck
}
func (n *EssentialsConnMock) LocalAddr() net.Addr {
return n.Called().Get(0).(net.Addr) //nolint: forcetypeassert
}
func (n *EssentialsConnMock) RemoteAddr() net.Addr {
return n.Called().Get(0).(net.Addr) //nolint: forcetypeassert
}
func (n *EssentialsConnMock) SetDeadline(t time.Time) error {
return n.Called(t).Error(0) //nolint: wrapcheck
}
func (n *EssentialsConnMock) SetReadDeadline(t time.Time) error {
return n.Called(t).Error(0) //nolint: wrapcheck
}
func (n *EssentialsConnMock) SetWriteDeadline(t time.Time) error {
return n.Called(t).Error(0) //nolint: wrapcheck
}