<commit_before>
TODO NEXT:
- end-to-end tests: multiple tests
	OK - run on more than one thread; performance must improve (write a performance test with sleeps?)
		OK - testable with a static CountDownLatch used from two test methods
	OK - make it pass
		OK - SuiteRunner fires onSuiteFinished to early, because fi.jumi.core.runners.SuiteRunner.TestClassRunnerListenerToSuiteListener#onTestClassFinished is called too early (right after the tests are found and test runs started *asynchronously*)
			OK - fix TestClassRunner
				OK - wrap Executor, count workers
				OK - add assertions to fi.jumi.core.runners.TestClassRunnerTest#test_class_with_multiple_tests_which_are_run_in_parallel
				OK - see if SuiteRunner works now correctly
	OK - clean up TestClassRunner
		OK - extract WorkerCounter 
		OK - extract DriverRunnerSpawner
		OK - extract TestRunSpawner from DriverRunnerSpawner
	OK - merge AsynchronousExecutor with SingleThreadedActors?
	OK - clean up fi.jumi.actors.SingleThreadedActors#processEventsUntilIdle
	SKIP - give AppRunner a copy of all events, so that it can assert directly instead of parsing the output?
	OK - or then parse the text output; some regexp for getting the list of started/ended tests?
		OK - extract SuiteBuilder, SuiteMother
		OK - tests for TextUIParser (write against TextUI, don't mock its output)
			OK - test counts
			OK - test names (start and end events)
			OK - nested test names
			OK - many runs
				OK - ban junit:junit
					http://maven.apache.org/enforcer/enforcer-rules/bannedDependencies.html
				OK - update EventBuilder to generate runIds
				OK - RunId class to eliminate primitive obsession
				OK - make TextUI support multiple runs
				OK - make TextUIParser support multiple runs (see "regexp for parsing multiple runs 2.png")
		OK - change AppRunner to delegate to TextUIParser
			OK - update test count checks
			OK - expose run output form parser
			OK - update checkHasStackTrace
	OK - identify concurrent test runs with a unique ID (necessary yet?)
		OK - improve e2e test to check number of test runs
		OK - refactor the code to be changed
			OK - move duplicate removal from TestClassRunner to its own proxy class, to be composed inside SuiteRunner
			OK - rewrite TestClassRunnerTest in spec style
				OK - notifies when class is finished
				SKIP - forwards all other events
			OK - use WorkerCounter in SuiteRunner
			OK - rename SuiteRunnerTest to SuiteProtocolTest
			OK - create a new SuiteRunnerTest in spec style
				OK - notifies when all testclasses are finished
				OK - launches every testclass found, using its driver
				OK - removes duplicate onTestFound events (wiring test)
			OK - refactor TestRunSpawner
				OK - replace ExecutorListener.onCommandQueued with Executor.execute
				OK - ExecutorListener extends Executor
				OK - remove TestRunExecutor
				OK - rename MyPrivateExecutorListener to WorkerCountingExecutor
				OK - make the above public classes, rename TestRunSpawner to WorkerCountingExecutorSpawner
		OK - in jumi-core, event stubs for Executor and ExecutorListener go to the same package and conflict: ExecuteEvent gets overwritten, ExecutorListenerToEvent doesn't implement all methods
			OK? - fix bug: stubs for interfaces which extend interfaces should implement all inherited methods
			OK - fix bug: stubs for interfaces Foo and FooListener should go to separate packages
				OK - extract TargetPackageResolver from GenerateEventStubsMojo.getTargetPackage
					- methods: getFactoryPackage(), getStubsPackage(eventInterface) [during transition use the latter one]
					- one resolver for all EventStubGenerator instances, to resolve naming conflicts
				OK - there is no easy way to import a package
					OK - update Imports class to support importing package.*
					OK - update ClassBuilder to expose package import
					OK - update EventStubGenerator#getFactory to import stubsPackage
				OK - move reference stubs to DummyListener sub-package
				OK - always create sub-packages, so remove GenerateEventStubsMojo.createSubPackages
				OK - make EventStubGenerator responsible for creating sub-packages
				OK - put factories in the top-level package (the targetPackage specified in POM)
				OK - create sub-package names using Class.getSimpleName, without changing case or dropping "Listener"
					* still assumes that SimpleNames are unique, but that should be OK
				OK - update integration tests
		OK- update fi.jumi.core.runners.SuiteRunner.TestClassRunnerListenerToSuiteListener to use real runId
			OK - create RunIdSequence
			OK - write AssigningRunIdsTest against DefaultSuiteNotifier/DefaultTestNotifier
				OK - RunId is assigned when a test is started
				OK - nested tests in the same thread get the same RunId
				OK - new runs in the same thread get a different RunId
				OK - concurrent runs in other threads get a different RunId
					OK - extract mutable fields (RunContext) from CurrentRun into a ThreadLocal
				OK - nested tests in child threads get the same RunId
				OK - onRunStarted, onRunFinished events
			OK - propagate the RunIds to upper levels, until connected in SuiteRunner.TestClassRunnerListenerToSuiteListener
				OK - SuiteListenerProtocolTest: add tests for onRunStarted, onRunFinished
				OK - implement onRunStarted, onRunFinished in fi.jumi.core.runners.TestClassRunner
				OK - refactor CurrentRun, maybe move some event firing from the notifiers inside it
				OK - enable the disabled e2e tests
				OK - update the TextUI to use onRunStarted & onRunFinished
		OK - refactor tests; create hand-written spies
			OK - refactor TestClassRunnerTest's test to mention only onTestClassFinished
			OK - refactor SuiteRunnerTest's test to mention only onSuiteFinished
		OK - improve e2e test to check test start/end events
	OK - remove redundant parameters for SuiteListener
		OK - testClass can be deduced from onRunStarted's RunId
		OK - TestId of onTestFinished & onFailure can be deduced from last call to onTestStarted (also prevents faulty input)
		OK - refactor TextUI, keep hold of suite/run state better
	!! - eliminate duplicate method signatures in TestClassListener and TestClassRunnerListener
		- consider eliminating redundant parameters; should we also check for correctness here?
	- TestClassRunnerTest: write forwards_all_other_events (don't call start)
	- add @Override annotations to all interface implementations
		- enable "Missing @Override annotation" inspection
		- Analyze | Run Inspection by Name, Apply Quickfix

- refactor jumi-actors
	- make it impossible to use actors wrong
		- wrap all NonThreadSafe collaborators of a worker automatically into a secondary actor.
			Usage:
			        Spawner<DriverRunnerFactory> driverRunnerSpawner = new Spawner<DriverRunnerFactory>(DriverRunnerFactory.class, new BareDriverRunnerFactory());
			        // ...
			        driverRunnerSpawner
			                .whenFinished(new OnWorkerFinished())
			                .create(testClass, driverClass, listener /*NOT thread-safe*/, executor /*thread-safe*/);
			Boilerplate:<commit_msg>TODO notes<commit_after>
TODO NEXT:
- end-to-end tests: multiple tests
	OK - run on more than one thread; performance must improve (write a performance test with sleeps?)
		OK - testable with a static CountDownLatch used from two test methods
	OK - make it pass
		OK - SuiteRunner fires onSuiteFinished to early, because fi.jumi.core.runners.SuiteRunner.TestClassRunnerListenerToSuiteListener#onTestClassFinished is called too early (right after the tests are found and test runs started *asynchronously*)
			OK - fix TestClassRunner
				OK - wrap Executor, count workers
				OK - add assertions to fi.jumi.core.runners.TestClassRunnerTest#test_class_with_multiple_tests_which_are_run_in_parallel
				OK - see if SuiteRunner works now correctly
	OK - clean up TestClassRunner
		OK - extract WorkerCounter 
		OK - extract DriverRunnerSpawner
		OK - extract TestRunSpawner from DriverRunnerSpawner
	OK - merge AsynchronousExecutor with SingleThreadedActors?
	OK - clean up fi.jumi.actors.SingleThreadedActors#processEventsUntilIdle
	SKIP - give AppRunner a copy of all events, so that it can assert directly instead of parsing the output?
	OK - or then parse the text output; some regexp for getting the list of started/ended tests?
		OK - extract SuiteBuilder, SuiteMother
		OK - tests for TextUIParser (write against TextUI, don't mock its output)
			OK - test counts
			OK - test names (start and end events)
			OK - nested test names
			OK - many runs
				OK - ban junit:junit
					http://maven.apache.org/enforcer/enforcer-rules/bannedDependencies.html
				OK - update EventBuilder to generate runIds
				OK - RunId class to eliminate primitive obsession
				OK - make TextUI support multiple runs
				OK - make TextUIParser support multiple runs (see "regexp for parsing multiple runs 2.png")
		OK - change AppRunner to delegate to TextUIParser
			OK - update test count checks
			OK - expose run output form parser
			OK - update checkHasStackTrace
	OK - identify concurrent test runs with a unique ID (necessary yet?)
		OK - improve e2e test to check number of test runs
		OK - refactor the code to be changed
			OK - move duplicate removal from TestClassRunner to its own proxy class, to be composed inside SuiteRunner
			OK - rewrite TestClassRunnerTest in spec style
				OK - notifies when class is finished
				SKIP - forwards all other events
			OK - use WorkerCounter in SuiteRunner
			OK - rename SuiteRunnerTest to SuiteProtocolTest
			OK - create a new SuiteRunnerTest in spec style
				OK - notifies when all testclasses are finished
				OK - launches every testclass found, using its driver
				OK - removes duplicate onTestFound events (wiring test)
			OK - refactor TestRunSpawner
				OK - replace ExecutorListener.onCommandQueued with Executor.execute
				OK - ExecutorListener extends Executor
				OK - remove TestRunExecutor
				OK - rename MyPrivateExecutorListener to WorkerCountingExecutor
				OK - make the above public classes, rename TestRunSpawner to WorkerCountingExecutorSpawner
		OK - in jumi-core, event stubs for Executor and ExecutorListener go to the same package and conflict: ExecuteEvent gets overwritten, ExecutorListenerToEvent doesn't implement all methods
			OK? - fix bug: stubs for interfaces which extend interfaces should implement all inherited methods
			OK - fix bug: stubs for interfaces Foo and FooListener should go to separate packages
				OK - extract TargetPackageResolver from GenerateEventStubsMojo.getTargetPackage
					- methods: getFactoryPackage(), getStubsPackage(eventInterface) [during transition use the latter one]
					- one resolver for all EventStubGenerator instances, to resolve naming conflicts
				OK - there is no easy way to import a package
					OK - update Imports class to support importing package.*
					OK - update ClassBuilder to expose package import
					OK - update EventStubGenerator#getFactory to import stubsPackage
				OK - move reference stubs to DummyListener sub-package
				OK - always create sub-packages, so remove GenerateEventStubsMojo.createSubPackages
				OK - make EventStubGenerator responsible for creating sub-packages
				OK - put factories in the top-level package (the targetPackage specified in POM)
				OK - create sub-package names using Class.getSimpleName, without changing case or dropping "Listener"
					* still assumes that SimpleNames are unique, but that should be OK
				OK - update integration tests
		OK- update fi.jumi.core.runners.SuiteRunner.TestClassRunnerListenerToSuiteListener to use real runId
			OK - create RunIdSequence
			OK - write AssigningRunIdsTest against DefaultSuiteNotifier/DefaultTestNotifier
				OK - RunId is assigned when a test is started
				OK - nested tests in the same thread get the same RunId
				OK - new runs in the same thread get a different RunId
				OK - concurrent runs in other threads get a different RunId
					OK - extract mutable fields (RunContext) from CurrentRun into a ThreadLocal
				OK - nested tests in child threads get the same RunId
				OK - onRunStarted, onRunFinished events
			OK - propagate the RunIds to upper levels, until connected in SuiteRunner.TestClassRunnerListenerToSuiteListener
				OK - SuiteListenerProtocolTest: add tests for onRunStarted, onRunFinished
				OK - implement onRunStarted, onRunFinished in fi.jumi.core.runners.TestClassRunner
				OK - refactor CurrentRun, maybe move some event firing from the notifiers inside it
				OK - enable the disabled e2e tests
				OK - update the TextUI to use onRunStarted & onRunFinished
		OK - refactor tests; create hand-written spies
			OK - refactor TestClassRunnerTest's test to mention only onTestClassFinished
			OK - refactor SuiteRunnerTest's test to mention only onSuiteFinished
		OK - improve e2e test to check test start/end events
	OK - remove redundant parameters for SuiteListener
		OK - testClass can be deduced from onRunStarted's RunId
		OK - TestId of onTestFinished & onFailure can be deduced from last call to onTestStarted (also prevents faulty input)
		OK - refactor TextUI, keep hold of suite/run state better
	!! - eliminate duplicate method signatures in TestClassListener and TestClassRunnerListener
		- consider eliminating redundant parameters; should we also check for correctness here?
	- TestClassRunnerTest: write forwards_all_other_events (don't call start, check the assumed number of methods)
	- add @Override annotations to all interface implementations
		- enable "Missing @Override annotation" inspection
		- Analyze | Run Inspection by Name, Apply Quickfix
	- refactor TextUI
		- create SuiteState/SuiteEventDemuxer which collects all events and groups them into runs (fields: testNames, runs, suiteFinished, currentMessage)
		- move the counting passing/failing tests into its own visitor (fields: failedTests, allTests)
		- make SuitePrinter contain only printing commands, update it after updating SuiteState
		- create an abstract StatefulRunVisitor which keeps track of runningTests, gives access to testClass and testId (methods: getTestClass, getTestId, getTestName(testId), int getRunningTests)
		- make RunPrinter extend StatefulRunVisitor, do printing in overridden methods

- refactor jumi-actors
	- make it impossible to use actors wrong
		- wrap all NonThreadSafe collaborators of a worker automatically into a secondary actor.
			Usage:
			        Spawner<DriverRunnerFactory> driverRunnerSpawner = new Spawner<DriverRunnerFactory>(DriverRunnerFactory.class, new BareDriverRunnerFactory());
			        // ...
			        driverRunnerSpawner
			                .whenFinished(new OnWorkerFinished())
			                .create(testClass, driverClass, listener /*NOT thread-safe*/, executor /*thread-safe*/);
			Boilerplate:
{'fraction_non_alphanumeric': 0.042019654354456114, 'fraction_numerical': 0.0005421890884445951, 'mean_word_length': 3.847568988173456, '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': '2379273', 'n_tokens_mistral': 4267, 'n_tokens_neox': 3715, 'n_words': 1701}