From 541ba0a5fa983e38d54d99c69fb410c70585b40d Mon Sep 17 00:00:00 2001 From: Simon Thelen Date: Fri, 29 Nov 2024 11:01:22 +0100 Subject: [PATCH] Check AddFeatures return values in tests --- usecases/cs/lpc/testhelper_test.go | 3 ++- usecases/cs/lpp/testhelper_test.go | 3 ++- usecases/mu/mpc/testhelper_test.go | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/usecases/cs/lpc/testhelper_test.go b/usecases/cs/lpc/testhelper_test.go index e9028196..f48a8878 100644 --- a/usecases/cs/lpc/testhelper_test.go +++ b/usecases/cs/lpc/testhelper_test.go @@ -16,6 +16,7 @@ import ( "github.com/enbility/spine-go/model" "github.com/enbility/spine-go/spine" "github.com/enbility/spine-go/util" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" ) @@ -76,7 +77,7 @@ func (s *CsLPCSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewLPC(localEntity, s.Event) - _ = s.sut.AddFeatures() + assert.Nil(s.T(), s.sut.AddFeatures()) s.sut.AddUseCase() s.loadControlFeature = localEntity.FeatureOfTypeAndRole(model.FeatureTypeTypeLoadControl, model.RoleTypeServer) diff --git a/usecases/cs/lpp/testhelper_test.go b/usecases/cs/lpp/testhelper_test.go index 4eebe964..0bad0a4e 100644 --- a/usecases/cs/lpp/testhelper_test.go +++ b/usecases/cs/lpp/testhelper_test.go @@ -16,6 +16,7 @@ import ( "github.com/enbility/spine-go/model" "github.com/enbility/spine-go/spine" "github.com/enbility/spine-go/util" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" ) @@ -76,7 +77,7 @@ func (s *CsLPPSuite) BeforeTest(suiteName, testName string) { localEntity := s.service.LocalDevice().EntityForType(model.EntityTypeTypeCEM) s.sut = NewLPP(localEntity, s.Event) - _ = s.sut.AddFeatures() + assert.Nil(s.T(), s.sut.AddFeatures()) s.sut.AddUseCase() s.loadControlFeature = localEntity.FeatureOfTypeAndRole(model.FeatureTypeTypeLoadControl, model.RoleTypeServer) diff --git a/usecases/mu/mpc/testhelper_test.go b/usecases/mu/mpc/testhelper_test.go index f0def4a9..2e503215 100644 --- a/usecases/mu/mpc/testhelper_test.go +++ b/usecases/mu/mpc/testhelper_test.go @@ -1,10 +1,11 @@ package mpc import ( - "github.com/enbility/eebus-go/features/server" "slices" "time" + "github.com/enbility/eebus-go/features/server" + "github.com/enbility/eebus-go/api" "github.com/enbility/eebus-go/mocks" "github.com/enbility/eebus-go/service" @@ -12,6 +13,7 @@ import ( "github.com/enbility/ship-go/cert" spineapi "github.com/enbility/spine-go/api" "github.com/enbility/spine-go/model" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" ) @@ -78,7 +80,7 @@ func (s *MuMPCSuite) BeforeTest(_, _ string) { s.frequencyConfig, ) - _ = s.sut.AddFeatures() + assert.Nil(s.T(), s.sut.AddFeatures()) s.sut.AddUseCase() }