https://github.com/openweb-nl/hippo-unit-tester
https://github.com/openweb-nl/hippo-unit-tester
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/openweb-nl/hippo-unit-tester
- Owner: openweb-nl
- License: apache-2.0
- Created: 2017-09-10T23:33:10.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-07-14T08:40:10.000Z (over 4 years ago)
- Last Synced: 2024-03-26T16:03:28.318Z (almost 2 years ago)
- Language: Java
- Size: 102 KB
- Stars: 2
- Watchers: 6
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# Hippo Unit Tester
Hippo Unit Tester is a framework that tries to take advantage of JCR mocking solutions and Hippo Mock objects to setup a mock Hippo API.
It tries to be as realistic as possible while still be highly manipulatable.
In order to enable developers to focus on designing their unit tests scenarios instead of focusing on technical details mocking process.
## Installation
1. Add dependency to pom.xml
```xml
nl.openweb.hippo
hippo-unit-tester
2.2.0
test
...
```
2. Add dependency to site pom.xml.
```xml
nl.openweb.hippo
hippo-unit-tester
```
## Usage
Within the package there are classes to extend from:
* BaseHippoTest
* SimpleHippoTest
### Importer
The importer works with JSON or XML.
It will import the file at given location.
#### XML
```xml
hippo:handle
mix:referenceable
3119bd98-9361-4b78-a81b-ad8228bc8bfb
ns:NewsPage
...
```
#### JSON
```json
```
### Debug
```java
/**
* prints out the whole JCR structure
*/
printNodeStructure();
/**
* prints out the JCR structure from given path
*/
printNodeStructure("/path");
```
### Explain
```java
/**
* When you want to create you own namespace
*/
registerNodeType("ns:custom");
```
```java
/**
* eForms needs a Local to be set
*/
request.setLocale(new Locale("nl_NL"));
````
```java
/**
* From the given file create a node containing the content of imported file
* Location should contain the path the node should be created not where you want to import the file
**/
importer.createNodesFromXml(getResourceAsStream("/nl/openweb/hippo/demo/news.xml"), "/content/documents/mychannel/news", "hippostd:folder");
````
### Demo
One of the best ways to learn about how to use this library is by looking at an [example](https://github.com/openweb-nl/hippo-unit-tester/blob/master/src/test/java/nl/openweb/hippo/demo/EssentialsListComponentTest.java)