<commit_before>// Copyright (c) 2013-present, febit.org. All Rights Reserved.
package org.febit.util.test;

import org.febit.lang.Defaults;
import org.febit.util.Petite;
import org.febit.util.Props;
import org.febit.util.PropsUtil;

/**
 *
 * @author zqq90
 */
public class Tests {

    private static final Petite PETITE;

    static {
        Props props = PropsUtil.loadFromClasspath(new Props(), "tests.props", "tests.props.local");
        PETITE = Petite.builder().addProps(props).build();
    }

    public static <T> T get(final Class<T> type) {
        return PETITE.get(type);
    }

    public static Object get(final String key) {
        return PETITE.get(key);
    }

    public static Object getProp(final String key) {
        return Defaults.or(PETITE.getProps(key), null);
    }

    public static Object getProp(final String key, Object defaultValue) {
        return Defaults.or(PETITE.getProps(key), defaultValue);
    }

    public static void inject(final Object bean) {<commit_msg>util: Tests<commit_after>// Copyright (c) 2013-present, febit.org. All Rights Reserved.
package org.febit.util.test;

import org.febit.lang.Defaults;
import org.febit.util.Petite;
import org.febit.util.Props;
import org.febit.util.PropsUtil;

/**
 *
 * @author zqq90
 */
public class Tests {

    private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(Tests.class);
    private static final Petite PETITE;

    static {
        Props props = new Props();
        try {
            PropsUtil.loadFromClasspath(props, "tests.props");
        } catch (Exception e) {
            LOG.warn(e.getLocalizedMessage());
        }
        try {
            PropsUtil.loadFromClasspath(props, "tests.props.local");
        } catch (Exception e) {
            LOG.warn(e.getLocalizedMessage());
        }
        PETITE = Petite.builder().addProps(props).build();
    }

    public static <T> T get(final Class<T> type) {
        return PETITE.get(type);
    }

    public static Object get(final String key) {
        return PETITE.get(key);
    }

    public static Object getProp(final String key) {
        return Defaults.or(PETITE.getProps(key), null);
    }

    public static Object getProp(final String key, Object defaultValue) {
        return Defaults.or(PETITE.getProps(key), defaultValue);
    }

    public static void inject(final Object bean) {
{'fraction_non_alphanumeric': 0.11779554059739167, 'fraction_numerical': 0.005889777029869584, 'mean_word_length': 2.8231511254019295, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5704527', 'n_tokens_mistral': 776, 'n_tokens_neox': 723, 'n_words': 179}