Skip to content

Instantly share code, notes, and snippets.

@amischler
Created February 25, 2015 14:16
Show Gist options
  • Save amischler/a370a17c28ecb2fad48f to your computer and use it in GitHub Desktop.
Save amischler/a370a17c28ecb2fad48f to your computer and use it in GitHub Desktop.
JcrReferenceMap Test
package org.jcrom.modeshape;
import org.jcrom.Jcrom;
import org.jcrom.annotations.JcrName;
import org.jcrom.annotations.JcrPath;
import org.jcrom.annotations.JcrReference;
import org.junit.Test;
import org.modeshape.test.ModeShapeSingleUseTest;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import java.util.HashMap;
import java.util.Map;
/**
* User: Antoine Mischler <antoine@dooapp.com>
* Date: 25/02/15
* Time: 14:58
*/
public class JcrReferenceMapTest extends ModeShapeSingleUseTest {
public static class Container {
@JcrName
private String name;
@JcrPath
private String path;
@JcrReference
protected Map<String, B> map = new HashMap<String, B>();
public Container() {
}
}
public static class B {
@JcrName
private String name;
@JcrPath
private String path;
public B() {
}
}
@Test
public void testMapWithNullValue() throws RepositoryException {
Container container = new Container();
container.name = "c";
container.map.put("a", null);
Jcrom jcrom = new Jcrom();
jcrom.map(Container.class);
jcrom.map(B.class);
jcrom.addNode(session.getRootNode(), container);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment