An open API service indexing awesome lists of open source software.

https://github.com/openweb-nl/hippo-unit-tester


https://github.com/openweb-nl/hippo-unit-tester

Last synced: 9 months ago
JSON representation

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)