package com.cloudhandson.vpdbackoffice.mapper;

import static org.assertj.core.api.Assertions.assertThat;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.junit.jupiter.api.Test;

class SchemaMetadataMapperXmlTest {

  @Test
  void annotationUsageQueriesUseOnlyColumnsProvidedByTheAllView() throws IOException {
    try (var input = getClass().getResourceAsStream("/mapper/SchemaMetadataMapper.xml")) {
      String mapperXml = new String(input.readAllBytes(), StandardCharsets.UTF_8);

      assertThat(mapperXml)
          .contains("FROM all_annotations_usage")
          .contains("object_name = #{tableName,jdbcType=VARCHAR}")
          .doesNotContain("object_owner");
    }
  }
}
