<commit_before>package org.sfm.jdbc;


import org.junit.Test;
import org.sfm.beans.DbObject;

import static org.junit.Assert.assertEquals;

public class JdbcMapperToStringTest {

    @Test
    public void testStaticJdbcMapperNoAsm() {
        JdbcMapper<DbObject> mapper = JdbcMapperFactory
                .newInstance()
                .useAsm(false)
                .newBuilder(DbObject.class).addMapping("id").addMapping("name").mapper();

        assertEquals("JdbcMapperImpl{" +
                "instantiator=StaticConstructorInstantiator{constructor=public org.sfm.beans.DbObject(), args=[]}, " +
                "fieldMappers=[LongFieldMapper{getter=LongResultSetGetter{column=1}, setter=LongMethodSetter{method=public void org.sfm.beans.DbObject.setId(long)}}, " +
                "FieldMapperImpl{getter=StringResultSetGetter{column=2}, setter=MethodSetter{method=public void org.sfm.beans.DbObject.setName(java.lang.String)}}]}", mapper.toString());
    }

    @Test
    public void testStaticJdbcMapperAsm() {
        JdbcMapper<DbObject> mapper = JdbcMapperFactory
                .newInstance()
                .newBuilder(DbObject.class).addMapping("id").addMapping("name").mapper();

//        assertEquals("AsmMapperResultSet2DbObject2_1{" +
//                "instantiator=AsmInstantiatorDbObjectResultSet0{}, " +
//                "mapper0=LongFieldMapper{getter=LongResultSetGetter{column=1}, setter=AsmSettersetIdDbObjectlong{}}, " +
//                "mapper1=FieldMapperImpl{getter=StringResultSetGetter{column=2}, setter=AsmSettersetNameDbObjectString{}}}", mapper.toString());
    }
}<commit_msg>#115 use regex for asm<commit_after>package org.sfm.jdbc;


import org.junit.Test;
import org.sfm.beans.DbObject;

import java.util.regex.Pattern;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class JdbcMapperToStringTest {

    @Test
    public void testStaticJdbcMapperNoAsm() {
        JdbcMapper<DbObject> mapper = JdbcMapperFactory
                .newInstance()
                .useAsm(false)
                .newBuilder(DbObject.class).addMapping("id").addMapping("name").mapper();

        assertEquals("JdbcMapperImpl{" +
                "instantiator=StaticConstructorInstantiator{constructor=public org.sfm.beans.DbObject(), args=[]}, " +
                "fieldMappers=[LongFieldMapper{getter=LongResultSetGetter{column=1}, setter=LongMethodSetter{method=public void org.sfm.beans.DbObject.setId(long)}}, " +
                "FieldMapperImpl{getter=StringResultSetGetter{column=2}, setter=MethodSetter{method=public void org.sfm.beans.DbObject.setName(java.lang.String)}}]}", mapper.toString());
    }

    @Test
    public void testStaticJdbcMapperAsm() {
        JdbcMapper<DbObject> mapper = JdbcMapperFactory
                .newInstance()
                .newBuilder(DbObject.class).addMapping("id").addMapping("name").mapper();

        assertTrue(Pattern.matches("AsmMapperResultSet2DbObject2_[0-9]+\\{" +
                "instantiator=AsmInstantiatorDbObjectResultSet[0-9]+\\{\\}, " +
                "mapper0=LongFieldMapper\\{getter=LongResultSetGetter\\{column=1\\}, setter=AsmSettersetIdDbObjectlong\\{\\}\\}, " +
                "mapper1=FieldMapperImpl\\{getter=StringResultSetGetter\\{column=2\\}, setter=AsmSettersetNameDbObjectString\\{\\}\\}\\}", mapper.toString()));
    }
}
{'fraction_non_alphanumeric': 0.1368483412322275, 'fraction_numerical': 0.00740521327014218, 'mean_word_length': 3.4906914893617023, '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': '5008209', 'n_tokens_mistral': 1046, 'n_tokens_neox': 1005, 'n_words': 111}