| TestNew - valid key | Valid API key provided in X-API-Key header | Returns 200 OK, allows request through |
| TestNew - invalid key | Invalid API key provided | Returns 403 Forbidden, blocks request |
| TestNew - missing key | No API key provided | Returns 401 Unauthorized, blocks request |
| TestWithOptions_QueryLookup | API key provided via query parameter | Returns 200 OK when key is valid |
| TestWithOptions_CookieLookup | API key provided via cookie | Returns 200 OK when key is valid |
| TestWithOptions_AuthScheme | API key with “ApiKey” scheme in Authorization header | Strips scheme prefix, validates key, returns 200 OK |
| TestWithOptions_ErrorHandler | Custom error handler configured | Custom error handler is invoked, returns custom JSON response |
| TestWithOptions_ValidatorError | Validator returns error (e.g., database error) | Returns 403 Forbidden with error message |
| TestFromContext | Retrieve API key from context after validation | Returns the validated API key string |
| TestGet | Test Get() function as alias for FromContext() | Both functions return the same key value |
| TestValidateKeys - key1 | Static validator with “key1” in allowed list | Returns valid=true |
| TestValidateKeys - key2 | Static validator with “key2” in allowed list | Returns valid=true |
| TestValidateKeys - key3 | Static validator with “key3” in allowed list | Returns valid=true |
| TestValidateKeys - key4 | Static validator with “key4” not in allowed list | Returns valid=false |
| TestValidateKeys - empty | Static validator with empty string | Returns valid=false |
| TestWithOptions_Panics - no validator | Create middleware without validator | Panics with error message |
| TestWithOptions_Panics - invalid lookup | Create middleware with invalid KeyLookup format | Panics with error message |
| TestErrors | Verify error constants | ErrKeyMissing and ErrKeyInvalid return correct messages |