Issue-ID: NONRTRIC-814
Signed-off-by: elinuxhenrik <henrik.b.andersson@est.tech>
Change-Id: If7a10b6c910695acc1e6573981ed0e8873bb5b1a
}
func (fd APIProviderFunctionDetails) Validate() error {
}
func (fd APIProviderFunctionDetails) Validate() error {
+ if len(strings.TrimSpace(string(fd.ApiProvFuncRole))) == 0 {
+ return errors.New("APIProviderFunctionDetails missing required apiProvFuncRole")
+ }
switch role := fd.ApiProvFuncRole; role {
case ApiProviderFuncRoleAEF:
case ApiProviderFuncRoleAPF:
case ApiProviderFuncRoleAMF:
default:
switch role := fd.ApiProvFuncRole; role {
case ApiProviderFuncRoleAEF:
case ApiProviderFuncRoleAPF:
case ApiProviderFuncRoleAMF:
default:
- return errors.New("APIProviderFunctionDetails missing required apiProvFuncRole")
+ return errors.New("APIProviderFunctionDetails has invalid apiProvFuncRole")
}
return fd.RegInfo.Validate()
}
return fd.RegInfo.Validate()
assert.Contains(t, err.Error(), "apiProvFuncRole")
}
assert.Contains(t, err.Error(), "apiProvFuncRole")
}
+ var invalidFuncRole ApiProviderFuncRole = "invalid"
+ funcDetailsUnderTest.ApiProvFuncRole = invalidFuncRole
+ err = funcDetailsUnderTest.Validate()
+ if assert.Error(t, err) {
+ assert.Contains(t, err.Error(), "invalid")
+ assert.Contains(t, err.Error(), "apiProvFuncRole")
+ }
+
funcDetailsUnderTest.ApiProvFuncRole = ApiProviderFuncRoleAEF
err = funcDetailsUnderTest.Validate()
if assert.Error(t, err) {
funcDetailsUnderTest.ApiProvFuncRole = ApiProviderFuncRoleAEF
err = funcDetailsUnderTest.Validate()
if assert.Error(t, err) {