use of org.apache.sling.jcr.js.nodetypes.mock.MockPropertyDefGenerator in project sling by apache.
the class DownloadDefaultBinaryValueTest method setUp.
@Before
public void setUp() throws RepositoryException, IOException {
// create mocks
request = mock(SlingHttpServletRequest.class);
response = mock(SlingHttpServletResponse.class);
resourceResolver = mock(ResourceResolver.class);
resource = mock(Resource.class);
rootNode = mock(Node.class);
session = mock(Session.class);
workspace = mock(Workspace.class);
ntManager = mock(NodeTypeManager.class);
outStream = new ByteArrayOutputStream();
// stubbing
when(request.getMethod()).thenReturn(HttpConstants.METHOD_GET);
when(request.getResourceResolver()).thenReturn(resourceResolver);
when(resourceResolver.getResource("/")).thenReturn(resource);
when(resource.adaptTo(Node.class)).thenReturn(rootNode);
when(rootNode.getSession()).thenReturn(session);
when(session.getWorkspace()).thenReturn(workspace);
when(workspace.getNodeTypeManager()).thenReturn(ntManager);
when(response.getWriter()).thenReturn(new PrintWriter(outStream, true));
propDefGenerator = new MockPropertyDefGenerator();
}
Aggregations