Using this as kind of definition, most Java projects wouldn’t actually be Java, but Java/maven. Then there is a clear definition where tests lie. The pom.xml actually has different scopes that compile either only production code or production code and the tests.
And there’s a second filesystem hierarchy for tests (src/main/java vs. src/test/java), but the two get merged together to figure out access by tests to package-private classes.
So this kind of exists, but in Java/maven.