Skip to content

Commit e05613d

Browse files
ignore unknown fields (#114) (#116)
* ignore unknown fields (#114) (cherry picked from commit 8593d22) * added assertj lib in backport
1 parent ae78d2e commit e05613d

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

extension/java-client-operate/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@
6262
<artifactId>mockito-junit-jupiter</artifactId>
6363
<scope>test</scope>
6464
</dependency>
65+
<dependency>
66+
<groupId>org.assertj</groupId>
67+
<artifactId>assertj-core</artifactId>
68+
<scope>test</scope>
69+
</dependency>
6570
</dependencies>
6671

6772
<build>

extension/java-client-operate/src/main/java/io/camunda/operate/auth/TokenResponse.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package io.camunda.operate.auth;
22

3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
34
import com.fasterxml.jackson.annotation.JsonProperty;
45

6+
@JsonIgnoreProperties(ignoreUnknown = true)
57
public class TokenResponse {
68

79
@JsonProperty("access_token")
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package io.camunda.operate.auth;
2+
3+
import static org.assertj.core.api.Assertions.*;
4+
5+
import com.fasterxml.jackson.databind.ObjectMapper;
6+
import io.camunda.operate.auth.TokenResponseMapper.JacksonTokenResponseMapper;
7+
import org.junit.jupiter.api.Test;
8+
9+
public class TokenResponseTest {
10+
@Test
11+
void shouldIgnoreUnknownFields() {
12+
TokenResponseMapper tokenResponseMapper = new JacksonTokenResponseMapper(new ObjectMapper());
13+
TokenResponse tokenResponse = tokenResponseMapper.readToken("{\"weird_field\":123}");
14+
assertThat(tokenResponse).isNotNull();
15+
}
16+
}

0 commit comments

Comments
 (0)