MCPcopy Create free account
hub / github.com/gavv/httpexpect / TestAssertion_HandlerPanics

Function TestAssertion_HandlerPanics

assertion_test.go:144–196  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

142}
143
144func TestAssertion_HandlerPanics(t *testing.T) {
145 t.Run("success, nil Formatter", func(t *testing.T) {
146 handler := &DefaultAssertionHandler{
147 Formatter: nil,
148 Reporter: newMockReporter(t),
149 Logger: newMockLogger(t),
150 }
151
152 assert.Panics(t, func() {
153 handler.Success(&AssertionContext{
154 TestName: t.Name(),
155 })
156 })
157 })
158
159 t.Run("failure, nil Formatter", func(t *testing.T) {
160 handler := &DefaultAssertionHandler{
161 Formatter: nil,
162 Reporter: newMockReporter(t),
163 Logger: newMockLogger(t),
164 }
165
166 assert.Panics(t, func() {
167 handler.Failure(
168 &AssertionContext{
169 TestName: t.Name(),
170 },
171 &AssertionFailure{
172 Type: AssertValid,
173 Severity: SeverityError,
174 })
175 })
176 })
177
178 t.Run("failure, nil Reporter", func(t *testing.T) {
179 handler := &DefaultAssertionHandler{
180 Formatter: newMockFormatter(t),
181 Reporter: nil,
182 Logger: newMockLogger(t),
183 }
184
185 assert.Panics(t, func() {
186 handler.Failure(
187 &AssertionContext{
188 TestName: t.Name(),
189 },
190 &AssertionFailure{
191 Type: AssertValid,
192 Severity: SeverityError,
193 })
194 })
195 })
196}
197
198func TestAssertion_ValidateTraits(t *testing.T) {
199 cases := []struct {

Callers

nothing calls this directly

Calls 6

SuccessMethod · 0.95
FailureMethod · 0.95
newMockReporterFunction · 0.85
newMockLoggerFunction · 0.85
newMockFormatterFunction · 0.85
NameMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…