Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: pkg/analyzer/test/generated/utilities_test.dart

Issue 2326813002: Replace and remove JavaException(s). (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/generated/utilities_test.dart
diff --git a/pkg/analyzer/test/generated/utilities_test.dart b/pkg/analyzer/test/generated/utilities_test.dart
index ed78f6d874a769cf228af6f819eeed1d319a704a..3dc407dbdded13d646588f3c0358b7bf9d38acfb 100644
--- a/pkg/analyzer/test/generated/utilities_test.dart
+++ b/pkg/analyzer/test/generated/utilities_test.dart
@@ -1455,12 +1455,7 @@ class DirectedGraphTest extends EngineTestCase {
void test_findCycleContaining_null() {
DirectedGraph<DirectedGraphTest_Node> graph =
new DirectedGraph<DirectedGraphTest_Node>();
- try {
- graph.findCycleContaining(null);
- fail("Expected IllegalArgumentException");
- } on IllegalArgumentException {
- // Expected
- }
+ expect(() => graph.findCycleContaining(null), throwsArgumentError);
}
void test_findCycleContaining_singleton() {
@@ -2524,21 +2519,15 @@ class LineInfoTest {
}
void test_creation_empty() {
- try {
+ expect(() {
new LineInfo(<int>[]);
- fail("Expected IllegalArgumentException");
- } on IllegalArgumentException {
- // Expected
- }
+ }, throwsArgumentError);
}
void test_creation_null() {
- try {
+ expect(() {
new LineInfo(null);
- fail("Expected IllegalArgumentException");
- } on IllegalArgumentException {
- // Expected
- }
+ }, throwsArgumentError);
}
void test_firstLine() {
@@ -2899,24 +2888,11 @@ class MultipleMapIteratorTest extends EngineTestCase {
Map<String, String> map = new HashMap<String, String>();
MultipleMapIterator<String, String> iterator = _iterator(<Map>[map]);
expect(iterator.moveNext(), isFalse);
- try {
- iterator.key;
- fail("Expected NoSuchElementException");
- } on NoSuchElementException {
- // Expected
- }
- try {
- iterator.value;
- fail("Expected NoSuchElementException");
- } on NoSuchElementException {
- // Expected
- }
- try {
- iterator.value = "x";
- fail("Expected NoSuchElementException");
- } on NoSuchElementException {
- // Expected
- }
+ expect(() => iterator.key, throwsStateError);
+ expect(() => iterator.value, throwsStateError);
+ expect(() {
+ iterator.value = 'x';
+ }, throwsStateError);
}
void test_singleMap_multiple() {
@@ -3904,24 +3880,11 @@ class SingleMapIteratorTest extends EngineTestCase {
SingleMapIterator<String, String> iterator =
new SingleMapIterator<String, String>(map);
expect(iterator.moveNext(), isFalse);
- try {
- iterator.key;
- fail("Expected NoSuchElementException");
- } on NoSuchElementException {
- // Expected
- }
- try {
- iterator.value;
- fail("Expected NoSuchElementException");
- } on NoSuchElementException {
- // Expected
- }
- try {
- iterator.value = "x";
- fail("Expected NoSuchElementException");
- } on NoSuchElementException {
- // Expected
- }
+ expect(() => iterator.key, throwsStateError);
+ expect(() => iterator.value, throwsStateError);
+ expect(() {
+ iterator.value = 'x';
+ }, throwsStateError);
expect(iterator.moveNext(), isFalse);
}
@@ -4214,12 +4177,9 @@ class StringUtilitiesTest {
}
void test_printListOfQuotedNames_empty() {
- try {
+ expect(() {
StringUtilities.printListOfQuotedNames(new List<String>(0));
- fail("Expected IllegalArgumentException");
- } on IllegalArgumentException {
- // Expected
- }
+ }, throwsArgumentError);
}
void test_printListOfQuotedNames_five() {
@@ -4230,21 +4190,15 @@ class StringUtilitiesTest {
}
void test_printListOfQuotedNames_null() {
- try {
+ expect(() {
StringUtilities.printListOfQuotedNames(null);
- fail("Expected IllegalArgumentException");
- } on IllegalArgumentException {
- // Expected
- }
+ }, throwsArgumentError);
}
void test_printListOfQuotedNames_one() {
- try {
+ expect(() {
StringUtilities.printListOfQuotedNames(<String>["a"]);
- fail("Expected IllegalArgumentException");
- } on IllegalArgumentException {
- // Expected
- }
+ }, throwsArgumentError);
}
void test_printListOfQuotedNames_three() {

Powered by Google App Engine
This is Rietveld 408576698