22
33import static org .assertj .core .api .Assertions .assertThat ;
44
5+ import com .google .common .collect .ImmutableMap ;
56import com .scalar .db .io .Key ;
67import java .util .HashMap ;
78import java .util .Map ;
1112public class AbacOperationAttributesTest {
1213
1314 @ Test
14- public void setReadTag_ShouldSetReadTag () {
15+ public void setReadTag_MapGiven_ShouldSetReadTag () {
1516 // Arrange
1617 Map <String , String > attributes = new HashMap <>();
1718 String policyName = "policyName" ;
@@ -25,6 +26,21 @@ public void setReadTag_ShouldSetReadTag() {
2526 .containsEntry (AbacOperationAttributes .READ_TAG_PREFIX + policyName , readTag );
2627 }
2728
29+ @ Test
30+ public void setReadTag_ImmutableMapBuilderGiven_ShouldSetReadTag () {
31+ // Arrange
32+ ImmutableMap .Builder <String , String > attributesBuilder = ImmutableMap .builder ();
33+ String policyName = "policyName" ;
34+ String readTag = "readTag" ;
35+
36+ // Act
37+ AbacOperationAttributes .setReadTag (attributesBuilder , policyName , readTag );
38+
39+ // Assert
40+ assertThat (attributesBuilder .build ())
41+ .containsEntry (AbacOperationAttributes .READ_TAG_PREFIX + policyName , readTag );
42+ }
43+
2844 @ Test
2945 public void clearReadTag_ShouldClearReadTag () {
3046 // Arrange
@@ -60,7 +76,7 @@ public void clearReadTags_ShouldClearReadTags() {
6076 }
6177
6278 @ Test
63- public void setWriteTag_ShouldSetWriteTag () {
79+ public void setWriteTag_MapGiven_ShouldSetWriteTag () {
6480 // Arrange
6581 Map <String , String > attributes = new HashMap <>();
6682 String policyName = "policyName" ;
@@ -74,6 +90,21 @@ public void setWriteTag_ShouldSetWriteTag() {
7490 .containsEntry (AbacOperationAttributes .WRITE_TAG_PREFIX + policyName , writeTag );
7591 }
7692
93+ @ Test
94+ public void setWriteTag_ImmutableMapBuilderGiven_ShouldSetWriteTag () {
95+ // Arrange
96+ ImmutableMap .Builder <String , String > attributesBuilder = ImmutableMap .builder ();
97+ String policyName = "policyName" ;
98+ String writeTag = "writeTag" ;
99+
100+ // Act
101+ AbacOperationAttributes .setWriteTag (attributesBuilder , policyName , writeTag );
102+
103+ // Assert
104+ assertThat (attributesBuilder .build ())
105+ .containsEntry (AbacOperationAttributes .WRITE_TAG_PREFIX + policyName , writeTag );
106+ }
107+
77108 @ Test
78109 public void clearWriteTag_ShouldClearWriteTag () {
79110 // Arrange
0 commit comments