TedeeApiTokenInterceptor.java

1
package org.sanmibuh.tedee.lock.infrastructure.secondary;
2
3
import java.io.IOException;
4
import java.time.Clock;
5
import lombok.RequiredArgsConstructor;
6
import org.springframework.http.HttpRequest;
7
import org.springframework.http.client.ClientHttpRequestExecution;
8
import org.springframework.http.client.ClientHttpRequestInterceptor;
9
import org.springframework.http.client.ClientHttpResponse;
10
11
@RequiredArgsConstructor
12
final class TedeeApiTokenInterceptor implements ClientHttpRequestInterceptor {
13
14
  private static final String API_TOKEN_HEADER = "api_token";
15
16
  private final TedeeApiTokenGenerator generator;
17
  private final Clock clock;
18
19
  @Override
20
  public ClientHttpResponse intercept(
21
      final HttpRequest request, final byte[] body, final ClientHttpRequestExecution execution)
22
      throws IOException {
23 1 1. intercept : removed call to org/springframework/http/HttpHeaders::set → KILLED
    request.getHeaders().set(API_TOKEN_HEADER, generator.generate(clock.millis()));
24 1 1. intercept : replaced return value with null for org/sanmibuh/tedee/lock/infrastructure/secondary/TedeeApiTokenInterceptor::intercept → KILLED
    return execution.execute(request, body);
25
  }
26
}

Mutations

23

1.1
Location : intercept
Killed by : org.sanmibuh.tedee.lock.infrastructure.secondary.TedeeApiTokenInterceptorTest.[engine:junit-jupiter]/[class:org.sanmibuh.tedee.lock.infrastructure.secondary.TedeeApiTokenInterceptorTest]/[method:should_setEncryptedApiTokenHeader_whenIntercepting()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

24

1.1
Location : intercept
Killed by : org.sanmibuh.tedee.lock.infrastructure.secondary.TedeeLockGatewayTest.[engine:junit-jupiter]/[class:org.sanmibuh.tedee.lock.infrastructure.secondary.TedeeLockGatewayTest]/[method:should_postToLockEndpoint_whenLocking()]
replaced return value with null for org/sanmibuh/tedee/lock/infrastructure/secondary/TedeeApiTokenInterceptor::intercept → KILLED

Active mutators

Tests examined


Report generated by PIT 1.30.0 support