Question about example in writing custom Java rules

I’m starting to look at writing a custom Java rule, so I’m looking at sonar-java/CUSTOM_RULES_101.md at master · SonarSource/sonar-java · GitHub . I haven’t gone very far through this, but I noticed something odd that I could use some clarification on, and perhaps it would be good to also clarify this in the document.

The doc specifically says this:

In folder `/src/test/files` , create a new empty file named `MyFirstCustomCheck.java` , and copy-paste the content of the following code snippet.

The content shown is this:

class MyClass {
}

Clearly, this is saying to define class “Myclass” inside “MyFirstCustomCheck.java”. There is nothing legally wrong with this. Java does allow for the source file name to not correspond to a class defined in that source file, but WHY is this example doing this? It’s odd to do this.