diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/internal/template/TemplateManagerTest.java b/xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/internal/template/TemplateManagerTest.java
index 92fd587cf75eaf646176e103e6896f883a3e5215..23a0a86cb306299903999bbf180ac3bb9b55921f 100644
--- a/xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/internal/template/TemplateManagerTest.java
+++ b/xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/internal/template/TemplateManagerTest.java
@@ -186,7 +186,7 @@ void templateWithoutScriptRight() throws Exception
     @Test
     void templateCheatingProtection() throws Exception
     {
-        when(this.environmentMock.getResource("/templates/../secure[]")).thenReturn(new URL("file://secure[]"));
+        when(this.environmentMock.getResource("/templates/../secure[]")).thenReturn(new URL("file://secure%5B%5D"));
         when(this.environmentMock.getResourceAsStream("/templates/../template[]"))
             .thenReturn(new ByteArrayInputStream("source".getBytes("UTF8")));