You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2014/05/09 16:55:11 UTC

svn commit: r1593555 - /directory/mavibot/branches/with-txns/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java

Author: elecharny
Date: Fri May  9 14:55:11 2014
New Revision: 1593555

URL: http://svn.apache.org/r1593555
Log:
Added a test

Modified:
    directory/mavibot/branches/with-txns/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java

Modified: directory/mavibot/branches/with-txns/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/branches/with-txns/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java?rev=1593555&r1=1593554&r2=1593555&view=diff
==============================================================================
--- directory/mavibot/branches/with-txns/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java (original)
+++ directory/mavibot/branches/with-txns/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java Fri May  9 14:55:11 2014
@@ -892,6 +892,27 @@ public class PersistedBTreeBrowseTest
 
 
     /**
+     * Test the browseFrom method on a btree with a non existing key
+     */
+    @Test
+    public void testBrowseFromBTreeNodesNotExistingKey() throws IOException, BTreeAlreadyManagedException
+    {
+        // Inject some data
+        for ( long i = 0; i <= 1000L; i += 2 )
+        {
+            btree.insert( i, Long.toString( i ) );
+        }
+
+        // Create the cursor
+        TupleCursor<Long, String> cursor = btree.browseFrom( 1500L );
+        
+        assertFalse( cursor.hasNext() );
+        assertTrue( cursor.hasPrev() );
+        assertEquals( 1000L, cursor.prev().getKey().longValue() );
+    }
+
+
+    /**
      * Test the browseFrom method on a btree containing nodes with duplicate values
      */
     @Test