-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
114 additions
and
18 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...a/software/amazon/cloudformation/exceptions/CfnUnauthorizedTaggingOperationException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
package software.amazon.cloudformation.exceptions; | ||
|
||
import software.amazon.cloudformation.proxy.HandlerErrorCode; | ||
|
||
public class CfnUnauthorizedTaggingOperationException extends BaseHandlerException { | ||
|
||
private static final long serialVersionUID = -1646136434112354328L; | ||
private static final HandlerErrorCode ERROR_CODE = HandlerErrorCode.UnauthorizedTaggingOperation; | ||
|
||
public CfnUnauthorizedTaggingOperationException() { | ||
this(null); | ||
} | ||
|
||
public CfnUnauthorizedTaggingOperationException(final Throwable cause) { | ||
super(ERROR_CODE.getMessage(), cause, ERROR_CODE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...ftware/amazon/cloudformation/exceptions/CfnUnauthorizedTaggingOperationExceptionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
package software.amazon.cloudformation.exceptions; | ||
|
||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType; | ||
import static org.junit.Assert.assertEquals; | ||
import org.junit.jupiter.api.Test; | ||
import software.amazon.cloudformation.proxy.HandlerErrorCode; | ||
|
||
public class CfnUnauthorizedTaggingOperationExceptionTest { | ||
@Test | ||
public void cfnUnauthorizedTaggingOperation_isBaseHandlerException() { | ||
assertThatExceptionOfType(BaseHandlerException.class).isThrownBy(() -> { | ||
throw new CfnUnauthorizedTaggingOperationException(new RuntimeException()); | ||
}); | ||
} | ||
|
||
@Test | ||
public void cfnUnauthorizedTaggingOperationException_singleArgConstructorHasMessage() { | ||
assertThatExceptionOfType(BaseHandlerException.class).isThrownBy(() -> { | ||
throw new CfnUnauthorizedTaggingOperationException(new RuntimeException()); | ||
}).withCauseInstanceOf(RuntimeException.class).withMessageContaining("Unauthorized tagging operation"); | ||
} | ||
|
||
@Test | ||
public void cfnUnauthorizedTaggingOperationException_noCauseGiven() { | ||
assertThatExceptionOfType(CfnUnauthorizedTaggingOperationException.class).isThrownBy(() -> { | ||
throw new CfnUnauthorizedTaggingOperationException(); | ||
}).withNoCause().withMessageContaining("Unauthorized tagging operation"); | ||
} | ||
|
||
@Test | ||
public void cfnUnauthorizedTaggingOperationException_errorCodeIsAppropriate() { | ||
assertThatExceptionOfType(CfnUnauthorizedTaggingOperationException.class).isThrownBy(() -> { | ||
throw new CfnUnauthorizedTaggingOperationException(new RuntimeException()); | ||
}).satisfies(exception -> assertEquals(HandlerErrorCode.UnauthorizedTaggingOperation, exception.getErrorCode())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters