From 1129e8dbe337bde115402c3c032a2d1165af5eda Mon Sep 17 00:00:00 2001 From: Gavin Ching Date: Thu, 22 Mar 2018 00:13:11 -0700 Subject: [PATCH] Fix janky throw tests --- test/byte_polynomial_test.dart | 11 +++-------- test/secret_scheme_test.dart | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/test/byte_polynomial_test.dart b/test/byte_polynomial_test.dart index 67540ea..f776e66 100644 --- a/test/byte_polynomial_test.dart +++ b/test/byte_polynomial_test.dart @@ -118,17 +118,12 @@ void main() { test('Should throw given a bad x coordinate', () { expect(() => _poly.evaluateAtX(-1), throwsArgumentError); }); - - test('Should throw if not generated', () { - _poly = new BytePolynomial(5); - expect(() => _poly.evaluateAtX(5), throwsA(NotGeneratedException)); - }, skip: 'Testing custom exception are still janky.'); test('Should throw given that coefficients have not been generated', () { BytePolynomial _badPoly = new BytePolynomial(0); - expect(() => _badPoly.evaluateAtX(0), - throwsA(equals("NotGeneratedException"))); - }, skip: 'Something is janky about testing exceptions'); + expect(() => _badPoly.evaluateAtX(5), + throwsA(new isInstanceOf())); + }); test('Should return the constant value given x = 0', () { expect(_poly.evaluateAtX(0), equals(1)); diff --git a/test/secret_scheme_test.dart b/test/secret_scheme_test.dart index 459a485..c600c4c 100644 --- a/test/secret_scheme_test.dart +++ b/test/secret_scheme_test.dart @@ -71,7 +71,7 @@ void main() { badXVal[256] = new List(); badYVal[5] = null; - + expect(() => ss.combineShares(null), throwsArgumentError); expect(() => ss.combineShares(empty), throwsArgumentError); expect(() => ss.combineShares(badXVal), throwsArgumentError);