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:
parent
4102495dd2
commit
d78c99ce16
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue