<commit_before>package org.dotwebstack.framework.frontend.ld.representation;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;

import org.dotwebstack.framework.backend.BackendSource;
import org.dotwebstack.framework.frontend.http.site.Site;
import org.dotwebstack.framework.frontend.http.stage.Stage;
import org.dotwebstack.framework.informationproduct.InformationProduct;
import org.dotwebstack.framework.test.DBEERPEDIA;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class RepresentationTest {

  @Rule
  public final ExpectedException thrown = ExpectedException.none();

  @Mock
  BackendSource backendSource;

  @Mock
  Site site;

  @Test
  public void builder() {
    // Act
    final Representation representation =
        new Representation.Builder(DBEERPEDIA.BREWERIES, DBEERPEDIA.URL_PATTERN.stringValue())
            .build();

    // Assert
    assertThat(representation.getIdentifier(), equalTo(DBEERPEDIA.BREWERIES));
    assertThat(representation.getInformationProduct(), equalTo(null));
    assertThat(representation.getStage(), equalTo(null));
    Assert.assertNotNull(representation.getUrlPatterns());
  }

  @Test
  public void builderWithoutUrlPatterns() {
    // Act
    final Representation representation =
        new Representation.Builder(DBEERPEDIA.BREWERIES)
            .build();

    // Assert
    assertThat(representation.getIdentifier(), equalTo(DBEERPEDIA.BREWERIES));
    assertThat(representation.getInformationProduct(), equalTo(null));
    assertThat(representation.getStage(), equalTo(null));
    Assert.assertNotNull(representation.getUrlPatterns());
  }

  @Test
  public void builderWithUrlPattern() {
    // Act
    final Representation representation = new Representation.Builder(DBEERPEDIA.BREWERIES,
        DBEERPEDIA.URL_PATTERN.stringValue()).build();

    // Assert
    assertThat(representation.getIdentifier(), equalTo(DBEERPEDIA.BREWERIES));

    assertThat(representation.getUrlPatterns().toArray()[0],
        equalTo(DBEERPEDIA.URL_PATTERN.stringValue()));
  }

  @Test
  public void builderMultipleUrlPatterns() {
    // Act
    final Representation representation =
        new Representation.Builder(DBEERPEDIA.BREWERIES, DBEERPEDIA.URL_PATTERN.stringValue(),
            DBEERPEDIA.URL_PATTERN.stringValue(),
            DBEERPEDIA.URL_PATTERN.stringValue())
            .build();

    // Assert
    assertThat(representation.getIdentifier(), equalTo(DBEERPEDIA.BREWERIES));
    assertThat(representation.getInformationProduct(), equalTo(null));
    assertThat(representation.getStage(), equalTo(null));
    assertThat(representation.getUrlPatterns().toArray()[0],
        equalTo(DBEERPEDIA.URL_PATTERN.stringValue()));
    assertThat(representation.getUrlPatterns().size(), equalTo(3));
  }

  @Test
  public void builderComplete() {
    // Act
    final InformationProduct informationProduct =
        new InformationProduct.Builder(DBEERPEDIA.BREWERIES, backendSource).label(
            DBEERPEDIA.BREWERIES_LABEL.stringValue()).build();

    final Stage stage = new Stage.Builder(DBEERPEDIA.BREWERIES, site).basePath(
        DBEERPEDIA.BASE_PATH.stringValue()).build();

    final Representation representation =
        new Representation.Builder(DBEERPEDIA.BREWERIES, DBEERPEDIA.URL_PATTERN.stringValue())
            .informationProduct(informationProduct)
            .stage(stage)
            .build();

    // Assert
    assertThat(representation.getIdentifier(), equalTo(DBEERPEDIA.BREWERIES));
    assertThat(representation.getInformationProduct(), equalTo(informationProduct));
    assertThat(representation.getStage(), equalTo(stage));
    assertThat(representation.getUrlPatterns().toArray()[0],
        equalTo(DBEERPEDIA.URL_PATTERN.stringValue()));
    assertThat(representation.getUrlPatterns().size(), equalTo(1));
  }

  @Test
  public void builderWithNullValues() {
    // Assert
    thrown.expect(NullPointerException.class);

    // Act
    final Representation representation =
        new Representation.Builder(DBEERPEDIA.BREWERIES, null).build();
  }

}<commit_msg>Remove obsolete test causing warnings<commit_after>package org.dotwebstack.framework.frontend.ld.representation;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;

