diff --git a/tests/Unit/Mapper/Mappers/JsonToObjectMapperTest.php b/tests/Unit/Mapper/Mappers/JsonToObjectMapperTest.php index c6c6584..574de5b 100644 --- a/tests/Unit/Mapper/Mappers/JsonToObjectMapperTest.php +++ b/tests/Unit/Mapper/Mappers/JsonToObjectMapperTest.php @@ -4,6 +4,7 @@ namespace Tests\Tempest\Unit\Mapper\Mappers; +use Tempest\Mapper\Mappers\JsonToObjectMapper; use function Tempest\map; use Tests\Tempest\IntegrationTest; use Tests\Tempest\Unit\Mapper\Fixtures\ObjectA; @@ -21,4 +22,18 @@ public function test_json_to_object(): void $this->assertSame('a', $object->a); $this->assertSame('b', $object->b); } + + public function test_invalid_json(): void + { + $mapper = new JsonToObjectMapper(); + + $this->assertFalse($mapper->canMap('invalid', ObjectA::class)); + } + + public function test_invalid_object(): void + { + $mapper = new JsonToObjectMapper(); + + $this->assertFalse($mapper->canMap('{}', 'unknown')); + } }