NotImplements asserts that an object does not implement the specified interface. assert.NotImplements(t, (*MyInterface)(nil), new(MyObject))
(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{})
| 440 | // |
| 441 | // assert.NotImplements(t, (*MyInterface)(nil), new(MyObject)) |
| 442 | func NotImplements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { |
| 443 | if h, ok := t.(tHelper); ok { |
| 444 | h.Helper() |
| 445 | } |
| 446 | interfaceType := reflect.TypeOf(interfaceObject).Elem() |
| 447 | |
| 448 | if object == nil { |
| 449 | return Fail(t, fmt.Sprintf("Cannot check if nil does not implement %v", interfaceType), msgAndArgs...) |
| 450 | } |
| 451 | if reflect.TypeOf(object).Implements(interfaceType) { |
| 452 | return Fail(t, fmt.Sprintf("%T implements %v", object, interfaceType), msgAndArgs...) |
| 453 | } |
| 454 | |
| 455 | return true |
| 456 | } |
| 457 | |
| 458 | func isType(expectedType, object interface{}) bool { |
| 459 | return ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) |