0

我有一个看起来像这样的测试:

test('should throw error if threshold is null', (){
  final findEngine = new FindEngine<Foo>();
  expect(findEngine.streamResults('foo', null), throwsA(new
      isInstanceOf<ThresholdNullOrOutOfBoundsError>()));
});

测试失败并显示以下消息:

ERROR: should throw error if threshold is null
  Test failed: Caught Instance of 'ThresholdNullOrOutOfBoundsError'

我在这里做错了吗?

4

1 回答 1

0

弄清楚了。需要关闭我预计会失败的呼叫:

expect(() => findEngine.streamResults('foo', null), throwsA(new
  isInstanceOf<ThresholdNullOrOutOfBoundsError>()));
于 2014-12-14T03:27:51.877 回答