Writing Java Unit Tests for Plugin CodeEdit online
This tutorial assumes that you have a Maven project that implements a plugin for Oxygen XML Web Author.
You need to create an AuthorDocumentModel, which is the server-side model for an XML
document opened in the browser. For this, you need to use the
ro.sync.ecss.extensions.api.webapp.WebappAuthorDocumentFactory
class. However, this class has to be configured to run in a development mode by following
these steps:- You need to declare a dependency on
mockito-all
in the pom.xml file, like this:<dependency> <groupId>org.mockito</groupId> <artifactId>mockito-all</artifactId> <version>1.10.19</version> <scope>test</scope> </dependency>
- In the root folder of your project, you need to create a
test/fake_editor_home/frameworks/ folder and place all the
frameworks you want to use in tests in this folder. The Web Author's default frameworks
are available in the Oxygen Maven
repository:
<dependency> <groupId>com.oxygenxml</groupId> <artifactId>frameworks</artifactId> <version>${oxygen.version}</version> <type>zip</type> </dependency>
- Call
MockAuthorDocumentFactory.initForTests()
on your test'ssetUp()
method.