-
Notifications
You must be signed in to change notification settings - Fork 9
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 #235 from atsign-foundation/exception_trace_bug
fix: check size of chained exception list in getTraceMessage
- Loading branch information
Showing
3 changed files
with
37 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'package:at_commons/at_commons.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
group('A group of tests for exception stack', () { | ||
test('chained exception list size greater than zero - check trace message', | ||
() { | ||
final atChainedException = AtChainedException( | ||
Intent.syncData, ExceptionScenario.invalidKeyFormed, 'sync issue'); | ||
final exceptionStack = AtExceptionStack(); | ||
exceptionStack.add(atChainedException); | ||
expect(exceptionStack.getTraceMessage(), isNotEmpty); | ||
expect(exceptionStack.getTraceMessage(), | ||
startsWith('Failed to syncData caused by')); | ||
}); | ||
|
||
test('chained exception list size is zero', () { | ||
final exceptionStack = AtExceptionStack(); | ||
expect(exceptionStack.getTraceMessage(), isEmpty); | ||
}); | ||
|
||
test('check intent message', () { | ||
final atChainedException = AtChainedException( | ||
Intent.syncData, ExceptionScenario.invalidKeyFormed, 'sync issue'); | ||
final exceptionStack = AtExceptionStack(); | ||
exceptionStack.add(atChainedException); | ||
expect(exceptionStack.getIntentMessage(Intent.syncData), isNotEmpty); | ||
expect(exceptionStack.getIntentMessage(Intent.syncData), | ||
equals('Failed to syncData')); | ||
}); | ||
}); | ||
} |