Skip to content

Commit

Permalink
Add exception tests
Browse files Browse the repository at this point in the history
  • Loading branch information
passsy committed Dec 2, 2018
1 parent 2ebea61 commit 967ba2c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/dart_kollection_test.dart
Expand Up @@ -9,10 +9,12 @@ import 'collection/map_mutable_extensions_test.dart' as map_mutable_extensions_t
import 'collection/map_test.dart' as map_test;
import 'collection/set_test.dart' as set_test;
import 'collections_test.dart' as collections_test;
import 'exceptions_test.dart' as exceptions_test;
import 'tuples_test.dart' as tuples_test;

main() {
collections_test.main();
exceptions_test.main();
tuples_test.main();
iterable_extensions_test.main();
list_mutable_extensions_test.main();
Expand Down
28 changes: 28 additions & 0 deletions test/exceptions_test.dart
@@ -0,0 +1,28 @@
import 'package:dart_kollection/dart_kollection.dart';
import 'package:test/test.dart';

void main() {
group("IndexOutOfBoundsException", () {
test("toString with message", () {
final e = IndexOutOfBoundsException("orange juice");
expect(e.toString(), "IndexOutOfBoundsException: orange juice");
});

test("toString without message", () {
final e = IndexOutOfBoundsException();
expect(e.toString(), "IndexOutOfBoundsException");
});
});

group("NoSuchElementException", () {
test("toString with message", () {
final e = NoSuchElementException("orange juice");
expect(e.toString(), "NoSuchElementException: orange juice");
});

test("toString without message", () {
final e = NoSuchElementException();
expect(e.toString(), "NoSuchElementException");
});
});
}

0 comments on commit 967ba2c

Please sign in to comment.