Function: projectile-test-at-point-java-command

projectile-test-at-point-java-command is a byte-compiled function defined in projectile.el.

Signature

(projectile-test-at-point-java-command TEST-NAME FILE-NAME)

Documentation

Return a command running Java's TEST-NAME from FILE-NAME.

JUnit addresses a test as Class#method\=, and Java requires the public class to be named after its file, so the class comes from FILE-NAME. Gradle and Maven spell the selector differently, so the project type decides which one to emit.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-test-at-point-java-command (test-name file-name)
  "Return a command running Java\\='s TEST-NAME from FILE-NAME.

JUnit addresses a test as `Class#method\\=', and Java requires the public
class to be named after its file, so the class comes from FILE-NAME.
Gradle and Maven spell the selector differently, so the project type
decides which one to emit."
  (let ((class (file-name-base file-name)))
    (if (memq (projectile-project-type) '(gradle gradlew))
        (format "./gradlew test --tests %s"
                (shell-quote-argument (format "%s.%s" class test-name)))
      (format "mvn test -Dtest=%s"
              (shell-quote-argument (format "%s#%s" class test-name))))))