<commit_before>package io.yawp.servlet.hierarchy;

import io.yawp.commons.utils.ServletTestCase;
import io.yawp.repository.models.basic.HookedObject;
import io.yawp.repository.models.hierarchy.AnotherObjectSubClass;
import io.yawp.repository.models.hierarchy.ObjectSubClass;
import org.junit.Ignore;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class HierarchyHookTest extends ServletTestCase {

    @Test
    public void testSuperClassHook() {
        String json = post("/hierarchy_subclasses/1", "{ name: 'john' }");

        ObjectSubClass object = from(json, ObjectSubClass.class);

        assertEquals("JOHN", object.getName());
    }

    @Test
    @Ignore
    public void testMoreSpecificSubClassHook() {
        String json = post("/hierarchy_another-subclasses/1", "{ name: 'john' }");

        AnotherObjectSubClass object = from(json, AnotherObjectSubClass.class);

        assertEquals("john more specific hook", object.getName());
    }

    @Test
    public void testAllObjectsHook() {
        String json = post("/hooked_objects", "{ stringValue: 'all_objects' }");
        HookedObject object = from(json, HookedObject.class);
        assertEquals("xpto all objects", object.getStringValue());<commit_msg>endpoint tree<commit_after>package io.yawp.servlet.hierarchy;

import io.yawp.commons.utils.ServletTestCase;
import io.yawp.repository.models.basic.HookedObject;
import io.yawp.repository.models.hierarchy.AnotherObjectSubClass;
import io.yawp.repository.models.hierarchy.ObjectSubClass;
import org.junit.Ignore;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class HierarchyHookTest extends ServletTestCase {

    @Test
    public void testSuperClassHook() {
        String json = post("/hierarchy_subclasses/1", "{ name: 'john' }");

        ObjectSubClass object = from(json, ObjectSubClass.class);

        assertEquals("JOHN", object.getName());
    }

    @Test
    public void testMoreSpecificSubClassHook() {
        String json = post("/hierarchy_another-subclasses/1", "{ name: 'john' }");

        AnotherObjectSubClass object = from(json, AnotherObjectSubClass.class);

        assertEquals("john more specific hook", object.getName());
    }

    @Test
    public void testAllObjectsHook() {
        String json = post("/hooked_objects", "{ stringValue: 'all_objects' }");
        HookedObject object = from(json, HookedObject.class);
        assertEquals("xpto all objects", object.getStringValue());
{'fraction_non_alphanumeric': 0.1188951160928743, 'fraction_numerical': 0.0016012810248198558, 'mean_word_length': 4.048484848484849, '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': '6080557', 'n_tokens_mistral': 736, 'n_tokens_neox': 707, 'n_words': 145}