Ate Douma pushed to branch master at cms-community / hippo-repository
Commits: cf2ff3bc by Canh Ngo at 2016-08-15T15:27:36+02:00 REPO-1551 Implement MockSession#removeItem Add a test-case to verify MockSession#removeItem behavior - - - - - 2 changed files: - testutils/src/main/java/org/onehippo/repository/mock/MockSession.java - testutils/src/test/java/org/onehippo/repository/mock/MockSessionTest.java Changes: ===================================== testutils/src/main/java/org/onehippo/repository/mock/MockSession.java ===================================== --- a/testutils/src/main/java/org/onehippo/repository/mock/MockSession.java +++ b/testutils/src/main/java/org/onehippo/repository/mock/MockSession.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com) + * Copyright 2012-2016 Hippo B.V. (http://www.onehippo.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -273,8 +273,8 @@ public class MockSession implements HippoSession { } @Override - public void removeItem(final String absPath) { - throw new UnsupportedOperationException(); + public void removeItem(final String absPath) throws RepositoryException { + getItem(absPath).remove(); } @Override ===================================== testutils/src/test/java/org/onehippo/repository/mock/MockSessionTest.java ===================================== --- a/testutils/src/test/java/org/onehippo/repository/mock/MockSessionTest.java +++ b/testutils/src/test/java/org/onehippo/repository/mock/MockSessionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com) + * Copyright 2012-2016 Hippo B.V. (http://www.onehippo.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -160,6 +160,16 @@ public class MockSessionTest { assertTrue(root.getSession().nodeExists("/bar/foo")); } + @Test + public void testRemoveNode() throws RepositoryException { + final MockNode root = createRootFooBarMockNode(); + assertTrue(root.getSession().nodeExists("/foo")); + + root.getSession().removeItem("/foo"); + + assertFalse(root.getSession().nodeExists("/foo")); + } + private MockNode createRootFooBarMockNode() throws RepositoryException { MockNode root = MockNode.root(); MockNode foo = new MockNode("foo"); View it on GitLab: https://code.onehippo.org/cms-community/hippo-repository/commit/cf2ff3bc1a02e74d3efd3173360f76f9201e2503
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn