<commit_before>/*
 * FXGL - JavaFX Game Library. The MIT License (MIT).
 * Copyright (c) AlmasB (<EMAIL>).
 * See LICENSE for details.
 */

package com.almasb.fxgl.core.concurrent

import com.almasb.fxgl.test.RunWithFX
import javafx.application.Platform
import javafx.util.Duration
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.CoreMatchers.not
import org.hamcrest.MatcherAssert.assertThat
import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable
import org.junit.jupiter.api.extension.ExtendWith
import java.time.Duration.ofSeconds
import java.util.concurrent.CountDownLatch

/**
 *
 *
 * @author <NAME> (<EMAIL>)
 */
@ExtendWith(RunWithFX::class)
class ConcurrencyTest {

    companion object {
        private lateinit var executor: Executor

        @AfterAll
        @JvmStatic
        fun `tearDown`() {
            executor.shutdownNow()
        }
    }

    @BeforeEach
    fun `init`() {
        executor = Async
    }

    @Test
    fun `Test that execute runs in a different thread`() {
        assertTimeout(ofSeconds(2)) {<commit_msg>do not shut down Async since it is global access and it will be shut down in system test<commit_after>/*
 * FXGL - JavaFX Game Library. The MIT License (MIT).
 * Copyright (c) AlmasB (<EMAIL>).
 * See LICENSE for details.
 */

package com.almasb.fxgl.core.concurrent

import com.almasb.fxgl.test.RunWithFX
import javafx.application.Platform
import javafx.util.Duration
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.CoreMatchers.not
import org.hamcrest.MatcherAssert.assertThat
import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable
import org.junit.jupiter.api.extension.ExtendWith
import java.time.Duration.ofSeconds
import java.util.concurrent.CountDownLatch

/**
 *
 *
 * @author <NAME> (<EMAIL>)
 */
@ExtendWith(RunWithFX::class)
class ConcurrencyTest {

    companion object {
        private lateinit var executor: Executor

        @BeforeAll
        @JvmStatic
        fun `init`() {
            executor = Async
        }
    }

    @Test
    fun `Test that execute runs in a different thread`() {
        assertTimeout(ofSeconds(2)) {
{'fraction_non_alphanumeric': 0.10539018503620273, 'fraction_numerical': 0.0008045052292839903, 'mean_word_length': 3.546617915904936, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5834188', 'n_tokens_mistral': 790, 'n_tokens_neox': 776, 'n_words': 178}