<commit_before>package org.gbif.registry.oaipmh;

import com.lyncode.test.matchers.xml.XPathMatchers;
import org.apache.commons.io.IOUtils;
import org.hamcrest.Matcher;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;

/**
 * Test the response for an OAI-PMH Identify query.
 */
public class IdentifyTest {

  private static final String OAI_NAMESPACE = "http://www.openarchives.org/OAI/2.0/";

  @Test
  public void testIdentify() throws IOException {

    OaipmhEndpoint oaipmhEndpoint = new OaipmhEndpoint();

    InputStream resultStream = oaipmhEndpoint.oaipmh("Identify");

    String result = IOUtils.toString(resultStream, "UTF-8");

    assertThat("Repository name element is present", result, xPath("//repositoryName", equalTo("GBIF Registry")));
    assertThat("Base URL element is set", result, xPath("//baseURL", equalTo("http://localhost")));
    assertThat("Admin email is set", result, xPath("//adminEmail", equalTo("<EMAIL>")));
  }

  private Matcher<String> xPath(String xpath, Matcher<String> valueMatcher) {
    return XPathMatchers.xPath(xpath, valueMatcher, OAI_NAMESPACE);
  }
}
<commit_msg>fixed Identity test<commit_after>package org.gbif.registry.oaipmh;

import com.lyncode.test.matchers.xml.XPathMatchers;
import org.apache.commons.io.IOUtils;
import org.hamcrest.Matcher;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;

/**
 * Test the response for an OAI-PMH Identify query.
 */
public class IdentifyTest {

  private static final String OAI_NAMESPACE = "http://www.openarchives.org/OAI/2.0/";

  @Test
  public void testIdentify() throws IOException {

    OaipmhEndpoint oaipmhEndpoint = new OaipmhEndpoint();

    InputStream resultStream = oaipmhEndpoint.oaipmh("Identify", null);

    String result = IOUtils.toString(resultStream, "UTF-8");

    assertThat("Repository name element is present", result, xPath("//repositoryName", equalTo("GBIF Registry")));
    assertThat("Base URL element is set", result, xPath("//baseURL", equalTo("http://localhost")));
    assertThat("Admin email is set", result, xPath("//adminEmail", equalTo("<EMAIL>")));
  }

  private Matcher<String> xPath(String xpath, Matcher<String> valueMatcher) {
    return XPathMatchers.xPath(xpath, valueMatcher, OAI_NAMESPACE);
  }
}

{'fraction_non_alphanumeric': 0.12788844621513945, 'fraction_numerical': 0.002390438247011952, 'mean_word_length': 5.094660194174757, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '5147255', 'n_tokens_mistral': 803, 'n_tokens_neox': 796, 'n_words': 179}