@@ -31,7 +31,7 @@ func TestLogCode(t *testing.T) {
3131 }
3232 th .ServeHTTP (httptest .NewRecorder (), req )
3333 expected := `INFO: GET /endpoint 0 201 0 0.0.0.0 JSON={}`
34- if 1 != len (mockLog .GetAllMatching (expected )) {
34+ if len (mockLog .GetAllMatching (expected )) != 1 {
3535 t .Errorf ("Expected exactly one log line matching %q. Got \n %s" ,
3636 expected , strings .Join (mockLog .GetAllMatching (".*" ), "\n " ))
3737 }
@@ -53,7 +53,7 @@ func TestStatusCodeLogging(t *testing.T) {
5353 }
5454 th .ServeHTTP (httptest .NewRecorder (), req )
5555 expected := `INFO: GET /endpoint 0 200 0 0.0.0.0 JSON={}`
56- if 1 != len (mockLog .GetAllMatching (expected )) {
56+ if len (mockLog .GetAllMatching (expected )) != 1 {
5757 t .Errorf ("Expected exactly one log line matching %q. Got \n %s" ,
5858 expected , strings .Join (mockLog .GetAllMatching (".*" ), "\n " ))
5959 }
@@ -69,7 +69,7 @@ func TestOrigin(t *testing.T) {
6969 req .Header .Add ("Origin" , "https://example.com" )
7070 th .ServeHTTP (httptest .NewRecorder (), req )
7171 expected := `INFO: GET /endpoint 0 201 0 0.0.0.0 JSON={.*"Origin":"https://example.com"}`
72- if 1 != len (mockLog .GetAllMatching (expected )) {
72+ if len (mockLog .GetAllMatching (expected )) != 1 {
7373 t .Errorf ("Expected exactly one log line matching %q. Got \n %s" ,
7474 expected , strings .Join (mockLog .GetAllMatching (".*" ), "\n " ))
7575 }
0 commit comments