expectProblemType<T> function

Problem expectProblemType<T>(
  1. Result<T> result,
  2. String type
)

Assert result is an Err whose problem has type; returns the problem.

Implementation

Problem expectProblemType<T>(Result<T> result, String type) {
  final Problem problem = expectErr(result);
  if (problem.type != type) {
    throw AssertionError(
      'expected problem type "$type" but got "${problem.type}"',
    );
  }
  return problem;
}