16
16
17
17
import static org .assertj .core .api .Assertions .assertThat ;
18
18
import static org .assertj .core .api .Fail .fail ;
19
- import static org .junit .Assert .assertEquals ;
20
19
import static org .junit .Assert .assertNotNull ;
21
20
import static org .junit .Assert .assertTrue ;
22
21
@@ -86,7 +85,7 @@ public void putPublicAccessBlock_NoSuchAccount() {
86
85
.publicAccessBlockConfiguration (r2 -> r2 .restrictPublicBuckets (true ))));
87
86
fail ("Expected exception" );
88
87
} catch (S3ControlException e ) {
89
- assertEquals ( "AccessDenied" , e .awsErrorDetails ().errorCode ());
88
+ assertThat ( e .awsErrorDetails ().errorCode ()). isEqualTo ( "AccessDenied" );
90
89
assertNotNull (e .requestId ());
91
90
}
92
91
}
@@ -97,7 +96,41 @@ public void getPublicAccessBlock_NoSuchAccount() {
97
96
client .getPublicAccessBlock (r -> r .accountId (INVALID_ACCOUNT_ID ));
98
97
fail ("Expected exception" );
99
98
} catch (S3ControlException e ) {
100
- assertEquals ("AccessDenied" , e .awsErrorDetails ().errorCode ());
99
+ assertThat (e .awsErrorDetails ().errorCode ()).isEqualTo ("AccessDenied" );
100
+ assertNotNull (e .requestId ());
101
+ }
102
+ }
103
+
104
+ @ Test
105
+ public void getPublicAccessBlock_NoSuchPublicAccessBlock () {
106
+ try {
107
+ client .getPublicAccessBlock (r -> r .accountId (accountId ));
108
+ fail ("Expected exception" );
109
+ } catch (S3ControlException e ) {
110
+ assertThat (e .awsErrorDetails ().errorCode ()).isEqualTo ("NoSuchPublicAccessBlockConfiguration" );
111
+ assertThat (e ).isInstanceOf (NoSuchPublicAccessBlockConfigurationException .class );
112
+ assertNotNull (e .requestId ());
113
+ }
114
+ }
115
+
116
+ @ Test
117
+ public void listJobs_InvalidRequest () {
118
+ try {
119
+ client .listJobs (r -> r .accountId (accountId ).jobStatusesWithStrings ("test" ));
120
+ fail ("Expected exception" );
121
+ } catch (S3ControlException e ) {
122
+ assertThat (e .awsErrorDetails ().errorCode ()).isEqualTo ("InvalidRequest" );
123
+ assertNotNull (e .requestId ());
124
+ }
125
+ }
126
+
127
+ @ Test
128
+ public void describeJob_InvalidRequest () {
129
+ try {
130
+ client .describeJob (r -> r .accountId (accountId ).jobId ("someid" ));
131
+ fail ("Expected exception" );
132
+ } catch (S3ControlException e ) {
133
+ assertThat (e .awsErrorDetails ().errorCode ()).isEqualTo ("InvalidRequest" );
101
134
assertNotNull (e .requestId ());
102
135
}
103
136
}
@@ -108,7 +141,7 @@ public void deletePublicAccessBlock_NoSuchAccount() {
108
141
client .deletePublicAccessBlock (r -> r .accountId (INVALID_ACCOUNT_ID ));
109
142
fail ("Expected exception" );
110
143
} catch (S3ControlException e ) {
111
- assertEquals ( "AccessDenied" , e .awsErrorDetails ().errorCode ());
144
+ assertThat ( e .awsErrorDetails ().errorCode ()). isEqualTo ( "AccessDenied" );
112
145
assertNotNull (e .requestId ());
113
146
}
114
147
}
0 commit comments