@@ -13,8 +13,6 @@ import (
13
13
14
14
"github.com/steinfletcher/apitest"
15
15
"github.com/steinfletcher/apitest/mocks"
16
-
17
- "github.com/stretchr/testify/assert"
18
16
)
19
17
20
18
func TestApiTest_ResponseBody (t * testing.T ) {
@@ -803,13 +801,13 @@ func TestApiTest_Report(t *testing.T) {
803
801
r := reporter .capturedRecorder
804
802
assert .Equal (t , "POST /hello" , r .Title )
805
803
assert .Equal (t , "some test" , r .SubTitle )
806
- assert .Len (t , r .Events , 4 )
804
+ assert .Equal (t , 4 , len ( r .Events ) )
807
805
assert .Equal (t , 200 , r .Meta ["status_code" ])
808
806
assert .Equal (t , "/hello" , r .Meta ["path" ])
809
807
assert .Equal (t , "POST" , r .Meta ["method" ])
810
808
assert .Equal (t , "some test" , r .Meta ["name" ])
811
809
assert .Equal (t , "abc.com" , r .Meta ["host" ])
812
- assert .NotEmpty (t , r .Meta ["duration" ])
810
+ assert .Equal (t , true , r .Meta ["duration" ] != nil )
813
811
}
814
812
815
813
func TestApiTest_Recorder (t * testing.T ) {
@@ -857,7 +855,7 @@ func TestApiTest_Recorder(t *testing.T) {
857
855
End ()
858
856
859
857
r := reporter .capturedRecorder
860
- assert .Len (t , r .Events , 6 )
858
+ assert .Equal (t , 6 , len ( r .Events ) )
861
859
assert .Equal (t , messageRequest , r .Events [0 ])
862
860
assert .Equal (t , messageResponse , r .Events [1 ])
863
861
}
@@ -881,7 +879,7 @@ func TestApiTest_Observe(t *testing.T) {
881
879
Status (http .StatusOK ).
882
880
End ()
883
881
884
- assert .True ( t , observeCalled )
882
+ assert .Equal ( t , true , observeCalled )
885
883
}
886
884
887
885
func TestApiTest_Observe_DumpsTheHttpRequestAndResponse (t * testing.T ) {
@@ -926,7 +924,7 @@ func TestApiTest_ObserveWithReport(t *testing.T) {
926
924
Status (http .StatusOK ).
927
925
End ()
928
926
929
- assert .True ( t , observeCalled )
927
+ assert .Equal ( t , true , observeCalled )
930
928
}
931
929
932
930
func TestApiTest_Intercept (t * testing.T ) {
@@ -960,8 +958,8 @@ func TestApiTest_Intercept(t *testing.T) {
960
958
func TestApiTest_ExposesRequestAndResponse (t * testing.T ) {
961
959
apiTest := apitest .New ()
962
960
963
- assert .NotNil (t , apiTest .Request ())
964
- assert .NotNil (t , apiTest .Response ())
961
+ assert .Equal (t , true , apiTest .Request () != nil )
962
+ assert .Equal (t , true , apiTest .Response () != nil )
965
963
}
966
964
967
965
func TestApiTest_RequestContextIsPreserved (t * testing.T ) {
@@ -1142,7 +1140,7 @@ func TestApiTest_ErrorIfMockInvocationsDoNotMatchTimes(t *testing.T) {
1142
1140
End ()
1143
1141
1144
1142
unmatchedMocks := res .UnmatchedMocks ()
1145
- assert .NotEmpty (t , unmatchedMocks )
1143
+ assert .Equal (t , true , len ( unmatchedMocks ) > 0 )
1146
1144
assert .Equal (t , "http://localhost:8080" , unmatchedMocks [0 ].URL .String ())
1147
1145
}
1148
1146
@@ -1165,7 +1163,7 @@ func TestApiTest_MatchesTimes(t *testing.T) {
1165
1163
Status (http .StatusOK ).
1166
1164
End ()
1167
1165
1168
- assert .Empty (t , res .UnmatchedMocks ())
1166
+ assert .Equal (t , 0 , len ( res .UnmatchedMocks () ))
1169
1167
}
1170
1168
1171
1169
type RecorderCaptor struct {
@@ -1187,3 +1185,5 @@ func getUserData() []byte {
1187
1185
}
1188
1186
return data
1189
1187
}
1188
+
1189
+ var assert = apitest.DefaultVerifier {}
0 commit comments