Skip to content

Commit

Permalink
[Misc] Improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
tmortagne committed Jan 13, 2025
1 parent d85bd8f commit d53d6e3
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.xwiki.model.reference.DocumentReference;
import org.xwiki.template.TemplateManager;
import org.xwiki.test.page.PageTest;
import org.xwiki.velocity.VelocityManager;

import com.xpn.xwiki.XWikiException;
import com.xpn.xwiki.doc.XWikiDocument;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand All @@ -60,17 +62,20 @@ class CreateInlinePageTest extends PageTest

private static final String ERROR_MESSAGE_CLASS = "errormessage";

@Inject
private VelocityManager velocityManager;

@Inject
private TemplateManager templateManager;

@BeforeEach
void setup() throws Exception
void setup()
{
this.velocityManager = this.oldcore.getMocker().getInstance(VelocityManager.class);
// Set an empty list of recommended template providers to avoid a Velocity error.
this.velocityManager.getVelocityContext().put("recommendedTemplateProviders", List.of());

// Set a context document to avoid problems
this.oldcore.getXWikiContext().setDoc(new XWikiDocument(new DocumentReference("xwiki", "space", "page")));
}

/**
Expand Down

0 comments on commit d53d6e3

Please sign in to comment.