import org.dotwebstack.framework.backend.BackendSource;
import org.dotwebstack.framework.frontend.http.site.Site;
import org.dotwebstack.framework.frontend.http.stage.Stage;
import org.dotwebstack.framework.informationproduct.InformationProduct;
import org.dotwebstack.framework.test.DBEERPEDIA;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class RepresentationTest {

  @Rule
  public final ExpectedException thrown = ExpectedException.none();

  @Mock
  BackendSource backendSource;

  @Mock
  Site site;

  @Test
  public void builder() {
    // Act
    final Representation representation = new Representation.Builder(DBEERPEDIA.BREWERIES,
        DBEERPEDIA.URL_PATTERN.stringValue()).build();

    // Assert
    assertThat(representation.getIdentifier(), equalTo(DBEERPEDIA.BREWERIES));
    assertThat(representation.getInformationProduct(), equalTo(null));
    assertThat(representation.getStage(), equalTo(null));
    Assert.assertNotNull(representation.getUrlPatterns());
  }

  @Test
  public void builderWithoutUrlPatterns() {
    // Act
    final Representation representation = new Representation.Builder(DBEERPEDIA.BREWERIES).build();

    // Assert
    assertThat(representation.getIdentifier(), equalTo(DBEERPEDIA.BREWERIES));
    assertThat(representation.getInformationProduct(), equalTo(null));
    assertThat(representation.getStage(), equalTo(null));
    Assert.assertNotNull(representation.getUrlPatterns());
  }

  @Test
  public void builderWithUrlPattern() {
    // Act
    final Representation representation = new Representation.Builder(DBEERPEDIA.BREWERIES,
        DBEERPEDIA.URL_PATTERN.stringValue()).build();

    // Assert
    assertThat(representation.getIdentifier(), equalTo(DBEERPEDIA.BREWERIES));

    assertThat(representation.getUrlPatterns().toArray()[0],
        equalTo(DBEERPEDIA.URL_PATTERN.stringValue()));
  }

  @Test
  public void builderMultipleUrlPatterns() {
    // Act
    final Representation representation =
        new Representation.Builder(DBEERPEDIA.BREWERIES, DBEERPEDIA.URL_PATTERN.stringValue(),
            DBEERPEDIA.URL_PATTERN.stringValue(), DBEERPEDIA.URL_PATTERN.stringValue()).build();

    // Assert
    assertThat(representation.getIdentifier(), equalTo(DBEERPEDIA.BREWERIES));
    assertThat(representation.getInformationProduct(), equalTo(null));
    assertThat(representation.getStage(), equalTo(null));
    assertThat(representation.getUrlPatterns().toArray()[0],
        equalTo(DBEERPEDIA.URL_PATTERN.stringValue()));
    assertThat(representation.getUrlPatterns().size(), equalTo(3));
  }

  @Test
  public void builderComplete() {
    // Act
    final InformationProduct informationProduct =
        new InformationProduct.Builder(DBEERPEDIA.BREWERIES, backendSource).label(
            DBEERPEDIA.BREWERIES_LABEL.stringValue()).build();

    final Stage stage = new Stage.Builder(DBEERPEDIA.BREWERIES, site).basePath(
        DBEERPEDIA.BASE_PATH.stringValue()).build();

    final Representation representation = new Representation.Builder(DBEERPEDIA.BREWERIES,
        DBEERPEDIA.URL_PATTERN.stringValue()).informationProduct(informationProduct).stage(
            stage).build();

    // Assert
    assertThat(representation.getIdentifier(), equalTo(DBEERPEDIA.BREWERIES));
    assertThat(representation.getInformationProduct(), equalTo(informationProduct));
    assertThat(representation.getStage(), equalTo(stage));
    assertThat(representation.getUrlPatterns().toArray()[0],
        equalTo(DBEERPEDIA.URL_PATTERN.stringValue()));
    assertThat(representation.getUrlPatterns().size(), equalTo(1));
  }

}
{'fraction_non_alphanumeric': 0.11333893624684836, 'fraction_numerical': 0.0012006243246488173, 'mean_word_length': 4.655125594025797, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6208192', 'n_tokens_mistral': 2496, 'n_tokens_neox': 2391, 'n_words': 346}