1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-11-06 09:09:19 +02:00

Remove assert.Error right before assert.EqualError (#2344)

Is there any benefit from having

```
assert.Error(./.)
assert.EqualError(./.)
```

?

assert.Error ensures that we have an error.
assert.EqualError ensures that we have an error and
moreover it checks for a specific error. Hence
assert.EqualError does all and more what assert.Error
does.

In case there is a benefit from that pattern this PR should not be merged.
In case there is not benefit from that pattern  we should abandong that pattern.
This commit is contained in:
Marcus Holl
2020-11-11 14:14:55 +01:00
committed by GitHub
parent 51c63c9da1
commit 56586cae1b
4 changed files with 0 additions and 23 deletions

View File

@@ -379,7 +379,6 @@ func TestHandleHTTPError(t *testing.T) {
message := "Custom Error Message"
err := HandleHTTPError(&resp, receivedErr, message, ConnectionDetailsHTTP{})
assert.Error(t, err, "Error was expected")
assert.EqualError(t, err, fmt.Sprintf("%s: %s - %s", receivedErr.Error(), abapErrorCode, abapErrorMessage))
log.Entry().Info(err.Error())
})
@@ -399,7 +398,6 @@ func TestHandleHTTPError(t *testing.T) {
message := "Custom Error Message"
err := HandleHTTPError(&resp, receivedErr, message, ConnectionDetailsHTTP{})
assert.Error(t, err, "Error was expected")
assert.EqualError(t, err, fmt.Sprintf("%s", receivedErr.Error()))
log.Entry().Info(err.Error())
})
@@ -419,7 +417,6 @@ func TestHandleHTTPError(t *testing.T) {
message := "Custom Error Message"
err := HandleHTTPError(&resp, receivedErr, message, ConnectionDetailsHTTP{})
assert.Error(t, err, "Error was expected")
assert.EqualError(t, err, fmt.Sprintf("%s", receivedErr.Error()))
log.Entry().Info(err.Error())
})