feat: remove the deprecated setTargetingKey method in EvaluationContext. (#290)

remove the deprecated setTargetingKey method in EvaluationContext.

Signed-off-by: thiyagu06 <thiyagu103@gmail.com>
This commit is contained in:
Thiyagu GK 2023-02-11 02:02:34 +05:30 committed by GitHub
parent 4102495dd2
commit d78c99ce16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 24 deletions

View File

@ -7,12 +7,6 @@ package dev.openfeature.sdk;
@SuppressWarnings("PMD.BeanMembersShouldSerialize")
public interface EvaluationContext extends Structure {
String getTargetingKey();
/**
* Mutating targeting key is not supported in all implementations and will be removed.
*/
@Deprecated
void setTargetingKey(String targetingKey);
/**
* Merges this EvaluationContext object with the second overriding the this in

View File

@ -58,15 +58,6 @@ public final class ImmutableContext implements EvaluationContext {
this.targetingKey = targetingKey;
}
/**
* Mutating targeting key is not supported in ImmutableContext and will be removed.
*/
@Override
@Deprecated
public void setTargetingKey(String targetingKey) {
throw new UnsupportedOperationException("changing of targeting key is not allowed");
}
/**
* Merges this EvaluationContext object with the passed EvaluationContext, overriding in case of conflict.
*

View File

@ -164,8 +164,8 @@ public class EvalContextTest {
@Test void merge_targeting_key() {
String key1 = "key1";
EvaluationContext ctx1 = new MutableContext(key1);
EvaluationContext ctx2 = new MutableContext();
MutableContext ctx1 = new MutableContext(key1);
MutableContext ctx2 = new MutableContext();
EvaluationContext ctxMerged = ctx1.merge(ctx2);
assertEquals(key1, ctxMerged.getTargetingKey());

View File

@ -12,13 +12,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
class ImmutableContextTest {
@Test
@DisplayName("Mutating targeting key is not allowed on Immutable Context")
void shouldThrowUnsupportedExceptionWhenMutatingTargetingKey() {
EvaluationContext ctx = new ImmutableContext("targeting key", new HashMap<>());
assertThrows(UnsupportedOperationException.class, () -> ctx.setTargetingKey(""));
}
@DisplayName("attributes mutation should not affect the immutable context")
@Test
void shouldCreateCopyOfAttributesForImmutableContext() {