<commit_before>package com.github.blindpirate.gogradle.core.cache

import com.github.blindpirate.gogradle.GogradleRunner
import com.github.blindpirate.gogradle.WithResource
import com.github.blindpirate.gogradle.core.dependency.GolangDependency
import com.github.blindpirate.gogradle.util.ReflectionUtils
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.InjectMocks
import org.mockito.Mock
import org.mockito.Mockito

import java.util.concurrent.Callable
import java.util.concurrent.CountDownLatch

@RunWith(GogradleRunner)
public class DefaultCacheManagerTest {

    File resource

    @InjectMocks
    DefaultCacheManager cacheManager
    @Mock
    GolangDependency dependency

    @Before
    void replaceGradleHome() {
    }

    @Test
    void "validation of global cache directory should success"() {
        cacheManager.ensureGlobalCacheExistAndWritable();
    }

    @Test
    @WithResource('')
    void 'multithread access should be safe'() {
        // given:
        Mockito.when(dependency.getName()).thenReturn("multithreadtest")
        ReflectionUtils.setField(cacheManager, "gradleHome", resource.getAbsoluteFile().toPath())

        // when:<commit_msg>remove redundant method<commit_after>package com.github.blindpirate.gogradle.core.cache

import com.github.blindpirate.gogradle.GogradleRunner
import com.github.blindpirate.gogradle.WithResource
import com.github.blindpirate.gogradle.core.dependency.GolangDependency
import com.github.blindpirate.gogradle.util.ReflectionUtils
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.InjectMocks
import org.mockito.Mock
import org.mockito.Mockito

import java.util.concurrent.Callable
import java.util.concurrent.CountDownLatch

@RunWith(GogradleRunner)
public class DefaultCacheManagerTest {

    File resource

    @InjectMocks
    DefaultCacheManager cacheManager
    @Mock
    GolangDependency dependency

    @Test
    void "validation of global cache directory should success"() {
        cacheManager.ensureGlobalCacheExistAndWritable();
    }

    @Test
    @WithResource('')
    void 'multithread access should be safe'() {
        // given:
        Mockito.when(dependency.getName()).thenReturn("multithreadtest")
        ReflectionUtils.setField(cacheManager, "gradleHome", resource.getAbsoluteFile().toPath())

        // when:
{'fraction_non_alphanumeric': 0.08887952822240944, 'fraction_numerical': 0.0, 'mean_word_length': 4.36117381489842, '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': '4268637', 'n_tokens_mistral': 731, 'n_tokens_neox': 695, 'n_words': 126}