-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
...bundle/src/test/java/biz/netcentric/cq/tools/actool/helper/runtime/RuntimeHelperTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package biz.netcentric.cq.tools.actool.helper.runtime; | ||
|
||
/*- | ||
* #%L | ||
* Access Control Tool Bundle | ||
* %% | ||
* Copyright (C) 2015 - 2024 Cognizant Netcentric | ||
* %% | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* #L% | ||
*/ | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
import javax.jcr.RepositoryException; | ||
import javax.jcr.Session; | ||
|
||
import static org.mockito.Mockito.when; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
class RuntimeHelperTest { | ||
|
||
@Mock | ||
Session session; | ||
|
||
@Test | ||
void shouldBeReadonlyIfRootWritable() throws RepositoryException { | ||
when(session.hasPermission("/", Session.ACTION_SET_PROPERTY)).thenReturn(true); | ||
Assertions.assertTrue(RuntimeHelper.isAppsReadOnly(session)); | ||
} | ||
|
||
@Test | ||
void shouldNotBeReadonlyIfRootNotWritable() throws RepositoryException { | ||
when(session.hasPermission("/", Session.ACTION_SET_PROPERTY)).thenReturn(false); | ||
Assertions.assertFalse(RuntimeHelper.isAppsReadOnly(session)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters