github.com/lirm/aeron-go@v0.0.0-20230415210743-920325491dc4/aeron/testdata/mock_available_counter_handler.go (about) 1 // Copyright 2022 Steven Stern 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // TODO: The test fixtures are getting unwieldy, especially as we add more tests and will begin to reuse fixtures 16 // across tests. A common pattern in Go is to put fixtures under /testdata. If the aeron-go maintainers like this 17 // pattern, we can move them all here, and create a script to auto-update the mocks. 18 19 package testdata 20 21 import ( 22 "github.com/lirm/aeron-go/aeron/counters" 23 "github.com/stretchr/testify/mock" 24 ) 25 26 // If AvailableCounterHandler changes, recreate the mock code with the below command. 27 // mockery --name=AvailableCounterHandler --inpackage --structname=MockAvailableCounterHandler --print 28 29 // Code generated by mockery v2.14.0. DO NOT EDIT. 30 31 // MockAvailableCounterHandler is an autogenerated mock type for the AvailableCounterHandler type 32 type MockAvailableCounterHandler struct { 33 mock.Mock 34 } 35 36 // Handle provides a mock function with given fields: countersReader, registrationId, counterId 37 func (_m *MockAvailableCounterHandler) Handle(countersReader *counters.Reader, registrationId int64, counterId int32) { 38 _m.Called(countersReader, registrationId, counterId) 39 } 40 41 type mockConstructorTestingTNewMockAvailableCounterHandler interface { 42 mock.TestingT 43 Cleanup(func()) 44 } 45 46 // NewMockAvailableCounterHandler creates a new instance of MockAvailableCounterHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. 47 func NewMockAvailableCounterHandler(t mockConstructorTestingTNewMockAvailableCounterHandler) *MockAvailableCounterHandler { 48 mock := &MockAvailableCounterHandler{} 49 mock.Mock.Test(t) 50 51 t.Cleanup(func() { mock.AssertExpectations(t) }) 52 53 return mock 54 }