misc(test): fix deprecated usages of isInstanceOf
diff --git a/pubspec.yaml b/pubspec.yaml
index 1bda146..74c78ab 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -14,4 +14,4 @@
stream_channel: '^1.0.0'
dev_dependencies:
http: '>=0.9.2 <0.12.0'
- test: '^0.12.20'
+ test: '^1.2.0'
diff --git a/test/create_middleware_test.dart b/test/create_middleware_test.dart
index 58da909..868ea34 100644
--- a/test/create_middleware_test.dart
+++ b/test/create_middleware_test.dart
@@ -229,8 +229,7 @@
.addMiddleware(middleware)
.addHandler((request) => throw const HijackException());
- expect(makeSimpleRequest(handler),
- throwsA(new isInstanceOf<HijackException>()));
+ expect(makeSimpleRequest(handler), throwsHijackException);
});
});
}
diff --git a/test/hijack_test.dart b/test/hijack_test.dart
index b386945..852fcee 100644
--- a/test/hijack_test.dart
+++ b/test/hijack_test.dart
@@ -37,7 +37,7 @@
channel.sink.add([4, 5, 6]);
channel.sink.close();
})),
- throwsA(new isInstanceOf<HijackException>()));
+ throwsHijackException);
});
test('hijacking a hijackable request twice throws a StateError', () {
@@ -45,8 +45,7 @@
var request = new Request('GET', localhostUri,
onHijack: expectAsync1((_) => null, count: 1));
- expect(() => request.hijack((_) => null),
- throwsA(new isInstanceOf<HijackException>()));
+ expect(() => request.hijack((_) => null), throwsHijackException);
expect(() => request.hijack((_) => null), throwsStateError);
});
@@ -81,7 +80,7 @@
channel.sink.add([4, 5, 6]);
channel.sink.close();
})),
- throwsA(new isInstanceOf<HijackException>()));
+ throwsHijackException);
});
test(
@@ -93,8 +92,7 @@
var newRequest = request.change();
- expect(() => newRequest.hijack((_) => null),
- throwsA(new isInstanceOf<HijackException>()));
+ expect(() => newRequest.hijack((_) => null), throwsHijackException);
expect(() => request.hijack((_) => null), throwsStateError);
});
diff --git a/test/log_middleware_test.dart b/test/log_middleware_test.dart
index 641af1f..9bddae8 100644
--- a/test/log_middleware_test.dart
+++ b/test/log_middleware_test.dart
@@ -66,6 +66,6 @@
makeSimpleRequest(handler).whenComplete(() {
expect(gotLog, isFalse);
}),
- throwsA(new isInstanceOf<HijackException>()));
+ throwsHijackException);
});
}
diff --git a/test/shelf_io_test.dart b/test/shelf_io_test.dart
index 49c691d..ccd7316 100644
--- a/test/shelf_io_test.dart
+++ b/test/shelf_io_test.dart
@@ -462,7 +462,7 @@
expect(
request.context,
containsPair('shelf.io.connection_info',
- new isInstanceOf<HttpConnectionInfo>()));
+ new TypeMatcher<HttpConnectionInfo>()));
var connectionInfo =
request.context['shelf.io.connection_info'] as HttpConnectionInfo;
diff --git a/test/test_util.dart b/test/test_util.dart
index c38b3a2..4238468 100644
--- a/test/test_util.dart
+++ b/test/test_util.dart
@@ -4,6 +4,7 @@
import 'dart:async';
+import 'package:test/test.dart';
import 'package:shelf/shelf.dart';
// "hello,"
@@ -12,6 +13,9 @@
// " world"
const worldBytes = const [32, 119, 111, 114, 108, 100];
+final Matcher throwsHijackException =
+ throwsA(new TypeMatcher<HijackException>());
+
/// A simple, synchronous handler for [Request].
///
/// By default, replies with a status code 200, empty headers, and