Update deprecated uses of package:test's isInstanceOf.
Change-Id: I0789ad89f2a247a17c472d74ca16885c5b8b6d5c
Reviewed-on: https://dart-review.googlesource.com/63320
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
diff --git a/pkg/analysis_server/test/analysis/update_content_test.dart b/pkg/analysis_server/test/analysis/update_content_test.dart
index b6dfc25..44161349 100644
--- a/pkg/analysis_server/test/analysis/update_content_test.dart
+++ b/pkg/analysis_server/test/analysis/update_content_test.dart
@@ -212,7 +212,7 @@
Map<String, dynamic> files = params.files;
expect(files, hasLength(1));
Object overlay = files[filePath];
- expect(overlay, new isInstanceOf<plugin.AddContentOverlay>());
+ expect(overlay, const TypeMatcher<plugin.AddContentOverlay>());
plugin.AddContentOverlay addOverlay = overlay;
expect(addOverlay.content, fileContent);
//
@@ -228,7 +228,7 @@
files = params.files;
expect(files, hasLength(1));
overlay = files[filePath];
- expect(overlay, new isInstanceOf<plugin.ChangeContentOverlay>());
+ expect(overlay, const TypeMatcher<plugin.ChangeContentOverlay>());
plugin.ChangeContentOverlay changeOverlay = overlay;
expect(changeOverlay.edits, hasLength(2));
//
@@ -243,7 +243,7 @@
files = params.files;
expect(files, hasLength(1));
overlay = files[filePath];
- expect(overlay, new isInstanceOf<plugin.RemoveContentOverlay>());
+ expect(overlay, const TypeMatcher<plugin.RemoveContentOverlay>());
}
// CompilationUnit _getTestUnit() {
diff --git a/pkg/analysis_server/test/context_manager_test.dart b/pkg/analysis_server/test/context_manager_test.dart
index 431bf6a..bd3ac38 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -1918,7 +1918,7 @@
// Verify defaults restored.
expect(analysisOptions.enableSuperMixins, isFalse);
expect(lints, hasLength(1));
- expect(lints.first, new isInstanceOf<AvoidAs>());
+ expect(lints.first, const TypeMatcher<AvoidAs>());
expect(errorProcessors, hasLength(1));
expect(getProcessor(missing_return).severity, isNull);
}
diff --git a/pkg/analysis_server/test/integration/completion/get_suggestions_test.dart b/pkg/analysis_server/test/integration/completion/get_suggestions_test.dart
index 75dad25..27d3996 100644
--- a/pkg/analysis_server/test/integration/completion/get_suggestions_test.dart
+++ b/pkg/analysis_server/test/integration/completion/get_suggestions_test.dart
@@ -112,7 +112,7 @@
// Exception expected
return null;
}).then((result) {
- expect(result, new isInstanceOf<CompletionGetSuggestionsResult>());
+ expect(result, const TypeMatcher<CompletionGetSuggestionsResult>());
});
}
}
diff --git a/pkg/analysis_server/test/integration/support/integration_tests.dart b/pkg/analysis_server/test/integration/support/integration_tests.dart
index f80c9b8..9e2ab21 100644
--- a/pkg/analysis_server/test/integration/support/integration_tests.dart
+++ b/pkg/analysis_server/test/integration/support/integration_tests.dart
@@ -16,9 +16,9 @@
import 'integration_test_methods.dart';
import 'protocol_matchers.dart';
-const Matcher isBool = const isInstanceOf<bool>();
+const Matcher isBool = const TypeMatcher<bool>();
-const Matcher isInt = const isInstanceOf<int>();
+const Matcher isInt = const TypeMatcher<int>();
const Matcher isNotification = const MatchesJsonObject(
'notification', const {'event': isString},
@@ -26,7 +26,7 @@
const Matcher isObject = isMap;
-const Matcher isString = const isInstanceOf<String>();
+const Matcher isString = const TypeMatcher<String>();
final Matcher isResponse = new MatchesJsonObject('response', {'id': isString},
optionalFields: {'result': anything, 'error': isRequestError});
diff --git a/pkg/analysis_server/test/protocol_server_test.dart b/pkg/analysis_server/test/protocol_server_test.dart
index 421000a..7ac554b 100644
--- a/pkg/analysis_server/test/protocol_server_test.dart
+++ b/pkg/analysis_server/test/protocol_server_test.dart
@@ -169,7 +169,7 @@
String enumName = MirrorSystem.getName(symbol);
EngineEnum engineValue =
engineClass.getField(symbol).reflectee as EngineEnum;
- expect(engineValue, new isInstanceOf<EngineEnum>());
+ expect(engineValue, new TypeMatcher<EngineEnum>());
if (exceptions.containsKey(engineValue)) {
ApiEnum expectedResult = exceptions[engineValue];
if (expectedResult == null) {
diff --git a/pkg/analysis_server/test/search/top_level_declarations_test.dart b/pkg/analysis_server/test/search/top_level_declarations_test.dart
index e383ca6..5e46628 100644
--- a/pkg/analysis_server/test/search/top_level_declarations_test.dart
+++ b/pkg/analysis_server/test/search/top_level_declarations_test.dart
@@ -59,7 +59,7 @@
test_invalidRegex() async {
var result = await findTopLevelDeclarations('[A');
- expect(result, new isInstanceOf<RequestError>());
+ expect(result, const TypeMatcher<RequestError>());
}
test_startEndPattern() async {
diff --git a/pkg/analysis_server/test/src/plugin/request_converter_test.dart b/pkg/analysis_server/test/src/plugin/request_converter_test.dart
index f306b92..527623b 100644
--- a/pkg/analysis_server/test/src/plugin/request_converter_test.dart
+++ b/pkg/analysis_server/test/src/plugin/request_converter_test.dart
@@ -76,7 +76,7 @@
expect(result, isNotNull);
Map<String, dynamic> pluginFiles = result.files;
expect(pluginFiles, hasLength(2));
- expect(pluginFiles['file1'], new isInstanceOf<AddContentOverlay>());
- expect(pluginFiles['file2'], new isInstanceOf<AddContentOverlay>());
+ expect(pluginFiles['file1'], const TypeMatcher<AddContentOverlay>());
+ expect(pluginFiles['file2'], const TypeMatcher<AddContentOverlay>());
}
}
diff --git a/pkg/analyzer_cli/test/embedder_test.dart b/pkg/analyzer_cli/test/embedder_test.dart
index 7f010e7..95285ba 100644
--- a/pkg/analyzer_cli/test/embedder_test.dart
+++ b/pkg/analyzer_cli/test/embedder_test.dart
@@ -53,7 +53,7 @@
]);
DartSdk sdk = driver.sdk;
- expect(sdk, new isInstanceOf<FolderBasedDartSdk>());
+ expect(sdk, const TypeMatcher<FolderBasedDartSdk>());
expect((sdk as FolderBasedDartSdk).useSummary, isFalse);
}));
});
diff --git a/pkg/analyzer_cli/test/sdk_ext_test.dart b/pkg/analyzer_cli/test/sdk_ext_test.dart
index 2863222..0559b3a 100644
--- a/pkg/analyzer_cli/test/sdk_ext_test.dart
+++ b/pkg/analyzer_cli/test/sdk_ext_test.dart
@@ -48,7 +48,7 @@
]);
DartSdk sdk = driver.sdk;
- expect(sdk, new isInstanceOf<FolderBasedDartSdk>());
+ expect(sdk, const TypeMatcher<FolderBasedDartSdk>());
expect((sdk as FolderBasedDartSdk).useSummary, isFalse);
expect(exitCode, 0);
diff --git a/pkg/analyzer_plugin/test/integration/support/integration_tests.dart b/pkg/analyzer_plugin/test/integration/support/integration_tests.dart
index e1475fc..1756d72 100644
--- a/pkg/analyzer_plugin/test/integration/support/integration_tests.dart
+++ b/pkg/analyzer_plugin/test/integration/support/integration_tests.dart
@@ -15,9 +15,9 @@
import 'integration_test_methods.dart';
import 'protocol_matchers.dart';
-const Matcher isBool = const isInstanceOf<bool>();
+const Matcher isBool = const TypeMatcher<bool>();
-const Matcher isInt = const isInstanceOf<int>();
+const Matcher isInt = const TypeMatcher<int>();
const Matcher isNotification = const MatchesJsonObject(
'notification', const {'event': isString},
@@ -25,7 +25,7 @@
const Matcher isObject = isMap;
-const Matcher isString = const isInstanceOf<String>();
+const Matcher isString = const TypeMatcher<String>();
final Matcher isResponse = new MatchesJsonObject('response', {'id': isString},
optionalFields: {'result': anything, 'error': isRequestError});
diff --git a/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_core_test.dart b/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_core_test.dart
index e662d11..8da2f7a 100644
--- a/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_core_test.dart
+++ b/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_core_test.dart
@@ -25,7 +25,7 @@
String path = '/test.dart';
FileEditBuilderImpl fileEditBuilder =
await builder.createFileEditBuilder(path);
- expect(fileEditBuilder, new isInstanceOf<FileEditBuilder>());
+ expect(fileEditBuilder, const TypeMatcher<FileEditBuilder>());
SourceFileEdit fileEdit = fileEditBuilder.fileEdit;
expect(fileEdit.file, path);
}
@@ -126,7 +126,7 @@
builder.addInsertion(10, (EditBuilder builder) {
LinkedEditBuilderImpl linkBuilder =
(builder as EditBuilderImpl).createLinkedEditBuilder();
- expect(linkBuilder, new isInstanceOf<LinkedEditBuilder>());
+ expect(linkBuilder, const TypeMatcher<LinkedEditBuilder>());
});
});
}
@@ -318,7 +318,7 @@
int length = 5;
EditBuilderImpl editBuilder =
(builder as FileEditBuilderImpl).createEditBuilder(offset, length);
- expect(editBuilder, new isInstanceOf<EditBuilder>());
+ expect(editBuilder, const TypeMatcher<EditBuilder>());
SourceEdit sourceEdit = editBuilder.sourceEdit;
expect(sourceEdit.length, length);
expect(sourceEdit.offset, offset);
diff --git a/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart b/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart
index c7d2f7b..117e69d 100644
--- a/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart
+++ b/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart
@@ -64,7 +64,7 @@
DartChangeBuilderImpl builder = new DartChangeBuilder(session);
DartFileEditBuilderImpl fileEditBuilder =
await builder.createFileEditBuilder(path);
- expect(fileEditBuilder, new isInstanceOf<DartFileEditBuilder>());
+ expect(fileEditBuilder, const TypeMatcher<DartFileEditBuilder>());
SourceFileEdit fileEdit = fileEditBuilder.fileEdit;
expect(fileEdit.file, path);
}
@@ -2246,7 +2246,7 @@
int length = 5;
DartEditBuilderImpl editBuilder = (builder as DartFileEditBuilderImpl)
.createEditBuilder(offset, length);
- expect(editBuilder, new isInstanceOf<DartEditBuilder>());
+ expect(editBuilder, const TypeMatcher<DartEditBuilder>());
SourceEdit sourceEdit = editBuilder.sourceEdit;
expect(sourceEdit.length, length);
expect(sourceEdit.offset, offset);
diff --git a/pkg/analyzer_plugin/test/src/utilities/visitors/local_declaration_visitor_test.dart b/pkg/analyzer_plugin/test/src/utilities/visitors/local_declaration_visitor_test.dart
index 6329940..b14b1c9 100644
--- a/pkg/analyzer_plugin/test/src/utilities/visitors/local_declaration_visitor_test.dart
+++ b/pkg/analyzer_plugin/test/src/utilities/visitors/local_declaration_visitor_test.dart
@@ -44,7 +44,7 @@
expect(f, isNotNull);
BlockFunctionBody body = f.functionExpression.body;
Statement statement = body.block.statements[0];
- expect(statement, new isInstanceOf<ForEachStatement>());
+ expect(statement, const TypeMatcher<ForEachStatement>());
statement.accept(new TestVisitor(statement.offset));
}
}