Skip to content

Commit f7cd5ab

Browse files
NIAD-3004: Add RedactionsConfigurationTest (#802)
Co-authored-by: Adrian Clay <[email protected]>
1 parent 3c76753 commit f7cd5ab

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package uk.nhs.adaptors.gp2gp.common.configuration;
2+
3+
import org.junit.jupiter.api.Nested;
4+
import org.junit.jupiter.api.Test;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.boot.test.context.SpringBootTest;
7+
import org.springframework.test.context.ContextConfiguration;
8+
9+
import static org.assertj.core.api.Assertions.assertThat;
10+
11+
@ContextConfiguration(classes = { RedactionsConfiguration.class })
12+
public class RedactionsConfigurationTest {
13+
@Nested
14+
@SpringBootTest(properties = { "gp2gp.redactions-enabled = false" })
15+
class FeatureFlagDisabled {
16+
@Autowired
17+
private RedactionsContext redactionsContext;
18+
19+
@Test
20+
void ehrExtractInteractionIdIsUK07() {
21+
final String result = redactionsContext.ehrExtractInteractionId();
22+
assertThat(result).isEqualTo(RedactionsConfiguration.EHR_EXTRACT_INTERACTION_ID);
23+
}
24+
}
25+
26+
@Nested
27+
@SpringBootTest(properties = { "gp2gp.redactions-enabled = true" })
28+
class FeatureFlagEnabled {
29+
@Autowired
30+
private RedactionsContext redactionsContext;
31+
32+
@Test
33+
void ehrExtractInteractionIdIsUK07() {
34+
final String result = redactionsContext.ehrExtractInteractionId();
35+
assertThat(result).isEqualTo(RedactionsConfiguration.EHR_EXTRACT_INTERACTION_ID_WITH_REDACTIONS);
36+
}
37+
}
38+
}

service/src/main/java/uk/nhs/adaptors/gp2gp/common/configuration/RedactionsConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
@Configuration
88
class RedactionsConfiguration {
9-
private static final String EHR_EXTRACT_INTERACTION_ID = "RCMR_IN030000UK06";
10-
private static final String EHR_EXTRACT_INTERACTION_ID_WITH_REDACTIONS = "RCMR_IN030000UK07";
9+
public static final String EHR_EXTRACT_INTERACTION_ID = "RCMR_IN030000UK06";
10+
public static final String EHR_EXTRACT_INTERACTION_ID_WITH_REDACTIONS = "RCMR_IN030000UK07";
1111
private boolean redactionsEnabled;
1212

1313
@Value("${gp2gp.redactions-enabled}")

0 commit comments

Comments
 (0)