Skip to content

Commit f079271

Browse files
authored
refactor: use assert.PanicsWithValue (#541)
1 parent c42f056 commit f079271

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

events/attributevalue_test.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -215,25 +215,10 @@ func TestAccessWithWrongTypePanics(t *testing.T) {
215215
var av DynamoDBAttributeValue
216216
err := json.Unmarshal([]byte(testCase.input), &av)
217217
assert.Nil(t, err)
218-
// may use PanicsWithValue(expectedError) when it is available
219-
assertPanicsWithValue(t, testCase.expectedError, func() { testCase.accessor(av) })
218+
assert.PanicsWithValue(t, testCase.expectedError, func() { testCase.accessor(av) })
220219
}
221220
}
222221

223-
func assertPanicsWithValue(t *testing.T, expected error, action func()) {
224-
defer func() {
225-
r := recover()
226-
if r == nil {
227-
t.Errorf("Should have panicked")
228-
}
229-
if r != expected {
230-
t.Errorf("should have panicked with value %v but panicked with value %v", expected, r)
231-
}
232-
}()
233-
234-
action()
235-
}
236-
237222
func TestMarshalAndUnmarshalString(t *testing.T) {
238223
const inputString = "INPUT STRING"
239224
inputValue := NewStringAttribute(inputString)

0 commit comments

Comments
 (0)