<commit_before>package org.ambraproject.wombat.service;

import com.google.common.collect.ImmutableMap;
import com.google.gson.Gson;
import org.ambraproject.wombat.identity.RequestedDoiVersion;
import org.ambraproject.wombat.service.remote.ContentKey;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * used to return article metadata from json files during tests of article controller functionality
 */
public class TestArticleServiceImpl implements ArticleService {
  @Override
  public Map<String, ?> requestArticleMetadata(RequestedDoiVersion articleId, boolean excludeCitations) throws IOException {
    BufferedReader reader = new BufferedReader(
            new FileReader("src/test/resources/articleMeta/" + articleId.getDoi().replace("10.1371/journal.","") + ".json"));
    return (Map<String, Object>) new Gson().fromJson(reader, HashMap.class);
  }

  @Override
  public List<ImmutableMap<String, String>> getArticleFiguresAndTables(Map<?, ?> articleMetadata) {
    ImmutableMap<String, String> asset1 = ImmutableMap.<String, String>builder()
        .put("doi", "info:doi/10.1371/journal.pone.0008083.g001")
        .put("title", "Figure 1")
        .build();
    ImmutableMap<String, String> asset2 = ImmutableMap.<String, String>builder()
        .put("doi", "info:doi/10.1371/journal.pone.0008083.t001")
        .put("title", "Table 1")
        .build();
    ImmutableMap<String, String> asset3 = ImmutableMap.<String, String>builder()
        .put("doi", "info:doi/10.1371/journal.pone.0008083.g002")
        .put("title", "Figure 2")
        .build();
    ImmutableMap<String, String> asset4 = ImmutableMap.<String, String>builder()
        .put("doi", "info:doi/10.1371/journal.pone.0008083.g003")
        .put("title", "Figure 3")
        .build();
    return Arrays.asList(asset1, asset2, asset3, asset4);
  }

  @Override
  public ContentKey getManuscriptKey(RequestedDoiVersion articleId) throws IOException {
    throw new UnsupportedOperationException();
  }
}<commit_msg>DPRO-2730: Fix compile-time error in unit test<commit_after>package org.ambraproject.wombat.service;

import com.google.common.collect.ImmutableMap;
import com.google.gson.Gson;
import org.ambraproject.wombat.identity.ArticlePointer;
import org.ambraproject.wombat.identity.RequestedDoiVersion;
import org.ambraproject.wombat.service.remote.ContentKey;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * used to return article metadata from json files during tests of article controller functionality
 */
public class TestArticleServiceImpl implements ArticleService {
  @Override
  public Map<String, ?> requestArticleMetadata(RequestedDoiVersion articleId, boolean excludeCitations) throws IOException {
    BufferedReader reader = new BufferedReader(
            new FileReader("src/test/resources/articleMeta/" + articleId.getDoi().replace("10.1371/journal.","") + ".json"));
    return (Map<String, Object>) new Gson().fromJson(reader, HashMap.class);
  }

  @Override
  public List<ImmutableMap<String, String>> getArticleFiguresAndTables(Map<?, ?> articleMetadata) {
    ImmutableMap<String, String> asset1 = ImmutableMap.<String, String>builder()
        .put("doi", "info:doi/10.1371/journal.pone.0008083.g001")
        .put("title", "Figure 1")
        .build();
    ImmutableMap<String, String> asset2 = ImmutableMap.<String, String>builder()
        .put("doi", "info:doi/10.1371/journal.pone.0008083.t001")
        .put("title", "Table 1")
        .build();
    ImmutableMap<String, String> asset3 = ImmutableMap.<String, String>builder()
        .put("doi", "info:doi/10.1371/journal.pone.0008083.g002")
        .put("title", "Figure 2")
        .build();
    ImmutableMap<String, String> asset4 = ImmutableMap.<String, String>builder()
        .put("doi", "info:doi/10.1371/journal.pone.0008083.g003")
        .put("title", "Figure 3")
        .build();
    return Arrays.asList(asset1, asset2, asset3, asset4);
  }

  @Override
  public ContentKey getManuscriptKey(RequestedDoiVersion articleId) throws IOException {
    throw new UnsupportedOperationException();
  }

  @Override
  public Map<String, ?> getItemTable(ArticlePointer articleId) throws IOException {
    throw new UnsupportedOperationException();
  }
}
{'fraction_non_alphanumeric': 0.13218008427589265, 'fraction_numerical': 0.037258815701929474, 'mean_word_length': 4.337278106508876, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 30, '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': '984323', 'n_tokens_mistral': 1501, 'n_tokens_neox': 1355, 'n_words': 280}