github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/network/p2p/mock/stream_factory.go (about) 1 // Code generated by mockery v2.21.4. DO NOT EDIT. 2 3 package mockp2p 4 5 import ( 6 context "context" 7 8 network "github.com/libp2p/go-libp2p/core/network" 9 mock "github.com/stretchr/testify/mock" 10 11 peer "github.com/libp2p/go-libp2p/core/peer" 12 13 protocol "github.com/libp2p/go-libp2p/core/protocol" 14 ) 15 16 // StreamFactory is an autogenerated mock type for the StreamFactory type 17 type StreamFactory struct { 18 mock.Mock 19 } 20 21 // NewStream provides a mock function with given fields: _a0, _a1, _a2 22 func (_m *StreamFactory) NewStream(_a0 context.Context, _a1 peer.ID, _a2 protocol.ID) (network.Stream, error) { 23 ret := _m.Called(_a0, _a1, _a2) 24 25 var r0 network.Stream 26 var r1 error 27 if rf, ok := ret.Get(0).(func(context.Context, peer.ID, protocol.ID) (network.Stream, error)); ok { 28 return rf(_a0, _a1, _a2) 29 } 30 if rf, ok := ret.Get(0).(func(context.Context, peer.ID, protocol.ID) network.Stream); ok { 31 r0 = rf(_a0, _a1, _a2) 32 } else { 33 if ret.Get(0) != nil { 34 r0 = ret.Get(0).(network.Stream) 35 } 36 } 37 38 if rf, ok := ret.Get(1).(func(context.Context, peer.ID, protocol.ID) error); ok { 39 r1 = rf(_a0, _a1, _a2) 40 } else { 41 r1 = ret.Error(1) 42 } 43 44 return r0, r1 45 } 46 47 // SetStreamHandler provides a mock function with given fields: _a0, _a1 48 func (_m *StreamFactory) SetStreamHandler(_a0 protocol.ID, _a1 network.StreamHandler) { 49 _m.Called(_a0, _a1) 50 } 51 52 type mockConstructorTestingTNewStreamFactory interface { 53 mock.TestingT 54 Cleanup(func()) 55 } 56 57 // NewStreamFactory creates a new instance of StreamFactory. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. 58 func NewStreamFactory(t mockConstructorTestingTNewStreamFactory) *StreamFactory { 59 mock := &StreamFactory{} 60 mock.Mock.Test(t) 61 62 t.Cleanup(func() { mock.AssertExpectations(t) }) 63 64 return mock 65 }