<commit_before>package ch.trick17.betterchecks.util;

import static junit.framework.Assert.*;

import java.lang.reflect.InvocationTargetException;

import org.junit.Test;

import ch.trick17.betterchecks.fluent.ObjectCheck;

public class SimpleThreadLocalTest {
    
    @Test
    @SuppressWarnings("null")
    public void testNoArgConstructorThreadLocal() {
        new SimpleThreadLocal<Object>(Object.class).get();
        new SimpleThreadLocal<Object>(String.class).get();
        new SimpleThreadLocal<Object>(ObjectCheck.class).get();
        
        RuntimeException thrown = null;
        try {
            final Object threadLocal = new SimpleThreadLocal<Integer>(
                    Integer.class);
            threadLocal.toString();
        } catch(final RuntimeException e) {
            thrown = e;
        }
        assertNotNull(thrown);
        assertEquals(thrown.getMessage(),
                "Could not access the no-arg constructor of class java.lang.Integer");
        assertTrue(thrown.getCause() instanceof NoSuchMethodException);
        
        thrown = null;
        final ThreadLocal<ThrowingHelper> threadLocal = new SimpleThreadLocal<ThrowingHelper>(
                ThrowingHelper.class);
        try {
            threadLocal.get();
        } catch(final RuntimeException e) {
            thrown = e;
        }
        assertNotNull(thrown);
        assertEquals(
                thrown.getMessage(),
                "Could not create initial value for ThreadLocal with class: ch.trick17.betterchecks.util.SimpleThreadLocalTest$ThrowingHelper");
        assertTrue(thrown.getCause() instanceof InvocationTargetException);
    }
    <commit_msg>Fixed SimpleThreadLocalTest<commit_after>package ch.trick17.betterchecks.util;

import static junit.framework.Assert.*;

import java.lang.reflect.InvocationTargetException;

import org.junit.Test;

import ch.trick17.betterchecks.fluent.ObjectCheck;

public class SimpleThreadLocalTest {
    
    @Test
    @SuppressWarnings("null")
    public void testNoArgConstructorThreadLocal() {
        new SimpleThreadLocal<Object>(Object.class).get();
        new SimpleThreadLocal<Object>(String.class).get();
        new SimpleThreadLocal<Object>(ObjectCheck.class).get();
        
        RuntimeException thrown = null;
        try {
            final Object threadLocal = new SimpleThreadLocal<Integer>(
                    Integer.class);
            threadLocal.toString();
        } catch(final RuntimeException e) {
            thrown = e;
        }
        assertNotNull(thrown);
        assertEquals(
                "Class java.lang.Integer does not have a no-arg constructor",
                thrown.getMessage());
        assertTrue(thrown.getCause() instanceof NoSuchMethodException);
        
        thrown = null;
        final ThreadLocal<ThrowingHelper> threadLocal = new SimpleThreadLocal<ThrowingHelper>(
                ThrowingHelper.class);
        try {
            threadLocal.get();
        } catch(final RuntimeException e) {
            thrown = e;
        }
        assertNotNull(thrown);
        assertEquals(
                "Could not create initial value for ThreadLocal with class: ch.trick17.betterchecks.util.SimpleThreadLocalTest$ThrowingHelper",
                thrown.getMessage());
        assertTrue(thrown.getCause() instanceof InvocationTargetException);
    }
    
{'fraction_non_alphanumeric': 0.08937555489789879, 'fraction_numerical': 0.003551346552234389, 'mean_word_length': 2.4917355371900825, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '3958610', 'n_tokens_mistral': 850, 'n_tokens_neox': 841, 'n_words': 173}