Add test unit for JENKINS-22641

(cherry picked from commit 0d4c0cb6b274bfa18c810fcf761e3ad8b27ceb34)