View test reports →

Coverage Summary for Class: UrlMatcher (dev.skymansandy.wiretap.domain.model.matchers)

Class Method, % Branch, % Line, % Instruction, %
UrlMatcher$Contains 100% (1/1) 100% (2/2) 100% (12/12)
UrlMatcher$Exact 100% (1/1) 100% (2/2) 100% (12/12)
UrlMatcher$Regex 100% (1/1) 100% (2/2) 100% (12/12)
Total 100% (3/3) 100% (6/6) 100% (36/36)


 /*
  * Copyright (c) 2026 skymansandy. All rights reserved.
  */
 
 package dev.skymansandy.wiretap.domain.model.matchers
 
 import dev.skymansandy.wiretap.domain.model.MatcherType
 
 /**
  * Defines how a rule's URL pattern is matched against request URLs.
  *
  * All matching is case-insensitive.
  *
  * @see dev.skymansandy.wiretap.domain.model.WiretapRule
  */
 sealed interface UrlMatcher {
 
     val pattern: String
 
     val type: MatcherType
 
     /** Matches when the request URL equals [pattern] exactly (case-insensitive). */
     data class Exact(override val pattern: String) : UrlMatcher {
 
         override val type = MatcherType.Exact
     }
 
     /** Matches when the request URL contains [pattern] as a substring (case-insensitive). */
     data class Contains(override val pattern: String) : UrlMatcher {
 
         override val type = MatcherType.Contains
     }
 
     /** Matches when the request URL matches [pattern] as a regular expression. */
     data class Regex(override val pattern: String) : UrlMatcher {
 
         override val type = MatcherType.Regex
     }
 }