diff --git a/api/mock.go b/api/mock.go index 0fb7eb3542..2051673434 100644 --- a/api/mock.go +++ b/api/mock.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/evcc-io/evcc/api (interfaces: Charger,ChargeState,CurrentLimiter,PhaseSwitcher,Identifier,Meter,MeterEnergy,Vehicle,ChargeRater,Battery,Tariff,BatteryController) +// +// Generated by this command: +// +// mockgen -package api -destination mock.go github.com/evcc-io/evcc/api Charger,ChargeState,CurrentLimiter,PhaseSwitcher,Identifier,Meter,MeterEnergy,Vehicle,ChargeRater,Battery,Tariff,BatteryController +// // Package api is a generated GoMock package. package api @@ -7,7 +12,7 @@ package api import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockCharger is a mock of Charger interface. @@ -42,7 +47,7 @@ func (m *MockCharger) Enable(arg0 bool) error { } // Enable indicates an expected call of Enable. -func (mr *MockChargerMockRecorder) Enable(arg0 interface{}) *gomock.Call { +func (mr *MockChargerMockRecorder) Enable(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Enable", reflect.TypeOf((*MockCharger)(nil).Enable), arg0) } @@ -71,7 +76,7 @@ func (m *MockCharger) MaxCurrent(arg0 int64) error { } // MaxCurrent indicates an expected call of MaxCurrent. -func (mr *MockChargerMockRecorder) MaxCurrent(arg0 interface{}) *gomock.Call { +func (mr *MockChargerMockRecorder) MaxCurrent(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MaxCurrent", reflect.TypeOf((*MockCharger)(nil).MaxCurrent), arg0) } @@ -200,7 +205,7 @@ func (m *MockPhaseSwitcher) Phases1p3p(arg0 int) error { } // Phases1p3p indicates an expected call of Phases1p3p. -func (mr *MockPhaseSwitcherMockRecorder) Phases1p3p(arg0 interface{}) *gomock.Call { +func (mr *MockPhaseSwitcherMockRecorder) Phases1p3p(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Phases1p3p", reflect.TypeOf((*MockPhaseSwitcher)(nil).Phases1p3p), arg0) } @@ -419,7 +424,7 @@ func (m *MockVehicle) SetTitle(arg0 string) { } // SetTitle indicates an expected call of SetTitle. -func (mr *MockVehicleMockRecorder) SetTitle(arg0 interface{}) *gomock.Call { +func (mr *MockVehicleMockRecorder) SetTitle(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTitle", reflect.TypeOf((*MockVehicle)(nil).SetTitle), arg0) } @@ -613,7 +618,7 @@ func (m *MockBatteryController) SetBatteryMode(arg0 BatteryMode) error { } // SetBatteryMode indicates an expected call of SetBatteryMode. -func (mr *MockBatteryControllerMockRecorder) SetBatteryMode(arg0 interface{}) *gomock.Call { +func (mr *MockBatteryControllerMockRecorder) SetBatteryMode(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetBatteryMode", reflect.TypeOf((*MockBatteryController)(nil).SetBatteryMode), arg0) } diff --git a/charger/eebus.go b/charger/eebus.go index 5a562cc4ca..7b855d7bc8 100644 --- a/charger/eebus.go +++ b/charger/eebus.go @@ -16,6 +16,8 @@ import ( "github.com/evcc-io/evcc/util" ) +//go:generate mockgen -package charger -destination eebus_test_mock.go github.com/enbility/cemd/emobility EmobilityI + const ( maxIdRequestTimespan = time.Second * 120 idleFactor = 0.6 diff --git a/charger/eebus_test.go b/charger/eebus_test.go index 687a2f8f76..68570b2917 100644 --- a/charger/eebus_test.go +++ b/charger/eebus_test.go @@ -3,8 +3,7 @@ package charger import ( "testing" - "github.com/enbility/cemd/emobility" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" ) func TestEEBusIsCharging(t *testing.T) { @@ -117,7 +116,7 @@ func TestEEBusIsCharging(t *testing.T) { for index, m := range tc.measurements { ctrl := gomock.NewController(t) - emobilityMock := emobility.NewMockEmobilityI(ctrl) + emobilityMock := NewMockEmobilityI(ctrl) eebus := &EEBus{ emobility: emobilityMock, } diff --git a/charger/eebus_test_mock.go b/charger/eebus_test_mock.go new file mode 100644 index 0000000000..bc42eaaeb5 --- /dev/null +++ b/charger/eebus_test_mock.go @@ -0,0 +1,350 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/enbility/cemd/emobility (interfaces: EmobilityI) +// +// Generated by this command: +// +// mockgen -package charger -destination eebus_test_mock.go github.com/enbility/cemd/emobility EmobilityI +// + +// Package charger is a generated GoMock package. +package charger + +import ( + reflect "reflect" + + emobility "github.com/enbility/cemd/emobility" + gomock "go.uber.org/mock/gomock" +) + +// MockEmobilityI is a mock of EmobilityI interface. +type MockEmobilityI struct { + ctrl *gomock.Controller + recorder *MockEmobilityIMockRecorder +} + +// MockEmobilityIMockRecorder is the mock recorder for MockEmobilityI. +type MockEmobilityIMockRecorder struct { + mock *MockEmobilityI +} + +// NewMockEmobilityI creates a new mock instance. +func NewMockEmobilityI(ctrl *gomock.Controller) *MockEmobilityI { + mock := &MockEmobilityI{ctrl: ctrl} + mock.recorder = &MockEmobilityIMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockEmobilityI) EXPECT() *MockEmobilityIMockRecorder { + return m.recorder +} + +// EVChargeStrategy mocks base method. +func (m *MockEmobilityI) EVChargeStrategy() emobility.EVChargeStrategyType { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVChargeStrategy") + ret0, _ := ret[0].(emobility.EVChargeStrategyType) + return ret0 +} + +// EVChargeStrategy indicates an expected call of EVChargeStrategy. +func (mr *MockEmobilityIMockRecorder) EVChargeStrategy() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVChargeStrategy", reflect.TypeOf((*MockEmobilityI)(nil).EVChargeStrategy)) +} + +// EVChargedEnergy mocks base method. +func (m *MockEmobilityI) EVChargedEnergy() (float64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVChargedEnergy") + ret0, _ := ret[0].(float64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EVChargedEnergy indicates an expected call of EVChargedEnergy. +func (mr *MockEmobilityIMockRecorder) EVChargedEnergy() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVChargedEnergy", reflect.TypeOf((*MockEmobilityI)(nil).EVChargedEnergy)) +} + +// EVCommunicationStandard mocks base method. +func (m *MockEmobilityI) EVCommunicationStandard() (emobility.EVCommunicationStandardType, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVCommunicationStandard") + ret0, _ := ret[0].(emobility.EVCommunicationStandardType) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EVCommunicationStandard indicates an expected call of EVCommunicationStandard. +func (mr *MockEmobilityIMockRecorder) EVCommunicationStandard() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVCommunicationStandard", reflect.TypeOf((*MockEmobilityI)(nil).EVCommunicationStandard)) +} + +// EVConnected mocks base method. +func (m *MockEmobilityI) EVConnected() bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVConnected") + ret0, _ := ret[0].(bool) + return ret0 +} + +// EVConnected indicates an expected call of EVConnected. +func (mr *MockEmobilityIMockRecorder) EVConnected() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVConnected", reflect.TypeOf((*MockEmobilityI)(nil).EVConnected)) +} + +// EVConnectedPhases mocks base method. +func (m *MockEmobilityI) EVConnectedPhases() (uint, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVConnectedPhases") + ret0, _ := ret[0].(uint) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EVConnectedPhases indicates an expected call of EVConnectedPhases. +func (mr *MockEmobilityIMockRecorder) EVConnectedPhases() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVConnectedPhases", reflect.TypeOf((*MockEmobilityI)(nil).EVConnectedPhases)) +} + +// EVCoordinatedChargingSupported mocks base method. +func (m *MockEmobilityI) EVCoordinatedChargingSupported() (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVCoordinatedChargingSupported") + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EVCoordinatedChargingSupported indicates an expected call of EVCoordinatedChargingSupported. +func (mr *MockEmobilityIMockRecorder) EVCoordinatedChargingSupported() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVCoordinatedChargingSupported", reflect.TypeOf((*MockEmobilityI)(nil).EVCoordinatedChargingSupported)) +} + +// EVCurrentChargeState mocks base method. +func (m *MockEmobilityI) EVCurrentChargeState() (emobility.EVChargeStateType, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVCurrentChargeState") + ret0, _ := ret[0].(emobility.EVChargeStateType) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EVCurrentChargeState indicates an expected call of EVCurrentChargeState. +func (mr *MockEmobilityIMockRecorder) EVCurrentChargeState() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVCurrentChargeState", reflect.TypeOf((*MockEmobilityI)(nil).EVCurrentChargeState)) +} + +// EVCurrentLimits mocks base method. +func (m *MockEmobilityI) EVCurrentLimits() ([]float64, []float64, []float64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVCurrentLimits") + ret0, _ := ret[0].([]float64) + ret1, _ := ret[1].([]float64) + ret2, _ := ret[2].([]float64) + ret3, _ := ret[3].(error) + return ret0, ret1, ret2, ret3 +} + +// EVCurrentLimits indicates an expected call of EVCurrentLimits. +func (mr *MockEmobilityIMockRecorder) EVCurrentLimits() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVCurrentLimits", reflect.TypeOf((*MockEmobilityI)(nil).EVCurrentLimits)) +} + +// EVCurrentsPerPhase mocks base method. +func (m *MockEmobilityI) EVCurrentsPerPhase() ([]float64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVCurrentsPerPhase") + ret0, _ := ret[0].([]float64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EVCurrentsPerPhase indicates an expected call of EVCurrentsPerPhase. +func (mr *MockEmobilityIMockRecorder) EVCurrentsPerPhase() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVCurrentsPerPhase", reflect.TypeOf((*MockEmobilityI)(nil).EVCurrentsPerPhase)) +} + +// EVEnergyDemand mocks base method. +func (m *MockEmobilityI) EVEnergyDemand() (emobility.EVDemand, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVEnergyDemand") + ret0, _ := ret[0].(emobility.EVDemand) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EVEnergyDemand indicates an expected call of EVEnergyDemand. +func (mr *MockEmobilityIMockRecorder) EVEnergyDemand() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVEnergyDemand", reflect.TypeOf((*MockEmobilityI)(nil).EVEnergyDemand)) +} + +// EVGetIncentiveConstraints mocks base method. +func (m *MockEmobilityI) EVGetIncentiveConstraints() emobility.EVIncentiveSlotConstraints { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVGetIncentiveConstraints") + ret0, _ := ret[0].(emobility.EVIncentiveSlotConstraints) + return ret0 +} + +// EVGetIncentiveConstraints indicates an expected call of EVGetIncentiveConstraints. +func (mr *MockEmobilityIMockRecorder) EVGetIncentiveConstraints() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVGetIncentiveConstraints", reflect.TypeOf((*MockEmobilityI)(nil).EVGetIncentiveConstraints)) +} + +// EVGetPowerConstraints mocks base method. +func (m *MockEmobilityI) EVGetPowerConstraints() emobility.EVTimeSlotConstraints { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVGetPowerConstraints") + ret0, _ := ret[0].(emobility.EVTimeSlotConstraints) + return ret0 +} + +// EVGetPowerConstraints indicates an expected call of EVGetPowerConstraints. +func (mr *MockEmobilityIMockRecorder) EVGetPowerConstraints() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVGetPowerConstraints", reflect.TypeOf((*MockEmobilityI)(nil).EVGetPowerConstraints)) +} + +// EVIdentification mocks base method. +func (m *MockEmobilityI) EVIdentification() (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVIdentification") + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EVIdentification indicates an expected call of EVIdentification. +func (mr *MockEmobilityIMockRecorder) EVIdentification() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVIdentification", reflect.TypeOf((*MockEmobilityI)(nil).EVIdentification)) +} + +// EVLoadControlObligationLimits mocks base method. +func (m *MockEmobilityI) EVLoadControlObligationLimits() ([]float64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVLoadControlObligationLimits") + ret0, _ := ret[0].([]float64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EVLoadControlObligationLimits indicates an expected call of EVLoadControlObligationLimits. +func (mr *MockEmobilityIMockRecorder) EVLoadControlObligationLimits() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVLoadControlObligationLimits", reflect.TypeOf((*MockEmobilityI)(nil).EVLoadControlObligationLimits)) +} + +// EVOptimizationOfSelfConsumptionSupported mocks base method. +func (m *MockEmobilityI) EVOptimizationOfSelfConsumptionSupported() (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVOptimizationOfSelfConsumptionSupported") + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EVOptimizationOfSelfConsumptionSupported indicates an expected call of EVOptimizationOfSelfConsumptionSupported. +func (mr *MockEmobilityIMockRecorder) EVOptimizationOfSelfConsumptionSupported() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVOptimizationOfSelfConsumptionSupported", reflect.TypeOf((*MockEmobilityI)(nil).EVOptimizationOfSelfConsumptionSupported)) +} + +// EVPowerPerPhase mocks base method. +func (m *MockEmobilityI) EVPowerPerPhase() ([]float64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVPowerPerPhase") + ret0, _ := ret[0].([]float64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EVPowerPerPhase indicates an expected call of EVPowerPerPhase. +func (mr *MockEmobilityIMockRecorder) EVPowerPerPhase() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVPowerPerPhase", reflect.TypeOf((*MockEmobilityI)(nil).EVPowerPerPhase)) +} + +// EVSoC mocks base method. +func (m *MockEmobilityI) EVSoC() (float64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVSoC") + ret0, _ := ret[0].(float64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EVSoC indicates an expected call of EVSoC. +func (mr *MockEmobilityIMockRecorder) EVSoC() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVSoC", reflect.TypeOf((*MockEmobilityI)(nil).EVSoC)) +} + +// EVSoCSupported mocks base method. +func (m *MockEmobilityI) EVSoCSupported() (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVSoCSupported") + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EVSoCSupported indicates an expected call of EVSoCSupported. +func (mr *MockEmobilityIMockRecorder) EVSoCSupported() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVSoCSupported", reflect.TypeOf((*MockEmobilityI)(nil).EVSoCSupported)) +} + +// EVWriteIncentives mocks base method. +func (m *MockEmobilityI) EVWriteIncentives(arg0 []emobility.EVDurationSlotValue) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVWriteIncentives", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// EVWriteIncentives indicates an expected call of EVWriteIncentives. +func (mr *MockEmobilityIMockRecorder) EVWriteIncentives(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVWriteIncentives", reflect.TypeOf((*MockEmobilityI)(nil).EVWriteIncentives), arg0) +} + +// EVWriteLoadControlLimits mocks base method. +func (m *MockEmobilityI) EVWriteLoadControlLimits(arg0, arg1 []float64) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVWriteLoadControlLimits", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// EVWriteLoadControlLimits indicates an expected call of EVWriteLoadControlLimits. +func (mr *MockEmobilityIMockRecorder) EVWriteLoadControlLimits(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVWriteLoadControlLimits", reflect.TypeOf((*MockEmobilityI)(nil).EVWriteLoadControlLimits), arg0, arg1) +} + +// EVWritePowerLimits mocks base method. +func (m *MockEmobilityI) EVWritePowerLimits(arg0 []emobility.EVDurationSlotValue) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EVWritePowerLimits", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// EVWritePowerLimits indicates an expected call of EVWritePowerLimits. +func (mr *MockEmobilityIMockRecorder) EVWritePowerLimits(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EVWritePowerLimits", reflect.TypeOf((*MockEmobilityI)(nil).EVWritePowerLimits), arg0) +} diff --git a/core/coordinator/coordinator_test.go b/core/coordinator/coordinator_test.go index 5b3dd9d172..5af8eec15f 100644 --- a/core/coordinator/coordinator_test.go +++ b/core/coordinator/coordinator_test.go @@ -6,7 +6,7 @@ import ( "github.com/evcc-io/evcc/api" "github.com/evcc-io/evcc/core/loadpoint" "github.com/evcc-io/evcc/util" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" ) func TestVehicleDetectByStatus(t *testing.T) { diff --git a/core/loadpoint/mock.go b/core/loadpoint/mock.go index 8138ff1a07..3d69145f79 100644 --- a/core/loadpoint/mock.go +++ b/core/loadpoint/mock.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/evcc-io/evcc/core/loadpoint (interfaces: API) +// +// Generated by this command: +// +// mockgen -package loadpoint -destination mock.go -mock_names API=MockAPI github.com/evcc-io/evcc/core/loadpoint API +// // Package loadpoint is a generated GoMock package. package loadpoint @@ -9,7 +14,7 @@ import ( time "time" api "github.com/evcc-io/evcc/api" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockAPI is a mock of API interface. @@ -255,7 +260,7 @@ func (m *MockAPI) GetPlan(arg0 time.Time, arg1 time.Duration) (api.Rates, error) } // GetPlan indicates an expected call of GetPlan. -func (mr *MockAPIMockRecorder) GetPlan(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) GetPlan(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPlan", reflect.TypeOf((*MockAPI)(nil).GetPlan), arg0, arg1) } @@ -313,7 +318,7 @@ func (m *MockAPI) GetPlanRequiredDuration(arg0, arg1 float64) time.Duration { } // GetPlanRequiredDuration indicates an expected call of GetPlanRequiredDuration. -func (mr *MockAPIMockRecorder) GetPlanRequiredDuration(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) GetPlanRequiredDuration(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPlanRequiredDuration", reflect.TypeOf((*MockAPI)(nil).GetPlanRequiredDuration), arg0, arg1) } @@ -421,7 +426,7 @@ func (m *MockAPI) RemoteControl(arg0 string, arg1 RemoteDemand) { } // RemoteControl indicates an expected call of RemoteControl. -func (mr *MockAPIMockRecorder) RemoteControl(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) RemoteControl(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoteControl", reflect.TypeOf((*MockAPI)(nil).RemoteControl), arg0, arg1) } @@ -433,7 +438,7 @@ func (m *MockAPI) SetDisableThreshold(arg0 float64) { } // SetDisableThreshold indicates an expected call of SetDisableThreshold. -func (mr *MockAPIMockRecorder) SetDisableThreshold(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) SetDisableThreshold(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDisableThreshold", reflect.TypeOf((*MockAPI)(nil).SetDisableThreshold), arg0) } @@ -445,7 +450,7 @@ func (m *MockAPI) SetEnableThreshold(arg0 float64) { } // SetEnableThreshold indicates an expected call of SetEnableThreshold. -func (mr *MockAPIMockRecorder) SetEnableThreshold(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) SetEnableThreshold(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetEnableThreshold", reflect.TypeOf((*MockAPI)(nil).SetEnableThreshold), arg0) } @@ -457,7 +462,7 @@ func (m *MockAPI) SetLimitEnergy(arg0 float64) { } // SetLimitEnergy indicates an expected call of SetLimitEnergy. -func (mr *MockAPIMockRecorder) SetLimitEnergy(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) SetLimitEnergy(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLimitEnergy", reflect.TypeOf((*MockAPI)(nil).SetLimitEnergy), arg0) } @@ -469,7 +474,7 @@ func (m *MockAPI) SetLimitSoc(arg0 int) { } // SetLimitSoc indicates an expected call of SetLimitSoc. -func (mr *MockAPIMockRecorder) SetLimitSoc(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) SetLimitSoc(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLimitSoc", reflect.TypeOf((*MockAPI)(nil).SetLimitSoc), arg0) } @@ -481,7 +486,7 @@ func (m *MockAPI) SetMaxCurrent(arg0 float64) { } // SetMaxCurrent indicates an expected call of SetMaxCurrent. -func (mr *MockAPIMockRecorder) SetMaxCurrent(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) SetMaxCurrent(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetMaxCurrent", reflect.TypeOf((*MockAPI)(nil).SetMaxCurrent), arg0) } @@ -493,7 +498,7 @@ func (m *MockAPI) SetMinCurrent(arg0 float64) { } // SetMinCurrent indicates an expected call of SetMinCurrent. -func (mr *MockAPIMockRecorder) SetMinCurrent(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) SetMinCurrent(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetMinCurrent", reflect.TypeOf((*MockAPI)(nil).SetMinCurrent), arg0) } @@ -505,7 +510,7 @@ func (m *MockAPI) SetMode(arg0 api.ChargeMode) { } // SetMode indicates an expected call of SetMode. -func (mr *MockAPIMockRecorder) SetMode(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) SetMode(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetMode", reflect.TypeOf((*MockAPI)(nil).SetMode), arg0) } @@ -519,7 +524,7 @@ func (m *MockAPI) SetPhases(arg0 int) error { } // SetPhases indicates an expected call of SetPhases. -func (mr *MockAPIMockRecorder) SetPhases(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) SetPhases(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPhases", reflect.TypeOf((*MockAPI)(nil).SetPhases), arg0) } @@ -533,7 +538,7 @@ func (m *MockAPI) SetPlanEnergy(arg0 time.Time, arg1 float64) error { } // SetPlanEnergy indicates an expected call of SetPlanEnergy. -func (mr *MockAPIMockRecorder) SetPlanEnergy(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) SetPlanEnergy(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPlanEnergy", reflect.TypeOf((*MockAPI)(nil).SetPlanEnergy), arg0, arg1) } @@ -545,7 +550,7 @@ func (m *MockAPI) SetPriority(arg0 int) { } // SetPriority indicates an expected call of SetPriority. -func (mr *MockAPIMockRecorder) SetPriority(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) SetPriority(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPriority", reflect.TypeOf((*MockAPI)(nil).SetPriority), arg0) } @@ -557,7 +562,7 @@ func (m *MockAPI) SetVehicle(arg0 api.Vehicle) { } // SetVehicle indicates an expected call of SetVehicle. -func (mr *MockAPIMockRecorder) SetVehicle(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) SetVehicle(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetVehicle", reflect.TypeOf((*MockAPI)(nil).SetVehicle), arg0) } diff --git a/core/loadpoint_effective_test.go b/core/loadpoint_effective_test.go index 060a836fbc..52e2957a79 100644 --- a/core/loadpoint_effective_test.go +++ b/core/loadpoint_effective_test.go @@ -5,8 +5,8 @@ import ( "github.com/evcc-io/evcc/api" "github.com/evcc-io/evcc/util" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" ) func TestEffectiveLimitSoc(t *testing.T) { diff --git a/core/loadpoint_phases_test.go b/core/loadpoint_phases_test.go index 2c92c06849..363aa2e4ea 100644 --- a/core/loadpoint_phases_test.go +++ b/core/loadpoint_phases_test.go @@ -9,7 +9,7 @@ import ( "github.com/benbjohnson/clock" "github.com/evcc-io/evcc/api" "github.com/evcc-io/evcc/util" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" ) type testCase struct { diff --git a/core/loadpoint_session_test.go b/core/loadpoint_session_test.go index 2b2a4840f9..412d4f5ff3 100644 --- a/core/loadpoint_session_test.go +++ b/core/loadpoint_session_test.go @@ -9,9 +9,9 @@ import ( "github.com/evcc-io/evcc/core/session" serverdb "github.com/evcc-io/evcc/server/db" "github.com/evcc-io/evcc/util" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" ) func TestSession(t *testing.T) { diff --git a/core/loadpoint_sync_test.go b/core/loadpoint_sync_test.go index 26096c87bc..995d28aacb 100644 --- a/core/loadpoint_sync_test.go +++ b/core/loadpoint_sync_test.go @@ -6,9 +6,9 @@ import ( "github.com/benbjohnson/clock" "github.com/evcc-io/evcc/api" "github.com/evcc-io/evcc/util" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" ) func TestSyncCharger(t *testing.T) { diff --git a/core/loadpoint_test.go b/core/loadpoint_test.go index a08ab6c494..d5c129834d 100644 --- a/core/loadpoint_test.go +++ b/core/loadpoint_test.go @@ -10,7 +10,7 @@ import ( "github.com/evcc-io/evcc/core/soc" "github.com/evcc-io/evcc/push" "github.com/evcc-io/evcc/util" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" ) const ( diff --git a/core/loadpoint_vehicle_test.go b/core/loadpoint_vehicle_test.go index 9597d4cbc3..600105e30e 100644 --- a/core/loadpoint_vehicle_test.go +++ b/core/loadpoint_vehicle_test.go @@ -11,8 +11,8 @@ import ( "github.com/evcc-io/evcc/core/coordinator" "github.com/evcc-io/evcc/core/soc" "github.com/evcc-io/evcc/util" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" ) func TestPublishSocAndRange(t *testing.T) { diff --git a/core/planner/planner_test.go b/core/planner/planner_test.go index 507311fdd3..05f27fa9b3 100644 --- a/core/planner/planner_test.go +++ b/core/planner/planner_test.go @@ -8,9 +8,9 @@ import ( "github.com/benbjohnson/clock" "github.com/evcc-io/evcc/api" "github.com/evcc-io/evcc/util" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" ) func rates(prices []float64, start time.Time, slotDuration time.Duration) api.Rates { diff --git a/core/prioritizer/prioritizer_test.go b/core/prioritizer/prioritizer_test.go index 2e45bd8df8..870b3aba4d 100644 --- a/core/prioritizer/prioritizer_test.go +++ b/core/prioritizer/prioritizer_test.go @@ -4,8 +4,8 @@ import ( "testing" "github.com/evcc-io/evcc/core/loadpoint" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" ) func TestPrioritzer(t *testing.T) { diff --git a/core/site_battery_test.go b/core/site_battery_test.go index 6cd68636ac..e2ecda525c 100644 --- a/core/site_battery_test.go +++ b/core/site_battery_test.go @@ -6,9 +6,9 @@ import ( "github.com/evcc-io/evcc/api" "github.com/evcc-io/evcc/core/loadpoint" "github.com/evcc-io/evcc/util" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" ) func TestDetermineBatteryMode(t *testing.T) { diff --git a/core/soc/estimator_test.go b/core/soc/estimator_test.go index 4d5fe8bfb4..9c30eeef86 100644 --- a/core/soc/estimator_test.go +++ b/core/soc/estimator_test.go @@ -7,8 +7,8 @@ import ( "github.com/evcc-io/evcc/api" "github.com/evcc-io/evcc/util" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" ) func TestRemainingChargeDuration(t *testing.T) { diff --git a/core/vehicle/mock.go b/core/vehicle/mock.go index 4da01bc244..a2fa746e1c 100644 --- a/core/vehicle/mock.go +++ b/core/vehicle/mock.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/evcc-io/evcc/core/vehicle (interfaces: API) +// +// Generated by this command: +// +// mockgen -package vehicle -destination mock.go -mock_names API=MockAPI github.com/evcc-io/evcc/core/vehicle API +// // Package vehicle is a generated GoMock package. package vehicle @@ -9,7 +14,7 @@ import ( time "time" api "github.com/evcc-io/evcc/api" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockAPI is a mock of API interface. @@ -113,7 +118,7 @@ func (m *MockAPI) SetLimitSoc(arg0 int) { } // SetLimitSoc indicates an expected call of SetLimitSoc. -func (mr *MockAPIMockRecorder) SetLimitSoc(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) SetLimitSoc(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLimitSoc", reflect.TypeOf((*MockAPI)(nil).SetLimitSoc), arg0) } @@ -125,7 +130,7 @@ func (m *MockAPI) SetMinSoc(arg0 int) { } // SetMinSoc indicates an expected call of SetMinSoc. -func (mr *MockAPIMockRecorder) SetMinSoc(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) SetMinSoc(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetMinSoc", reflect.TypeOf((*MockAPI)(nil).SetMinSoc), arg0) } @@ -139,7 +144,7 @@ func (m *MockAPI) SetPlanSoc(arg0 time.Time, arg1 int) error { } // SetPlanSoc indicates an expected call of SetPlanSoc. -func (mr *MockAPIMockRecorder) SetPlanSoc(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) SetPlanSoc(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPlanSoc", reflect.TypeOf((*MockAPI)(nil).SetPlanSoc), arg0, arg1) } diff --git a/core/wrapper/chargemeter_test.go b/core/wrapper/chargemeter_test.go index a02bd23387..26276ccfad 100644 --- a/core/wrapper/chargemeter_test.go +++ b/core/wrapper/chargemeter_test.go @@ -3,7 +3,7 @@ package wrapper import ( "testing" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" ) func TestProxyChargeMeter(t *testing.T) { diff --git a/core/wrapper/chargerater_test.go b/core/wrapper/chargerater_test.go index 5fea988af5..8af799d1a9 100644 --- a/core/wrapper/chargerater_test.go +++ b/core/wrapper/chargerater_test.go @@ -7,7 +7,7 @@ import ( "github.com/benbjohnson/clock" "github.com/evcc-io/evcc/api" "github.com/evcc-io/evcc/util" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" ) func TestNoMeter(t *testing.T) { diff --git a/go.mod b/go.mod index 267ccdbe50..41d40f6a8e 100644 --- a/go.mod +++ b/go.mod @@ -37,7 +37,6 @@ require ( github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 github.com/godbus/dbus/v5 v5.1.0 github.com/gokrazy/updater v0.0.0-20230215172637-813ccc7f21e2 - github.com/golang/mock v1.6.0 github.com/google/go-github/v32 v32.1.0 github.com/google/uuid v1.5.0 github.com/gorilla/handlers v1.5.2 @@ -90,6 +89,7 @@ require ( github.com/volkszaehler/mbmd v0.0.0-20231215091549-af16b1f597b9 github.com/writeas/go-strip-markdown/v2 v2.1.1 gitlab.com/bboehmke/sunny v0.16.0 + go.uber.org/mock v0.4.0 golang.org/x/crypto/x509roots/fallback v0.0.0-20231218163308-9d2ee975ef9f golang.org/x/exp v0.0.0-20231219180239-dc181d75b848 golang.org/x/net v0.19.0 @@ -130,6 +130,7 @@ require ( github.com/gobwas/httphead v0.1.0 // indirect github.com/gobwas/pool v0.2.1 // indirect github.com/gobwas/ws v1.3.1 // indirect + github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/gorilla/websocket v1.5.1 // indirect diff --git a/go.sum b/go.sum index 770dfe38ac..0e0f167b40 100644 --- a/go.sum +++ b/go.sum @@ -703,6 +703,8 @@ go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= diff --git a/tools.go b/tools.go index 03087581f7..d27705adb8 100644 --- a/tools.go +++ b/tools.go @@ -4,5 +4,5 @@ package main import ( _ "github.com/dmarkham/enumer" - _ "github.com/golang/mock/mockgen" + _ "go.uber.org/mock/mockgen" )