Skip to content

JsonSchema should implement an interface to allow mocking. #159

Closed
@ajbrown

Description

@ajbrown

JsonSchema is a final class, so it's not able to be (cleanly) mocked in unit tests. This is important for testing classes that must handle validation failure and success scenarios.

The workaround is to wrap the schema validation in a local class, and mock that class. However, this just hides the problem at a lower level since the wrapped class cannot be properly tested.

If JsonSchema implemented an interface, it could be mocked directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions