From 5047727fec1f73cb8936972eb24561c2f6ae403e Mon Sep 17 00:00:00 2001 From: una Date: Fri, 22 Nov 2024 11:56:56 +0800 Subject: [PATCH] crypto: go generate mockery --- crypto/binaryquadraticform/mocks/Exper.go | 72 ++++++++++++++++++++++ crypto/homo/mocks/Crypto.go | 54 ++++++++++++++--- crypto/homo/mocks/Pubkey.go | 32 ++++++++-- crypto/mta/mocks/Mta.go | 56 +++++++++++++---- crypto/oprf/hasher/mocks/Hasher.go | 73 +++++++++++++++++++++++ types/message/mocks/EchoMessage.go | 16 ++--- types/mocks/Handler.go | 18 ++++-- types/mocks/Message.go | 16 ++--- types/mocks/MessageMain.go | 16 ++--- types/mocks/PeerManager.go | 17 +++--- types/mocks/StateChangedListener.go | 16 ++--- 11 files changed, 321 insertions(+), 65 deletions(-) create mode 100644 crypto/binaryquadraticform/mocks/Exper.go create mode 100644 crypto/oprf/hasher/mocks/Hasher.go diff --git a/crypto/binaryquadraticform/mocks/Exper.go b/crypto/binaryquadraticform/mocks/Exper.go new file mode 100644 index 00000000..a37bf120 --- /dev/null +++ b/crypto/binaryquadraticform/mocks/Exper.go @@ -0,0 +1,72 @@ +// Code generated by mockery v2.27.1. DO NOT EDIT. + +package mocks + +import ( + big "math/big" + + binaryquadraticform "github.com/getamis/alice/crypto/binaryquadraticform" + mock "github.com/stretchr/testify/mock" +) + +// Exper is an autogenerated mock type for the Exper type +type Exper struct { + mock.Mock +} + +// Exp provides a mock function with given fields: power +func (_m *Exper) Exp(power *big.Int) (*binaryquadraticform.BQuadraticForm, error) { + ret := _m.Called(power) + + var r0 *binaryquadraticform.BQuadraticForm + var r1 error + if rf, ok := ret.Get(0).(func(*big.Int) (*binaryquadraticform.BQuadraticForm, error)); ok { + return rf(power) + } + if rf, ok := ret.Get(0).(func(*big.Int) *binaryquadraticform.BQuadraticForm); ok { + r0 = rf(power) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*binaryquadraticform.BQuadraticForm) + } + } + + if rf, ok := ret.Get(1).(func(*big.Int) error); ok { + r1 = rf(power) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ToMessage provides a mock function with given fields: +func (_m *Exper) ToMessage() *binaryquadraticform.BQForm { + ret := _m.Called() + + var r0 *binaryquadraticform.BQForm + if rf, ok := ret.Get(0).(func() *binaryquadraticform.BQForm); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*binaryquadraticform.BQForm) + } + } + + return r0 +} + +type mockConstructorTestingTNewExper interface { + mock.TestingT + Cleanup(func()) +} + +// NewExper creates a new instance of Exper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewExper(t mockConstructorTestingTNewExper) *Exper { + mock := &Exper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/crypto/homo/mocks/Crypto.go b/crypto/homo/mocks/Crypto.go index 5e549e9b..f8c0c70e 100644 --- a/crypto/homo/mocks/Crypto.go +++ b/crypto/homo/mocks/Crypto.go @@ -1,12 +1,12 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks import ( - elliptic "github.com/getamis/alice/crypto/elliptic" big "math/big" ecpointgrouplaw "github.com/getamis/alice/crypto/ecpointgrouplaw" + elliptic "github.com/getamis/alice/crypto/elliptic" homo "github.com/getamis/alice/crypto/homo" @@ -23,6 +23,10 @@ func (_m *Crypto) Add(c1 []byte, c2 []byte) ([]byte, error) { ret := _m.Called(c1, c2) var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func([]byte, []byte) ([]byte, error)); ok { + return rf(c1, c2) + } if rf, ok := ret.Get(0).(func([]byte, []byte) []byte); ok { r0 = rf(c1, c2) } else { @@ -31,7 +35,6 @@ func (_m *Crypto) Add(c1 []byte, c2 []byte) ([]byte, error) { } } - var r1 error if rf, ok := ret.Get(1).(func([]byte, []byte) error); ok { r1 = rf(c1, c2) } else { @@ -46,6 +49,10 @@ func (_m *Crypto) Decrypt(c []byte) ([]byte, error) { ret := _m.Called(c) var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func([]byte) ([]byte, error)); ok { + return rf(c) + } if rf, ok := ret.Get(0).(func([]byte) []byte); ok { r0 = rf(c) } else { @@ -54,7 +61,6 @@ func (_m *Crypto) Decrypt(c []byte) ([]byte, error) { } } - var r1 error if rf, ok := ret.Get(1).(func([]byte) error); ok { r1 = rf(c) } else { @@ -69,6 +75,10 @@ func (_m *Crypto) Encrypt(m []byte) ([]byte, error) { ret := _m.Called(m) var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func([]byte) ([]byte, error)); ok { + return rf(m) + } if rf, ok := ret.Get(0).(func([]byte) []byte); ok { r0 = rf(m) } else { @@ -77,7 +87,6 @@ func (_m *Crypto) Encrypt(m []byte) ([]byte, error) { } } - var r1 error if rf, ok := ret.Get(1).(func([]byte) error); ok { r1 = rf(m) } else { @@ -108,6 +117,10 @@ func (_m *Crypto) GetMtaProof(curve elliptic.Curve, beta *big.Int, a *big.Int) ( ret := _m.Called(curve, beta, a) var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func(elliptic.Curve, *big.Int, *big.Int) ([]byte, error)); ok { + return rf(curve, beta, a) + } if rf, ok := ret.Get(0).(func(elliptic.Curve, *big.Int, *big.Int) []byte); ok { r0 = rf(curve, beta, a) } else { @@ -116,7 +129,6 @@ func (_m *Crypto) GetMtaProof(curve elliptic.Curve, beta *big.Int, a *big.Int) ( } } - var r1 error if rf, ok := ret.Get(1).(func(elliptic.Curve, *big.Int, *big.Int) error); ok { r1 = rf(curve, beta, a) } else { @@ -147,6 +159,10 @@ func (_m *Crypto) MulConst(c []byte, scalar *big.Int) ([]byte, error) { ret := _m.Called(c, scalar) var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func([]byte, *big.Int) ([]byte, error)); ok { + return rf(c, scalar) + } if rf, ok := ret.Get(0).(func([]byte, *big.Int) []byte); ok { r0 = rf(c, scalar) } else { @@ -155,7 +171,6 @@ func (_m *Crypto) MulConst(c []byte, scalar *big.Int) ([]byte, error) { } } - var r1 error if rf, ok := ret.Get(1).(func([]byte, *big.Int) error); ok { r1 = rf(c, scalar) } else { @@ -170,6 +185,10 @@ func (_m *Crypto) NewPubKeyFromBytes(_a0 []byte) (homo.Pubkey, error) { ret := _m.Called(_a0) var r0 homo.Pubkey + var r1 error + if rf, ok := ret.Get(0).(func([]byte) (homo.Pubkey, error)); ok { + return rf(_a0) + } if rf, ok := ret.Get(0).(func([]byte) homo.Pubkey); ok { r0 = rf(_a0) } else { @@ -178,7 +197,6 @@ func (_m *Crypto) NewPubKeyFromBytes(_a0 []byte) (homo.Pubkey, error) { } } - var r1 error if rf, ok := ret.Get(1).(func([]byte) error); ok { r1 = rf(_a0) } else { @@ -223,6 +241,10 @@ func (_m *Crypto) VerifyMtaProof(msg []byte, curve elliptic.Curve, alpha *big.In ret := _m.Called(msg, curve, alpha, k) var r0 *ecpointgrouplaw.ECPoint + var r1 error + if rf, ok := ret.Get(0).(func([]byte, elliptic.Curve, *big.Int, *big.Int) (*ecpointgrouplaw.ECPoint, error)); ok { + return rf(msg, curve, alpha, k) + } if rf, ok := ret.Get(0).(func([]byte, elliptic.Curve, *big.Int, *big.Int) *ecpointgrouplaw.ECPoint); ok { r0 = rf(msg, curve, alpha, k) } else { @@ -231,7 +253,6 @@ func (_m *Crypto) VerifyMtaProof(msg []byte, curve elliptic.Curve, alpha *big.In } } - var r1 error if rf, ok := ret.Get(1).(func([]byte, elliptic.Curve, *big.Int, *big.Int) error); ok { r1 = rf(msg, curve, alpha, k) } else { @@ -240,3 +261,18 @@ func (_m *Crypto) VerifyMtaProof(msg []byte, curve elliptic.Curve, alpha *big.In return r0, r1 } + +type mockConstructorTestingTNewCrypto interface { + mock.TestingT + Cleanup(func()) +} + +// NewCrypto creates a new instance of Crypto. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewCrypto(t mockConstructorTestingTNewCrypto) *Crypto { + mock := &Crypto{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/crypto/homo/mocks/Pubkey.go b/crypto/homo/mocks/Pubkey.go index c0957c8e..cb6cda7b 100644 --- a/crypto/homo/mocks/Pubkey.go +++ b/crypto/homo/mocks/Pubkey.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks @@ -18,6 +18,10 @@ func (_m *Pubkey) Add(c1 []byte, c2 []byte) ([]byte, error) { ret := _m.Called(c1, c2) var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func([]byte, []byte) ([]byte, error)); ok { + return rf(c1, c2) + } if rf, ok := ret.Get(0).(func([]byte, []byte) []byte); ok { r0 = rf(c1, c2) } else { @@ -26,7 +30,6 @@ func (_m *Pubkey) Add(c1 []byte, c2 []byte) ([]byte, error) { } } - var r1 error if rf, ok := ret.Get(1).(func([]byte, []byte) error); ok { r1 = rf(c1, c2) } else { @@ -41,6 +44,10 @@ func (_m *Pubkey) Encrypt(m []byte) ([]byte, error) { ret := _m.Called(m) var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func([]byte) ([]byte, error)); ok { + return rf(m) + } if rf, ok := ret.Get(0).(func([]byte) []byte); ok { r0 = rf(m) } else { @@ -49,7 +56,6 @@ func (_m *Pubkey) Encrypt(m []byte) ([]byte, error) { } } - var r1 error if rf, ok := ret.Get(1).(func([]byte) error); ok { r1 = rf(m) } else { @@ -80,6 +86,10 @@ func (_m *Pubkey) MulConst(c []byte, scalar *big.Int) ([]byte, error) { ret := _m.Called(c, scalar) var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func([]byte, *big.Int) ([]byte, error)); ok { + return rf(c, scalar) + } if rf, ok := ret.Get(0).(func([]byte, *big.Int) []byte); ok { r0 = rf(c, scalar) } else { @@ -88,7 +98,6 @@ func (_m *Pubkey) MulConst(c []byte, scalar *big.Int) ([]byte, error) { } } - var r1 error if rf, ok := ret.Get(1).(func([]byte, *big.Int) error); ok { r1 = rf(c, scalar) } else { @@ -127,3 +136,18 @@ func (_m *Pubkey) VerifyEnc(_a0 []byte) error { return r0 } + +type mockConstructorTestingTNewPubkey interface { + mock.TestingT + Cleanup(func()) +} + +// NewPubkey creates a new instance of Pubkey. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewPubkey(t mockConstructorTestingTNewPubkey) *Pubkey { + mock := &Pubkey{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/crypto/mta/mocks/Mta.go b/crypto/mta/mocks/Mta.go index 6ff61c2c..e43c9129 100644 --- a/crypto/mta/mocks/Mta.go +++ b/crypto/mta/mocks/Mta.go @@ -1,12 +1,12 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks import ( - elliptic "github.com/getamis/alice/crypto/elliptic" big "math/big" ecpointgrouplaw "github.com/getamis/alice/crypto/ecpointgrouplaw" + elliptic "github.com/getamis/alice/crypto/elliptic" homo "github.com/getamis/alice/crypto/homo" @@ -27,6 +27,11 @@ func (_m *Mta) Compute(publicKey homo.Pubkey, encMessage []byte) (*big.Int, *big ret := _m.Called(publicKey, encMessage) var r0 *big.Int + var r1 *big.Int + var r2 error + if rf, ok := ret.Get(0).(func(homo.Pubkey, []byte) (*big.Int, *big.Int, error)); ok { + return rf(publicKey, encMessage) + } if rf, ok := ret.Get(0).(func(homo.Pubkey, []byte) *big.Int); ok { r0 = rf(publicKey, encMessage) } else { @@ -35,7 +40,6 @@ func (_m *Mta) Compute(publicKey homo.Pubkey, encMessage []byte) (*big.Int, *big } } - var r1 *big.Int if rf, ok := ret.Get(1).(func(homo.Pubkey, []byte) *big.Int); ok { r1 = rf(publicKey, encMessage) } else { @@ -44,7 +48,6 @@ func (_m *Mta) Compute(publicKey homo.Pubkey, encMessage []byte) (*big.Int, *big } } - var r2 error if rf, ok := ret.Get(2).(func(homo.Pubkey, []byte) error); ok { r2 = rf(publicKey, encMessage) } else { @@ -59,6 +62,10 @@ func (_m *Mta) Decrypt(c *big.Int) (*big.Int, error) { ret := _m.Called(c) var r0 *big.Int + var r1 error + if rf, ok := ret.Get(0).(func(*big.Int) (*big.Int, error)); ok { + return rf(c) + } if rf, ok := ret.Get(0).(func(*big.Int) *big.Int); ok { r0 = rf(c) } else { @@ -67,7 +74,6 @@ func (_m *Mta) Decrypt(c *big.Int) (*big.Int, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(*big.Int) error); ok { r1 = rf(c) } else { @@ -114,6 +120,10 @@ func (_m *Mta) GetAProof(curve elliptic.Curve) (*zkproof.SchnorrProofMessage, er ret := _m.Called(curve) var r0 *zkproof.SchnorrProofMessage + var r1 error + if rf, ok := ret.Get(0).(func(elliptic.Curve) (*zkproof.SchnorrProofMessage, error)); ok { + return rf(curve) + } if rf, ok := ret.Get(0).(func(elliptic.Curve) *zkproof.SchnorrProofMessage); ok { r0 = rf(curve) } else { @@ -122,7 +132,6 @@ func (_m *Mta) GetAProof(curve elliptic.Curve) (*zkproof.SchnorrProofMessage, er } } - var r1 error if rf, ok := ret.Get(1).(func(elliptic.Curve) error); ok { r1 = rf(curve) } else { @@ -169,6 +178,10 @@ func (_m *Mta) GetProofWithCheck(curve elliptic.Curve, beta *big.Int) ([]byte, e ret := _m.Called(curve, beta) var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func(elliptic.Curve, *big.Int) ([]byte, error)); ok { + return rf(curve, beta) + } if rf, ok := ret.Get(0).(func(elliptic.Curve, *big.Int) []byte); ok { r0 = rf(curve, beta) } else { @@ -177,7 +190,6 @@ func (_m *Mta) GetProofWithCheck(curve elliptic.Curve, beta *big.Int) ([]byte, e } } - var r1 error if rf, ok := ret.Get(1).(func(elliptic.Curve, *big.Int) error); ok { r1 = rf(curve, beta) } else { @@ -192,6 +204,10 @@ func (_m *Mta) GetResult(alphas []*big.Int, betas []*big.Int) (*big.Int, error) ret := _m.Called(alphas, betas) var r0 *big.Int + var r1 error + if rf, ok := ret.Get(0).(func([]*big.Int, []*big.Int) (*big.Int, error)); ok { + return rf(alphas, betas) + } if rf, ok := ret.Get(0).(func([]*big.Int, []*big.Int) *big.Int); ok { r0 = rf(alphas, betas) } else { @@ -200,7 +216,6 @@ func (_m *Mta) GetResult(alphas []*big.Int, betas []*big.Int) (*big.Int, error) } } - var r1 error if rf, ok := ret.Get(1).(func([]*big.Int, []*big.Int) error); ok { r1 = rf(alphas, betas) } else { @@ -215,6 +230,10 @@ func (_m *Mta) OverrideA(newA *big.Int) (mta.Mta, error) { ret := _m.Called(newA) var r0 mta.Mta + var r1 error + if rf, ok := ret.Get(0).(func(*big.Int) (mta.Mta, error)); ok { + return rf(newA) + } if rf, ok := ret.Get(0).(func(*big.Int) mta.Mta); ok { r0 = rf(newA) } else { @@ -223,7 +242,6 @@ func (_m *Mta) OverrideA(newA *big.Int) (mta.Mta, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(*big.Int) error); ok { r1 = rf(newA) } else { @@ -238,6 +256,10 @@ func (_m *Mta) VerifyProofWithCheck(proof []byte, curve elliptic.Curve, alpha *b ret := _m.Called(proof, curve, alpha) var r0 *ecpointgrouplaw.ECPoint + var r1 error + if rf, ok := ret.Get(0).(func([]byte, elliptic.Curve, *big.Int) (*ecpointgrouplaw.ECPoint, error)); ok { + return rf(proof, curve, alpha) + } if rf, ok := ret.Get(0).(func([]byte, elliptic.Curve, *big.Int) *ecpointgrouplaw.ECPoint); ok { r0 = rf(proof, curve, alpha) } else { @@ -246,7 +268,6 @@ func (_m *Mta) VerifyProofWithCheck(proof []byte, curve elliptic.Curve, alpha *b } } - var r1 error if rf, ok := ret.Get(1).(func([]byte, elliptic.Curve, *big.Int) error); ok { r1 = rf(proof, curve, alpha) } else { @@ -255,3 +276,18 @@ func (_m *Mta) VerifyProofWithCheck(proof []byte, curve elliptic.Curve, alpha *b return r0, r1 } + +type mockConstructorTestingTNewMta interface { + mock.TestingT + Cleanup(func()) +} + +// NewMta creates a new instance of Mta. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewMta(t mockConstructorTestingTNewMta) *Mta { + mock := &Mta{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/crypto/oprf/hasher/mocks/Hasher.go b/crypto/oprf/hasher/mocks/Hasher.go new file mode 100644 index 00000000..292813c6 --- /dev/null +++ b/crypto/oprf/hasher/mocks/Hasher.go @@ -0,0 +1,73 @@ +// Code generated by mockery v2.27.1. DO NOT EDIT. + +package mocks + +import ( + big "math/big" + + ecpointgrouplaw "github.com/getamis/alice/crypto/ecpointgrouplaw" + + mock "github.com/stretchr/testify/mock" +) + +// Hasher is an autogenerated mock type for the Hasher type +type Hasher struct { + mock.Mock +} + +// GetN provides a mock function with given fields: +func (_m *Hasher) GetN() *big.Int { + ret := _m.Called() + + var r0 *big.Int + if rf, ok := ret.Get(0).(func() *big.Int); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*big.Int) + } + } + + return r0 +} + +// Hash provides a mock function with given fields: input +func (_m *Hasher) Hash(input []byte) (*ecpointgrouplaw.ECPoint, error) { + ret := _m.Called(input) + + var r0 *ecpointgrouplaw.ECPoint + var r1 error + if rf, ok := ret.Get(0).(func([]byte) (*ecpointgrouplaw.ECPoint, error)); ok { + return rf(input) + } + if rf, ok := ret.Get(0).(func([]byte) *ecpointgrouplaw.ECPoint); ok { + r0 = rf(input) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ecpointgrouplaw.ECPoint) + } + } + + if rf, ok := ret.Get(1).(func([]byte) error); ok { + r1 = rf(input) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +type mockConstructorTestingTNewHasher interface { + mock.TestingT + Cleanup(func()) +} + +// NewHasher creates a new instance of Hasher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewHasher(t mockConstructorTestingTNewHasher) *Hasher { + mock := &Hasher{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/types/message/mocks/EchoMessage.go b/types/message/mocks/EchoMessage.go index ead1162b..664507b1 100644 --- a/types/message/mocks/EchoMessage.go +++ b/types/message/mocks/EchoMessage.go @@ -1,14 +1,11 @@ -// Code generated by mockery v2.12.1. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks import ( - testing "testing" - + types "github.com/getamis/alice/types" mock "github.com/stretchr/testify/mock" protoreflect "google.golang.org/protobuf/reflect/protoreflect" - - types "github.com/getamis/alice/types" ) // EchoMessage is an autogenerated mock type for the EchoMessage type @@ -90,8 +87,13 @@ func (_m *EchoMessage) ProtoReflect() protoreflect.Message { return r0 } -// NewEchoMessage creates a new instance of EchoMessage. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations. -func NewEchoMessage(t testing.TB) *EchoMessage { +type mockConstructorTestingTNewEchoMessage interface { + mock.TestingT + Cleanup(func()) +} + +// NewEchoMessage creates a new instance of EchoMessage. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewEchoMessage(t mockConstructorTestingTNewEchoMessage) *EchoMessage { mock := &EchoMessage{} mock.Mock.Test(t) diff --git a/types/mocks/Handler.go b/types/mocks/Handler.go index 16eb284a..13c98c76 100644 --- a/types/mocks/Handler.go +++ b/types/mocks/Handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.12.1. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks @@ -6,8 +6,6 @@ import ( log "github.com/getamis/sirius/log" mock "github.com/stretchr/testify/mock" - testing "testing" - types "github.com/getamis/alice/types" ) @@ -21,6 +19,10 @@ func (_m *Handler) Finalize(logger log.Logger) (types.Handler, error) { ret := _m.Called(logger) var r0 types.Handler + var r1 error + if rf, ok := ret.Get(0).(func(log.Logger) (types.Handler, error)); ok { + return rf(logger) + } if rf, ok := ret.Get(0).(func(log.Logger) types.Handler); ok { r0 = rf(logger) } else { @@ -29,7 +31,6 @@ func (_m *Handler) Finalize(logger log.Logger) (types.Handler, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(log.Logger) error); ok { r1 = rf(logger) } else { @@ -95,8 +96,13 @@ func (_m *Handler) MessageType() types.MessageType { return r0 } -// NewHandler creates a new instance of Handler. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations. -func NewHandler(t testing.TB) *Handler { +type mockConstructorTestingTNewHandler interface { + mock.TestingT + Cleanup(func()) +} + +// NewHandler creates a new instance of Handler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewHandler(t mockConstructorTestingTNewHandler) *Handler { mock := &Handler{} mock.Mock.Test(t) diff --git a/types/mocks/Message.go b/types/mocks/Message.go index 6e2f074e..ec14fbb5 100644 --- a/types/mocks/Message.go +++ b/types/mocks/Message.go @@ -1,13 +1,10 @@ -// Code generated by mockery v2.12.1. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks import ( - testing "testing" - - mock "github.com/stretchr/testify/mock" - types "github.com/getamis/alice/types" + mock "github.com/stretchr/testify/mock" ) // Message is an autogenerated mock type for the Message type @@ -57,8 +54,13 @@ func (_m *Message) IsValid() bool { return r0 } -// NewMessage creates a new instance of Message. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations. -func NewMessage(t testing.TB) *Message { +type mockConstructorTestingTNewMessage interface { + mock.TestingT + Cleanup(func()) +} + +// NewMessage creates a new instance of Message. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewMessage(t mockConstructorTestingTNewMessage) *Message { mock := &Message{} mock.Mock.Test(t) diff --git a/types/mocks/MessageMain.go b/types/mocks/MessageMain.go index 9d49237f..1d6994ce 100644 --- a/types/mocks/MessageMain.go +++ b/types/mocks/MessageMain.go @@ -1,13 +1,10 @@ -// Code generated by mockery v2.12.1. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks import ( - testing "testing" - - mock "github.com/stretchr/testify/mock" - types "github.com/getamis/alice/types" + mock "github.com/stretchr/testify/mock" ) // MessageMain is an autogenerated mock type for the MessageMain type @@ -69,8 +66,13 @@ func (_m *MessageMain) Stop() { _m.Called() } -// NewMessageMain creates a new instance of MessageMain. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations. -func NewMessageMain(t testing.TB) *MessageMain { +type mockConstructorTestingTNewMessageMain interface { + mock.TestingT + Cleanup(func()) +} + +// NewMessageMain creates a new instance of MessageMain. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewMessageMain(t mockConstructorTestingTNewMessageMain) *MessageMain { mock := &MessageMain{} mock.Mock.Test(t) diff --git a/types/mocks/PeerManager.go b/types/mocks/PeerManager.go index 20628c28..f72f4ec1 100644 --- a/types/mocks/PeerManager.go +++ b/types/mocks/PeerManager.go @@ -1,12 +1,8 @@ -// Code generated by mockery v2.12.1. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks -import ( - testing "testing" - - mock "github.com/stretchr/testify/mock" -) +import mock "github.com/stretchr/testify/mock" // PeerManager is an autogenerated mock type for the PeerManager type type PeerManager struct { @@ -62,8 +58,13 @@ func (_m *PeerManager) SelfID() string { return r0 } -// NewPeerManager creates a new instance of PeerManager. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations. -func NewPeerManager(t testing.TB) *PeerManager { +type mockConstructorTestingTNewPeerManager interface { + mock.TestingT + Cleanup(func()) +} + +// NewPeerManager creates a new instance of PeerManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewPeerManager(t mockConstructorTestingTNewPeerManager) *PeerManager { mock := &PeerManager{} mock.Mock.Test(t) diff --git a/types/mocks/StateChangedListener.go b/types/mocks/StateChangedListener.go index f3e6ebd6..168eae28 100644 --- a/types/mocks/StateChangedListener.go +++ b/types/mocks/StateChangedListener.go @@ -1,13 +1,10 @@ -// Code generated by mockery v2.12.1. DO NOT EDIT. +// Code generated by mockery v2.27.1. DO NOT EDIT. package mocks import ( - testing "testing" - - mock "github.com/stretchr/testify/mock" - types "github.com/getamis/alice/types" + mock "github.com/stretchr/testify/mock" ) // StateChangedListener is an autogenerated mock type for the StateChangedListener type @@ -20,8 +17,13 @@ func (_m *StateChangedListener) OnStateChanged(oldState types.MainState, newStat _m.Called(oldState, newState) } -// NewStateChangedListener creates a new instance of StateChangedListener. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations. -func NewStateChangedListener(t testing.TB) *StateChangedListener { +type mockConstructorTestingTNewStateChangedListener interface { + mock.TestingT + Cleanup(func()) +} + +// NewStateChangedListener creates a new instance of StateChangedListener. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewStateChangedListener(t mockConstructorTestingTNewStateChangedListener) *StateChangedListener { mock := &StateChangedListener{} mock.Mock.Test(t)