0

I have a test that looks like this:

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

The test is failing with the following message:

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

Am I doing something wrong here?

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
w.brian
  • 16,296
  • 14
  • 69
  • 118

1 Answers1

0

Figured it out. Needed to close over the call that I expected to fail:

expect(() => findEngine.streamResults('foo', null), throwsA(new
  isInstanceOf<ThresholdNullOrOutOfBoundsError>()));
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
w.brian
  • 16,296
  • 14
  • 69
  • 118