CockpitTestSuiteInlineCaseSource.fromJson constructor

CockpitTestSuiteInlineCaseSource.fromJson(
  1. Object? value, {
  2. required String path,
})

Decodes a CockpitTestSuiteInlineCaseSource from a JSON object.

Implementation

factory CockpitTestSuiteInlineCaseSource.fromJson(
  Object? value, {
  required String path,
}) {
  final json = CockpitTestValueReader.object(value, path);
  CockpitTestValueReader.keys(
    json,
    const <String>{'kind', 'case'},
    path,
    required: const <String>{'kind', 'case'},
  );
  if (json['kind'] != 'inline') {
    throw FormatException('Expected inline source at $path.kind.');
  }
  return CockpitTestSuiteInlineCaseSource(
    testCase: CockpitTestCase.fromJson(json['case'], path: '$path.case'),
  );
}