test_class.declarator: comparator = new PolicyComparator()
test_class.modifier: private final
test_class.original_string: private final PolicyComparator comparator = new PolicyComparator();
test_class.type: PolicyComparator
test_class.var_name: comparator
test_class.file: oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/PolicyComparatorTest.java
test_class.identifier: PolicyComparatorTest
test_case.body: @Test
      public void testPath2Deeper() {
          JackrabbitAccessControlPolicy policy1 = when(mock(JackrabbitAccessControlPolicy.class).getPath()).thenReturn("/path").getMock();
          JackrabbitAccessControlPolicy policy2 = when(mock(JackrabbitAccessControlPolicy.class).getPath()).thenReturn("/a/deeper/path").getMock();
          int expected = Ints.compare(PathUtils.getDepth("/path"), PathUtils.getDepth("/a/deeper/path"));
          assertEquals(expected, comparator.compare(policy1, policy2));
      }
test_case.class_method_signature: PolicyComparatorTest.testPath2Deeper()
test_case.full_signature: @Test public void testPath2Deeper()
test_case.identifier: testPath2Deeper
test_case.invocations: getMock thenReturn when getPath mock getMock thenReturn when getPath mock compare getDepth getDepth assertEquals compare
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPath2Deeper()
focal_class.file: oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/PolicyComparator.java
focal_class.identifier: PolicyComparator
focal_class.interfaces: implements Comparator<JackrabbitAccessControlPolicy>
focal_class.class_method_signature: PolicyComparator.compare(JackrabbitAccessControlPolicy policy1, JackrabbitAccessControlPolicy policy2)
focal_class.full_signature: @Override public int compare(JackrabbitAccessControlPolicy policy1, JackrabbitAccessControlPolicy policy2)
focal_class.identifier: compare
focal_class.modifiers: @Override public
focal_class.parameters: (JackrabbitAccessControlPolicy policy1, JackrabbitAccessControlPolicy policy2)
focal_class.return: int
focal_class.signature: int compare(JackrabbitAccessControlPolicy policy1, JackrabbitAccessControlPolicy policy2)
focal_method.body: @Override
      public int compare(JackrabbitAccessControlPolicy policy1, JackrabbitAccessControlPolicy policy2) {
          if (policy1.equals(policy2)) {
              return 0;
          } else {
              String p1 = policy1.getPath();
              String p2 = policy2.getPath();
  
              if (p1 == null) {
                  return -1;
              } else if (p2 == null) {
                  return 1;
              } else {
                  int depth1 = PathUtils.getDepth(p1);
                  int depth2 = PathUtils.getDepth(p2);
                  return (depth1 == depth2) ? p1.compareTo(p2) : Ints.compare(depth1, depth2);
              }
          }
      }
focal_method.class_method_signature: PolicyComparator.compare(JackrabbitAccessControlPolicy policy1, JackrabbitAccessControlPolicy policy2)
focal_method.full_signature: @Override public int compare(JackrabbitAccessControlPolicy policy1, JackrabbitAccessControlPolicy policy2)
focal_method.identifier: compare
focal_method.invocations: equals getPath getPath getDepth getDepth compareTo compare
focal_method.modifiers: @Override public
focal_method.parameters: (JackrabbitAccessControlPolicy policy1, JackrabbitAccessControlPolicy policy2)
focal_method.return: int
focal_method.signature: int compare(JackrabbitAccessControlPolicy policy1, JackrabbitAccessControlPolicy policy2)