<commit_before>/*
 * Dit bestand is een onderdeel van AWV DistrictCenter.
 * Copyright (c) AWV Agentschap <NAME>, <NAME>
 */

package be.vlaanderen.awv.atom.java;

import be.vlaanderen.awv.atom.JFeed;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.io.FileUtils;
import org.junit.Test;

import java.io.File;

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

/**
 * Tests JSON parsing of Atom feed (with generic entry type).
 */
public class JacksonParseAtomFeedTest {

    private ObjectMapper mapper = new ObjectMapper();

    @Test
    public void testParseAtomJson() throws Exception {
        String json = FileUtils.readFileToString(
                new File(this.getClass().getClassLoader().getResource(
                        "be/vlaanderen/awv/atom/java/atom-feed-sample.txt").getFile()));

        JFeed<EventFeedEntryTo> feed = mapper.readValue(json, new TypeReference<JFeed<EventFeedEntryTo>>() { });

        assertThat(feed).isNotNull();
        System.out.println(feed.getEntries().get(0).getContent().getType());
        System.out.println(feed.getEntries().get(0).getContent().getValue().getClass());
        System.out.println(feed.getEntries().get(0).getContent().getValue());
        assertThat(feed.getEntries().get(0).getContent().getValue()).isInstanceOf(EventFeedEntryTo.class);
    }

}<commit_msg>AT-9: removed System.out.println<commit_after>/*
 * Dit bestand is een onderdeel van AWV DistrictCenter.
 * Copyright (c) AWV Agentschap <NAME>, <NAME>
 */

package be.vlaanderen.awv.atom.java;

import be.vlaanderen.awv.atom.JFeed;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.io.FileUtils;
import org.junit.Test;

import java.io.File;

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

/**
 * Tests JSON parsing of Atom feed (with generic entry type).
 */
public class JacksonParseAtomFeedTest {

    private ObjectMapper mapper = new ObjectMapper();

    @Test
    public void testParseAtomJson() throws Exception {
        String json = FileUtils.readFileToString(
                new File(this.getClass().getClassLoader().getResource(
                        "be/vlaanderen/awv/atom/java/atom-feed-sample.txt").getFile()));

        JFeed<EventFeedEntryTo> feed = mapper.readValue(json, new TypeReference<JFeed<EventFeedEntryTo>>() { });

        assertThat(feed).isNotNull();
        assertThat(feed.getEntries().get(0).getContent().getValue()).isInstanceOf(EventFeedEntryTo.class);
    }

}
{'fraction_non_alphanumeric': 0.13338443848217707, 'fraction_numerical': 0.0022997316979685703, 'mean_word_length': 3.8513011152416357, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '1224427', 'n_tokens_mistral': 810, 'n_tokens_neox': 784, 'n_words': 143}