<commit_before><?php

declare(strict_types=1);

namespace FlixTech\SchemaRegistryApi\Test\Exception;

use FlixTech\SchemaRegistryApi\Exception\ExceptionMap;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;

class ExceptionMapTest extends TestCase
{
    /**
     * @test
     *
     * @expectedException \FlixTech\SchemaRegistryApi\Exception\InvalidAvroSchemaException
     */
    public function it_should_handle_InvalidAvroSchema_code()
    {
        (new ExceptionMap())(
            new RequestException(
            '422 Unprocessable Entity',
                new Request('GET', '/'),
                new Response(
                    422,
                    ['Content-Type' => 'application/vnd.schemaregistry.v1+json'],
                    '{"error_code":42201,"message": "Invalid Avro schema"}'
                )
            )
        );
    }

    /**
     * @test
     *
     * @expectedException \FlixTech\SchemaRegistryApi\Exception\IncompatibleAvroSchemaException
     */
    public function it_should_handle_IncompatibleAvroSchema_code()
    {
        (new ExceptionMap())(
            new RequestException(
                '409 Conflict',
                new Request('GET', '/'),
                new Response(
                    409,
                    ['Content-Type' => 'application/vnd.schemaregistry.v1+json'],
                    '{"error_code":409,"message": "Incompatible Avro schema"}'
                )
            )
        );
    }
}<commit_msg>Add `BackendDataStoreException` test to `ExceptionMapTest`<commit_after><?php

declare(strict_types=1);

namespace FlixTech\SchemaRegistryApi\Test\Exception;

use FlixTech\SchemaRegistryApi\Exception\ExceptionMap;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;

class ExceptionMapTest extends TestCase
{
    /**
     * @test
     *
     * @expectedException \FlixTech\SchemaRegistryApi\Exception\InvalidAvroSchemaException
     */
    public function it_should_handle_InvalidAvroSchema_code()
    {
        (new ExceptionMap())(
            new RequestException(
            '422 Unprocessable Entity',
                new Request('GET', '/'),
                new Response(
                    422,
                    ['Content-Type' => 'application/vnd.schemaregistry.v1+json'],
                    '{"error_code":42201,"message": "Invalid Avro schema"}'
                )
            )
        );
    }

    /**
     * @test
     *
     * @expectedException \FlixTech\SchemaRegistryApi\Exception\IncompatibleAvroSchemaException
     */
    public function it_should_handle_IncompatibleAvroSchema_code()
    {
        (new ExceptionMap())(
            new RequestException(
                '409 Conflict',
                new Request('GET', '/'),
                new Response(
                    409,
                    ['Content-Type' => 'application/vnd.schemaregistry.v1+json'],
                    '{"error_code":409,"message": "Incompatible Avro schema"}'
                )
            )
        );
    }

    /**
     * @test
     *
     * @expectedException \FlixTech\SchemaRegistryApi\Exception\BackendDataStoreException
     */
    public function it_should_handle_BackendDataStore_code()
    {
        (new ExceptionMap())(
            new RequestException(
                '500 Internal Server Error',
                new Request('GET', '/'),
                new Response(
                    500,
                    ['Content-Type' => 'application/vnd.schemaregistry.v1+json'],
                    '{"error_code":50001,"message": "Error in the backend datastore"}'
                )
            )
        );
    }
}
{'fraction_non_alphanumeric': 0.10884533898305085, 'fraction_numerical': 0.01641949152542373, 'mean_word_length': 1.883206106870229, 'pattern_counts': {'":': 10, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1194754', 'n_tokens_mistral': 1079, 'n_tokens_neox': 989, 'n_words': 161}