Skip to content

Commit

Permalink
ignore unknown fields (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanlukas authored Oct 18, 2024
1 parent ee92d21 commit 8593d22
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package io.camunda.operate.auth;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class TokenResponse {

@JsonProperty("access_token")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.camunda.operate.auth;

import static org.assertj.core.api.Assertions.*;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.camunda.operate.auth.TokenResponseMapper.JacksonTokenResponseMapper;
import org.junit.jupiter.api.Test;

public class TokenResponseTest {
@Test
void shouldIgnoreUnknownFields() {
TokenResponseMapper tokenResponseMapper = new JacksonTokenResponseMapper(new ObjectMapper());
TokenResponse tokenResponse = tokenResponseMapper.readToken("{\"weird_field\":123}");
assertThat(tokenResponse).isNotNull();
}
}

0 comments on commit 8593d22

Please sign in to comment.