5151import vtwo .muteconfig .GetMuteRule ;
5252import vtwo .muteconfig .ListMuteRules ;
5353import vtwo .muteconfig .SetMuteFinding ;
54+ import vtwo .muteconfig .SetMuteUndefinedFinding ;
5455import vtwo .muteconfig .SetUnmuteFinding ;
5556import vtwo .muteconfig .UpdateMuteRule ;
5657import vtwo .source .CreateSource ;
@@ -74,9 +75,8 @@ public class MuteFindingIT {
7475 private static ByteArrayOutputStream stdOut ;
7576
7677 @ Rule
77- public final MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule (
78- MAX_ATTEMPT_COUNT ,
79- INITIAL_BACKOFF_MILLIS );
78+ public final MultipleAttemptsRule multipleAttemptsRule =
79+ new MultipleAttemptsRule (MAX_ATTEMPT_COUNT , INITIAL_BACKOFF_MILLIS );
8080
8181 // Check if the required environment variables are set.
8282 public static void requireEnvVar (String envVarName ) {
@@ -104,12 +104,22 @@ public static void setUp() throws IOException, InterruptedException {
104104
105105 // Create findings within the source.
106106 String uuid = UUID .randomUUID ().toString ().split ("-" )[0 ];
107- FINDING_1 = CreateFindings .createFinding (ORGANIZATION_ID , LOCATION , "testfindingv2" + uuid ,
108- SOURCE .getName ().split ("/" )[3 ], Optional .of ("MEDIUM_RISK_ONE" ));
107+ FINDING_1 =
108+ CreateFindings .createFinding (
109+ ORGANIZATION_ID ,
110+ LOCATION ,
111+ "testfindingv2" + uuid ,
112+ SOURCE .getName ().split ("/" )[3 ],
113+ Optional .of ("MEDIUM_RISK_ONE" ));
109114
110115 uuid = UUID .randomUUID ().toString ().split ("-" )[0 ];
111- FINDING_2 = CreateFindings .createFinding (ORGANIZATION_ID , LOCATION , "testfindingv2" + uuid ,
112- SOURCE .getName ().split ("/" )[3 ], Optional .empty ());
116+ FINDING_2 =
117+ CreateFindings .createFinding (
118+ ORGANIZATION_ID ,
119+ LOCATION ,
120+ "testfindingv2" + uuid ,
121+ SOURCE .getName ().split ("/" )[3 ],
122+ Optional .empty ());
113123
114124 stdOut = null ;
115125 System .setOut (out );
@@ -132,9 +142,7 @@ public static void cleanUp() throws IOException {
132142 public static ListFindingsPagedResponse getAllFindings (String sourceName ) throws IOException {
133143 try (SecurityCenterClient client = SecurityCenterClient .create ()) {
134144
135- ListFindingsRequest request = ListFindingsRequest .newBuilder ()
136- .setParent (sourceName )
137- .build ();
145+ ListFindingsRequest request = ListFindingsRequest .newBuilder ().setParent (sourceName ).build ();
138146
139147 return client .listFindings (request );
140148 }
@@ -173,18 +181,20 @@ public void testUpdateMuteRules() throws IOException {
173181 }
174182
175183 @ Test
176- public void testMuteUnmuteFinding () throws IOException {
184+ public void testSetMuteFinding () throws IOException {
177185 Finding finding = SetMuteFinding .setMute (FINDING_1 .getName ());
178186 assertThat (finding .getMute ()).isEqualTo (Mute .MUTED );
179187 finding = SetUnmuteFinding .setUnmute (FINDING_1 .getName ());
180188 assertThat (finding .getMute ()).isEqualTo (Mute .UNMUTED );
189+ finding = SetMuteUndefinedFinding .setMuteUndefined (FINDING_1 .getName ());
190+ assertThat (finding .getMute ()).isEqualTo (Mute .UNDEFINED );
181191 }
182192
183193 @ Test
184194 public void testBulkMuteFindings () throws IOException , ExecutionException , InterruptedException {
185195 // Mute findings that belong to this project.
186- BulkMuteFindings .bulkMute (PROJECT_ID , LOCATION ,
187- String .format ("resource.project_display_name=\" %s\" " , PROJECT_ID ));
196+ BulkMuteFindings .bulkMute (
197+ PROJECT_ID , LOCATION , String .format ("resource.project_display_name=\" %s\" " , PROJECT_ID ));
188198
189199 // Get all findings in the source to check if they are muted.
190200 ListFindingsPagedResponse response =
0 commit comments