-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #714 from aws/dev
chore: release 1.5
- Loading branch information
Showing
8 changed files
with
164 additions
and
28 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System; | ||
using AWS.Deploy.Common; | ||
using Xunit; | ||
|
||
namespace AWS.Deploy.CLI.UnitTests | ||
{ | ||
public class ExceptionExtensionsTests | ||
{ | ||
[Fact] | ||
public void GetTruncatedErrorMessage_EmptyMessage() | ||
{ | ||
// ARRANGE | ||
var ex = new Exception(string.Empty); | ||
|
||
// ACT and ASSERT | ||
Assert.Equal(string.Empty, ex.GetTruncatedErrorMessage()); | ||
} | ||
|
||
[Fact] | ||
public void GetTruncatedErrorMessage_NoTruncation() | ||
{ | ||
// ARRANGE | ||
var message = "This is an AWSDeployToolException"; | ||
var ex = new Exception(message); | ||
|
||
// ACT and ASSERT | ||
// No truncation is performed because the message length < 2 * k | ||
Assert.Equal(message, ex.GetTruncatedErrorMessage(numChars: 50)); | ||
} | ||
|
||
[Fact] | ||
public void GetTruncatedErrorMessage() | ||
{ | ||
// ARRANGE | ||
var message = | ||
"error text. error text. error text. error text. error text. " + | ||
"error text. error text. error text. error text. error text. error text. " + | ||
"error text. error text. error text. error text. error text. error text. " + | ||
"error text. error text. error text. error text. error text. error text. " + | ||
"error text. error text. error text. error text. error text. error text. " + | ||
"error text. error text. error text. error text. error text. error text. " + | ||
"error text. error text. error text. error text. error text. error text. " + | ||
"error text. error text. error text. error text. error text. error text. " + | ||
"error text. error text. error text. error text. error text. error text. error text."; | ||
|
||
|
||
var ex = new Exception(message); | ||
|
||
// ACT | ||
var truncatedErrorMessage = ex.GetTruncatedErrorMessage(numChars: 50); | ||
|
||
// ACT and ASSERT | ||
var expectedMessage = | ||
@"error text. error text. error text. error text. er | ||
... | ||
Error truncated to the first and last 50 characters | ||
... | ||
t. error text. error text. error text. error text."; | ||
|
||
Assert.Equal(expectedMessage, truncatedErrorMessage); | ||
} | ||
} | ||
} |
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