Kaynağa Gözat

test(contracts): add unit tests for automatic protocol and remove obsolete tests

alvesantos 1 hafta önce
ebeveyn
işleme
b85d7862d5

+ 6 - 1
app/Services/StudentContractService.php

@@ -116,7 +116,7 @@ public function create(array $data): StudentContract
         $isAutomatic = true;
 
         if ($unitId) {
-            $unit = Unit::find($unitId);
+            $unit = $this->findUnit($unitId);
             if ($unit && $unit->automatic_protocol === false) {
                 $isAutomatic = false;
             }
@@ -133,6 +133,11 @@ public function create(array $data): StudentContract
         return $contract;
     }
 
+    protected function findUnit(int $unitId): ?Unit
+    {
+        return Unit::find($unitId);
+    }
+
     public function update(int $id, array $data, ?int $createdByUserId = null): ?StudentContract
     {
         if (! empty($data['due_day'])) {

+ 0 - 16
tests/Unit/ExampleTest.php

@@ -1,16 +0,0 @@
-<?php
-
-namespace Tests\Unit;
-
-use PHPUnit\Framework\TestCase;
-
-class ExampleTest extends TestCase
-{
-    /**
-     * A basic test example.
-     */
-    public function test_that_true_is_true(): void
-    {
-        $this->assertTrue(true);
-    }
-}

+ 0 - 109
tests/Unit/Http/Requests/StudentContractRequestTest.php

@@ -1,109 +0,0 @@
-<?php
-
-namespace Tests\Unit\Http\Requests;
-
-use App\Http\Requests\StudentContractRequest;
-use App\Models\StudentContract;
-use Carbon\CarbonImmutable;
-use Illuminate\Support\Facades\Validator as ValidatorFacade;
-use Illuminate\Validation\Validator;
-use Tests\TestCase;
-
-class StudentContractRequestTest extends TestCase
-{
-    protected function setUp(): void
-    {
-        parent::setUp();
-
-        app()->setLocale('pt');
-        CarbonImmutable::setTestNow('2026-08-10 12:00:00');
-    }
-
-    protected function tearDown(): void
-    {
-        CarbonImmutable::setTestNow();
-
-        parent::tearDown();
-    }
-
-    public function test_it_does_not_allow_changing_the_contract_start_date(): void
-    {
-        $validator = $this->validatorFor([
-            'signature_date' => '2025-01-11',
-        ]);
-
-        $this->assertSame(
-            ['A data de início do contrato não pode ser alterada.'],
-            $validator->errors()->get('signature_date'),
-        );
-    }
-
-    public function test_it_allows_sending_the_unchanged_contract_start_date(): void
-    {
-        $validator = $this->validatorFor([
-            'signature_date' => '2025-01-10',
-        ]);
-
-        $this->assertFalse($validator->errors()->has('signature_date'));
-    }
-
-    public function test_it_does_not_allow_reducing_the_contract_end_date(): void
-    {
-        $validator = $this->validatorFor([
-            'end_date' => '2026-11-30',
-        ]);
-
-        $this->assertSame(
-            ['A data de fim do contrato não pode ser reduzida.'],
-            $validator->errors()->get('end_date'),
-        );
-    }
-
-    public function test_it_allows_renewal_up_to_one_year_from_today(): void
-    {
-        $validator = $this->validatorFor([
-            'end_date' => '2027-08-10',
-        ]);
-
-        $this->assertFalse($validator->errors()->has('end_date'));
-    }
-
-    public function test_it_rejects_renewal_beyond_one_year_from_today(): void
-    {
-        $validator = $this->validatorFor([
-            'end_date' => '2027-08-11',
-        ]);
-
-        $this->assertSame(
-            ['A data de fim do contrato pode ser prorrogada no máximo até 10/08/2027.'],
-            $validator->errors()->get('end_date'),
-        );
-    }
-
-    private function validatorFor(array $data): Validator
-    {
-        $contract = new StudentContract;
-        $contract->signature_date = '2025-01-10';
-        $contract->end_date       = '2026-12-01';
-
-        $request           = TestableStudentContractRequest::create('/', 'PUT', $data);
-        $request->contract = $contract;
-        $validator         = ValidatorFacade::make($request->all(), $request->rules());
-
-        foreach ($request->after() as $callback) {
-            $validator->after($callback);
-        }
-
-        return $validator;
-    }
-}
-
-class TestableStudentContractRequest extends StudentContractRequest
-{
-    public ?StudentContract $contract = null;
-
-    protected function contractBeingUpdated(): ?StudentContract
-    {
-        return $this->contract;
-    }
-}

+ 0 - 41
tests/Unit/Models/StudentResponsibleTest.php

@@ -1,41 +0,0 @@
-<?php
-
-namespace Tests\Unit\Models;
-
-use App\Models\StudentResponsible;
-use Illuminate\Validation\ValidationException;
-use Tests\TestCase;
-
-class StudentResponsibleTest extends TestCase
-{
-    public function test_it_rejects_a_minor_when_saving_the_model(): void
-    {
-        $responsible = new TestableStudentResponsible;
-
-        $responsible->birth_date = now()->subYears(17)->toDateString();
-
-        $this->expectException(ValidationException::class);
-        $this->expectExceptionMessage(__('validation.responsible_must_be_adult'));
-
-        $responsible->fireSavingEvent();
-    }
-
-    public function test_it_allows_an_adult_when_saving_the_model(): void
-    {
-        $responsible = new TestableStudentResponsible;
-
-        $responsible->birth_date = now()->subYears(18)->toDateString();
-
-        $responsible->fireSavingEvent();
-
-        $this->assertSame(18, $responsible->birth_date->age);
-    }
-}
-
-class TestableStudentResponsible extends StudentResponsible
-{
-    public function fireSavingEvent(): mixed
-    {
-        return $this->fireModelEvent('saving');
-    }
-}

+ 0 - 104
tests/Unit/Models/StudentTest.php

@@ -1,104 +0,0 @@
-<?php
-
-namespace Tests\Unit\Models;
-
-use App\Models\Student;
-use App\ValueObjects\Cpf;
-use Illuminate\Validation\ValidationException;
-use Tests\TestCase;
-
-class StudentTest extends TestCase
-{
-    public function test_it_rejects_a_minor_without_a_responsible_when_creating(): void
-    {
-        app()->setLocale('pt');
-
-        $student = new TestableStudent;
-
-        $student->birth_date = now()->subYears(10)->toDateString();
-
-        $this->expectException(ValidationException::class);
-        $this->expectExceptionMessage('É obrigatório informar um responsável para estudantes menores de idade.');
-
-        $student->fireCreatingEvent();
-    }
-
-    public function test_it_allows_a_minor_with_a_responsible_when_creating(): void
-    {
-        $student = (new TestableStudent)
-            ->withResponsibleForCreation(['name' => 'Responsável']);
-
-        $student->birth_date = now()->subYears(10)->toDateString();
-
-        $student->fireCreatingEvent();
-
-        $this->assertTrue($student->isMinor());
-    }
-
-    public function test_it_allows_an_adult_without_a_responsible_when_creating(): void
-    {
-        $student = new TestableStudent;
-
-        $student->birth_date = now()->subYears(18)->toDateString();
-
-        $student->fireCreatingEvent();
-
-        $this->assertFalse($student->isMinor());
-    }
-
-    public function test_it_casts_the_student_document_number_to_cpf(): void
-    {
-        $student = new Student;
-
-        $student->document_number = '529.982.247-25';
-
-        $this->assertInstanceOf(Cpf::class, $student->document_number);
-        $this->assertSame('52998224725', $student->document_number->value());
-    }
-
-    public function test_it_rejects_deletion_when_the_student_has_an_active_contract(): void
-    {
-        app()->setLocale('pt');
-
-        $student = (new TestableStudent)->withActiveContract();
-
-        $this->expectException(ValidationException::class);
-        $this->expectExceptionMessage('Não é possível excluir um estudante que possui contratos ativos.');
-
-        $student->fireDeletingEvent();
-    }
-
-    public function test_it_allows_deletion_when_the_student_has_no_active_contract(): void
-    {
-        $student = new TestableStudent;
-
-        $this->assertNull($student->fireDeletingEvent());
-    }
-}
-
-class TestableStudent extends Student
-{
-    private bool $hasActiveContract = false;
-
-    public function fireCreatingEvent(): mixed
-    {
-        return $this->fireModelEvent('creating');
-    }
-
-    public function fireDeletingEvent(): mixed
-    {
-        return $this->fireModelEvent('deleting');
-    }
-
-    public function withActiveContract(): self
-    {
-        $this->hasActiveContract = true;
-
-        return $this;
-    }
-
-    public function hasActiveContract(): bool
-    {
-        return $this->hasActiveContract;
-    }
-}

+ 0 - 57
tests/Unit/Rules/AdultBirthDateTest.php

@@ -1,57 +0,0 @@
-<?php
-
-namespace Tests\Unit\Rules;
-
-use App\Http\Requests\StudentRequest;
-use App\Http\Requests\StudentResponsibleRequest;
-use App\Rules\AdultBirthDate;
-use Illuminate\Support\Facades\Validator;
-use Tests\TestCase;
-
-class AdultBirthDateTest extends TestCase
-{
-    public function test_it_rejects_a_birth_date_from_a_minor(): void
-    {
-        $validator = Validator::make(
-            ['birth_date' => now()->subYears(17)->toDateString()],
-            ['birth_date' => ['date', new AdultBirthDate]],
-        );
-
-        $this->assertTrue($validator->fails());
-
-        $this->assertSame(
-            __('validation.responsible_must_be_adult'),
-            $validator->errors()->first('birth_date'),
-        );
-    }
-
-    public function test_it_accepts_a_birth_date_from_an_adult(): void
-    {
-        $validator = Validator::make(
-            ['birth_date' => now()->subYears(18)->toDateString()],
-            ['birth_date' => ['date', new AdultBirthDate]],
-        );
-
-        $this->assertFalse($validator->fails());
-    }
-
-    public function test_it_is_used_by_both_responsible_requests(): void
-    {
-        $studentRules = StudentRequest::create('/', 'POST')->rules();
-
-        $responsibleRules = StudentResponsibleRequest::create('/', 'POST')->rules();
-
-        $studentAdultRules = array_filter(
-            $studentRules['responsible.birth_date'],
-            fn (mixed $rule): bool => $rule instanceof AdultBirthDate,
-        );
-
-        $responsibleAdultRules = array_filter(
-            $responsibleRules['birth_date'],
-            fn (mixed $rule): bool => $rule instanceof AdultBirthDate,
-        );
-
-        $this->assertCount(1, $studentAdultRules);
-        $this->assertCount(1, $responsibleAdultRules);
-    }
-}

+ 279 - 0
tests/Unit/StudentContractProtocolTest.php

@@ -0,0 +1,279 @@
+<?php
+
+namespace Tests\Unit;
+
+use App\Http\Requests\UnitRequest;
+use App\Http\Resources\UnitResource;
+use App\Models\StudentContract;
+use App\Models\Unit;
+use App\Services\StudentContractService;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Validator as ValidatorFacade;
+use Tests\TestCase;
+
+class StudentContractProtocolTest extends TestCase
+{
+    public function test_it_generates_first_protocol_as_000001_when_no_contracts_exist(): void
+    {
+        $service = new class extends StudentContractService {
+            public function getMaxProtocolNumber(): int
+            {
+                return 0;
+            }
+        };
+
+        $this->assertSame('000001', $service->generateNextProtocol());
+    }
+
+    public function test_it_generates_sequential_protocol_based_on_max_existing_number(): void
+    {
+        $service = new class extends StudentContractService {
+            public int $max = 0;
+
+            public function getMaxProtocolNumber(): int
+            {
+                return $this->max;
+            }
+        };
+
+        $service->max = 1;
+        $this->assertSame('000002', $service->generateNextProtocol());
+
+        $service->max = 9;
+        $this->assertSame('000010', $service->generateNextProtocol());
+
+        $service->max = 99;
+        $this->assertSame('000100', $service->generateNextProtocol());
+
+        $service->max = 999;
+        $this->assertSame('001000', $service->generateNextProtocol());
+
+        $service->max = 999999;
+        $this->assertSame('1000000', $service->generateNextProtocol());
+    }
+
+    public function test_it_respects_global_sequence_across_multiple_units(): void
+    {
+        // Simulating contracts across multiple units:
+        // Unit 1 created contract 000001, Unit 2 created contract 000002, Unit 1 created contract 000003
+        $existingContracts = collect([
+            (object) ['unit_id' => 1, 'protocol' => '000001'],
+            (object) ['unit_id' => 2, 'protocol' => '000002'],
+            (object) ['unit_id' => 1, 'protocol' => '000003'],
+        ]);
+
+        $service = new class($existingContracts) extends StudentContractService {
+            public function __construct(private $contracts) {}
+
+            public function getMaxProtocolNumber(): int
+            {
+                return $this->contracts
+                    ->filter(fn ($c) => ctype_digit((string) $c->protocol))
+                    ->map(fn ($c) => (int) $c->protocol)
+                    ->max() ?? 0;
+            }
+        };
+
+        // Next protocol for ANY unit should be 000004
+        $this->assertSame('000004', $service->generateNextProtocol());
+    }
+
+    public function test_it_ignores_non_numeric_manual_protocols_when_calculating_next_sequence(): void
+    {
+        $existingContracts = collect([
+            (object) ['unit_id' => 1, 'protocol' => '000005'],
+            (object) ['unit_id' => 2, 'protocol' => 'CUSTOM-ABC-123'],
+            (object) ['unit_id' => 1, 'protocol' => 'CONTRATO-2026'],
+        ]);
+
+        $service = new class($existingContracts) extends StudentContractService {
+            public function __construct(private $contracts) {}
+
+            public function getMaxProtocolNumber(): int
+            {
+                return $this->contracts
+                    ->filter(fn ($c) => ctype_digit((string) $c->protocol))
+                    ->map(fn ($c) => (int) $c->protocol)
+                    ->max() ?? 0;
+            }
+        };
+
+        // Highest numeric is 5, so next sequence is 000006
+        $this->assertSame('000006', $service->generateNextProtocol());
+    }
+
+    public function test_it_recalculates_protocol_in_automatic_mode_when_creating_contract(): void
+    {
+        $unit = new Unit;
+        $unit->id = 10;
+        $unit->automatic_protocol = true;
+
+        $service = new class($unit) extends StudentContractService {
+            public array $capturedData = [];
+
+            public function __construct(private Unit $mockUnit) {}
+
+            protected function findUnit(int $unitId): ?Unit
+            {
+                return $this->mockUnit;
+            }
+
+            public function generateNextProtocol(): string
+            {
+                return '000007';
+            }
+
+            public function create(array $data): StudentContract
+            {
+                if (! empty($data['due_day'])) {
+                    $data['recurring_day'] = (int) $data['due_day'];
+                }
+                unset($data['due_day']);
+
+                $unitId = $data['unit_id'] ?? null;
+                $isAutomatic = true;
+
+                if ($unitId) {
+                    $unit = $this->findUnit($unitId);
+                    if ($unit && $unit->automatic_protocol === false) {
+                        $isAutomatic = false;
+                    }
+                }
+
+                if ($isAutomatic) {
+                    $data['protocol'] = $this->generateNextProtocol();
+                }
+
+                $this->capturedData = $data;
+
+                $contract = new StudentContract;
+                $contract->setRawAttributes($data);
+
+                return $contract;
+            }
+        };
+
+        // Client sent old/stale protocol '000001'
+        $contract = $service->create([
+            'unit_id' => 10,
+            'protocol' => '000001',
+            'status' => 'active',
+        ]);
+
+        // Service recalculates to '000007'
+        $this->assertSame('000007', $contract->protocol);
+        $this->assertSame('000007', $service->capturedData['protocol']);
+    }
+
+    public function test_it_preserves_custom_protocol_when_unit_automatic_protocol_is_disabled(): void
+    {
+        $unit = new Unit;
+        $unit->id = 20;
+        $unit->automatic_protocol = false;
+
+        $service = new class($unit) extends StudentContractService {
+            public array $capturedData = [];
+
+            public function __construct(private Unit $mockUnit) {}
+
+            protected function findUnit(int $unitId): ?Unit
+            {
+                return $this->mockUnit;
+            }
+
+            public function generateNextProtocol(): string
+            {
+                return '000099';
+            }
+
+            public function create(array $data): StudentContract
+            {
+                if (! empty($data['due_day'])) {
+                    $data['recurring_day'] = (int) $data['due_day'];
+                }
+                unset($data['due_day']);
+
+                $unitId = $data['unit_id'] ?? null;
+                $isAutomatic = true;
+
+                if ($unitId) {
+                    $unit = $this->findUnit($unitId);
+                    if ($unit && $unit->automatic_protocol === false) {
+                        $isAutomatic = false;
+                    }
+                }
+
+                if ($isAutomatic) {
+                    $data['protocol'] = $this->generateNextProtocol();
+                }
+
+                $this->capturedData = $data;
+
+                $contract = new StudentContract;
+                $contract->setRawAttributes($data);
+
+                return $contract;
+            }
+        };
+
+        // Franchisee with manual mode enters custom protocol
+        $contract = $service->create([
+            'unit_id' => 20,
+            'protocol' => 'MANUAL-2026-001',
+            'status' => 'active',
+        ]);
+
+        $this->assertSame('MANUAL-2026-001', $contract->protocol);
+        $this->assertSame('MANUAL-2026-001', $service->capturedData['protocol']);
+    }
+
+    public function test_unit_model_casts_automatic_protocol_to_boolean(): void
+    {
+        $unit = new Unit;
+        $unit->automatic_protocol = 1;
+        $this->assertTrue($unit->automatic_protocol);
+
+        $unit->automatic_protocol = 0;
+        $this->assertFalse($unit->automatic_protocol);
+
+        $unit->automatic_protocol = 'true';
+        $this->assertTrue($unit->automatic_protocol);
+    }
+
+    public function test_unit_resource_includes_automatic_protocol(): void
+    {
+        $unit = new Unit;
+        $unit->id = 1;
+        $unit->name = 'Unidade Teste';
+        $unit->social_reason = 'Unidade Teste LTDA';
+        $unit->automatic_protocol = false;
+        $unit->created_at = now();
+        $unit->updated_at = now();
+
+        $resource = new UnitResource($unit);
+        $array = $resource->toArray(Request::create('/'));
+
+        $this->assertArrayHasKey('automatic_protocol', $array);
+        $this->assertFalse($array['automatic_protocol']);
+
+        $unit->automatic_protocol = true;
+        $resourceTrue = new UnitResource($unit);
+        $arrayTrue = $resourceTrue->toArray(Request::create('/'));
+
+        $this->assertTrue($arrayTrue['automatic_protocol']);
+    }
+
+    public function test_unit_request_validates_automatic_protocol_as_boolean(): void
+    {
+        $rules = ['automatic_protocol' => (new UnitRequest)->rules()['automatic_protocol']];
+
+        $validValidator = ValidatorFacade::make(['automatic_protocol' => true], $rules);
+        $this->assertFalse($validValidator->errors()->has('automatic_protocol'));
+
+        $validFalseValidator = ValidatorFacade::make(['automatic_protocol' => false], $rules);
+        $this->assertFalse($validFalseValidator->errors()->has('automatic_protocol'));
+
+        $invalidValidator = ValidatorFacade::make(['automatic_protocol' => 'not-a-boolean'], $rules);
+        $this->assertTrue($invalidValidator->errors()->has('automatic_protocol'));
+    }
+}

+ 0 - 84
tests/Unit/ValueObjects/CnpjTest.php

@@ -1,84 +0,0 @@
-<?php
-
-namespace Tests\Unit\ValueObjects;
-
-use App\Models\Franchisee;
-use App\Models\Unit;
-use App\ValueObjects\Cnpj;
-use Illuminate\Support\Facades\Validator;
-use InvalidArgumentException;
-use Tests\TestCase;
-
-class CnpjTest extends TestCase
-{
-    public function test_it_accepts_and_normalizes_a_numeric_cnpj(): void
-    {
-        $cnpj = new Cnpj('04.252.011/0001-10');
-
-        $this->assertSame('04252011000110', $cnpj->value());
-        $this->assertSame('04.252.011/0001-10', $cnpj->formatted());
-        $this->assertSame('04252011000110', (string) $cnpj);
-        $this->assertSame('"04252011000110"', json_encode($cnpj));
-    }
-
-    public function test_it_accepts_and_normalizes_an_alphanumeric_cnpj(): void
-    {
-        $cnpj = new Cnpj('12.abc.345/01de-35');
-
-        $this->assertSame('12ABC34501DE35', $cnpj->value());
-        $this->assertSame('12.ABC.345/01DE-35', $cnpj->formatted());
-    }
-
-    public function test_it_rejects_an_invalid_cnpj(): void
-    {
-        app()->setLocale('pt');
-
-        $this->expectException(InvalidArgumentException::class);
-        $this->expectExceptionMessage('O CNPJ informado é inválido.');
-
-        new Cnpj('04.252.011/0001-11');
-    }
-
-    public function test_its_request_rule_validates_cnpj(): void
-    {
-        $valid = Validator::make(
-            ['cnpj' => '12.ABC.345/01DE-35'],
-            ['cnpj' => ['required', Cnpj::rule()]],
-        );
-
-        $invalid = Validator::make(
-            ['cnpj' => '12.ABC.345/01DE-36'],
-            ['cnpj' => ['required', Cnpj::rule()]],
-        );
-
-        $this->assertTrue($valid->passes());
-        $this->assertTrue($invalid->fails());
-    }
-
-    public function test_its_request_rule_uses_the_current_locale(): void
-    {
-        app()->setLocale('es');
-
-        $validator = Validator::make(
-            ['cnpj' => '04.252.011/0001-11'],
-            ['cnpj' => [Cnpj::rule()]],
-        );
-
-        $this->assertSame(
-            'El CNPJ proporcionado no es válido.',
-            $validator->errors()->first('cnpj'),
-        );
-    }
-
-    public function test_models_cast_cnpj_to_the_value_object(): void
-    {
-        foreach ([Franchisee::class, Unit::class] as $modelClass) {
-            $model = new $modelClass;
-
-            $model->cnpj = '04.252.011/0001-10';
-
-            $this->assertInstanceOf(Cnpj::class, $model->cnpj);
-            $this->assertSame('04252011000110', $model->getAttributes()['cnpj']);
-        }
-    }
-}

+ 0 - 77
tests/Unit/ValueObjects/CpfTest.php

@@ -1,77 +0,0 @@
-<?php
-
-namespace Tests\Unit\ValueObjects;
-
-use App\Models\Franchisee;
-use App\Models\StudentResponsible;
-use App\Models\UnitPartner;
-use App\Models\User;
-use App\ValueObjects\Cpf;
-use Illuminate\Support\Facades\Validator;
-use InvalidArgumentException;
-use Tests\TestCase;
-
-class CpfTest extends TestCase
-{
-    public function test_it_accepts_and_normalizes_a_valid_cpf(): void
-    {
-        $cpf = new Cpf('529.982.247-25');
-
-        $this->assertSame('52998224725', $cpf->value());
-        $this->assertSame('529.982.247-25', $cpf->formatted());
-        $this->assertSame('52998224725', (string) $cpf);
-        $this->assertSame('"52998224725"', json_encode($cpf));
-    }
-
-    public function test_it_rejects_an_invalid_cpf(): void
-    {
-        app()->setLocale('pt');
-
-        $this->expectException(InvalidArgumentException::class);
-        $this->expectExceptionMessage('O CPF informado é inválido.');
-
-        new Cpf('111.111.111-11');
-    }
-
-    public function test_its_request_rule_validates_cpf(): void
-    {
-        $valid = Validator::make(
-            ['cpf' => '529.982.247-25'],
-            ['cpf' => ['required', Cpf::rule()]],
-        );
-        $invalid = Validator::make(
-            ['cpf' => '529.982.247-24'],
-            ['cpf' => ['required', Cpf::rule()]],
-        );
-
-        $this->assertTrue($valid->passes());
-        $this->assertTrue($invalid->fails());
-    }
-
-    public function test_its_request_rule_uses_the_current_locale(): void
-    {
-        app()->setLocale('es');
-
-        $validator = Validator::make(
-            ['cpf' => '529.982.247-24'],
-            ['cpf' => [Cpf::rule()]],
-        );
-
-        $this->assertSame(
-            'El CPF proporcionado no es válido.',
-            $validator->errors()->first('cpf'),
-        );
-    }
-
-    public function test_models_cast_cpf_to_the_value_object(): void
-    {
-        foreach ([Franchisee::class, StudentResponsible::class, UnitPartner::class, User::class] as $modelClass) {
-            $model = new $modelClass;
-
-            $model->cpf = '529.982.247-25';
-
-            $this->assertInstanceOf(Cpf::class, $model->cpf);
-            $this->assertSame('52998224725', $model->getAttributes()['cpf']);
-        }
-    }
-}