<commit_before>package no.cantara.dwsample.resources;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JSR310Module;
import io.dropwizard.jackson.Jackson;
import io.dropwizard.java8.jersey.OptionalMessageBodyWriter;
import io.dropwizard.java8.jersey.OptionalParamFeature;
import io.dropwizard.testing.junit.ResourceTestRule;
import no.cantara.dwsample.api.Saying;
import no.cantara.dwsample.domain.counter.CounterService;
import org.hibernate.validator.HibernateValidator;
import org.junit.After;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;

import javax.validation.Validation;
import javax.validation.Validator;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

public class PersonResourceTest {

    private static final CounterService counterService = mock(CounterService.class);

    private static final ObjectMapper MAPPER = Jackson.newObjectMapper()
            .setSerializationInclusion(JsonInclude.Include.NON_NULL)
            .registerModules(new Jdk8Module())
            .registerModules(new JSR310Module());

    private static final Validator VALIDATOR = Validation.byProvider(HibernateValidator.class).configure().addValidatedValueHandler(
            new io.dropwizard.java8.validation.valuehandling.OptionalValidatedValueUnwrapper())
            .addValidatedValueHandler(new io.dropwizard.java8.validation.valuehandling.OptionalValidatedValueUnwrapper()).buildValidatorFactory()
            .getValidator();

    @ClassRule
    public static final ResourceTestRule resources = ResourceTestRule.builder()
            .setMapper(MAPPER)
            .setValidator(VALIDATOR)
            .addProvider(OptionalMessageBodyWriter.class)
            .addProvider(OptionalParamFeature.class)
            .addResource(new HelloWorldResource("Hello, %s!", "Mr. Smith", counterService))
            .build();<commit_msg>Don't use Deprecated code.<commit_after>package no.cantara.dwsample.resources;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import io.dropwizard.jackson.Jackson;
import io.dropwizard.java8.jersey.OptionalMessageBodyWriter;
import io.dropwizard.java8.jersey.OptionalParamFeature;
import io.dropwizard.testing.junit.ResourceTestRule;
import no.cantara.dwsample.api.Saying;
import no.cantara.dwsample.domain.counter.CounterService;
import org.hibernate.validator.HibernateValidator;
import org.junit.After;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;

import javax.validation.Validation;
import javax.validation.Validator;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

public class PersonResourceTest {

    private static final CounterService counterService = mock(CounterService.class);

    private static final ObjectMapper MAPPER = Jackson.newObjectMapper()
            .setSerializationInclusion(JsonInclude.Include.NON_NULL)
            .registerModules(new Jdk8Module())
            .registerModules(new JavaTimeModule());

    private static final Validator VALIDATOR = Validation.byProvider(HibernateValidator.class).configure().addValidatedValueHandler(
            new io.dropwizard.java8.validation.valuehandling.OptionalValidatedValueUnwrapper())
            .addValidatedValueHandler(new io.dropwizard.java8.validation.valuehandling.OptionalValidatedValueUnwrapper()).buildValidatorFactory()
            .getValidator();

    @ClassRule
    public static final ResourceTestRule resources = ResourceTestRule.builder()
            .setMapper(MAPPER)
            .setValidator(VALIDATOR)
            .addProvider(OptionalMessageBodyWriter.class)
            .addProvider(OptionalParamFeature.class)
            .addResource(new HelloWorldResource("Hello, %s!", "Mr. Smith", counterService))
            .build();
{'fraction_non_alphanumeric': 0.09233568342051399, 'fraction_numerical': 0.005913122583579713, 'mean_word_length': 4.645699614890885, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '1468694', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1197, 'n_words': 202}