diff --git a/README.md b/README.md index c203211..ff0716b 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,10 @@ These are the current checks/tricks we are using to give an indication of root. **Java checks** -* CheckRootManagementApps -* CheckPotentiallyDangerousApps -* CheckRootCloakingApps -* CheckTestKeys +* checkRootManagementApps +* checkPotentiallyDangerousApps +* checkRootCloakingApps +* checkTestKeys * checkForDangerousProps * checkForBusyBoxBinary * checkForSuBinary diff --git a/rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java b/rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java index 3ba0305..44eebc1 100644 --- a/rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java +++ b/rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java @@ -172,7 +172,7 @@ public boolean checkForSuBinary(){ * @return true if found */ public boolean checkForBusyBoxBinary(){ - return checkForBinary("busybox"); + return checkForBinary(BINARY_BUSYBOX); } /** diff --git a/rootbeerlib/src/test/java/com/scottyab/rootbeer/RootBeerTest.java b/rootbeerlib/src/test/java/com/scottyab/rootbeer/RootBeerTest.java index 64c1b2d..ab6efc4 100644 --- a/rootbeerlib/src/test/java/com/scottyab/rootbeer/RootBeerTest.java +++ b/rootbeerlib/src/test/java/com/scottyab/rootbeer/RootBeerTest.java @@ -31,7 +31,6 @@ public void testIsRooted() { when(rootBeer.detectRootManagementApps()).thenReturn(false); when(rootBeer.detectPotentiallyDangerousApps()).thenReturn(false); - when(rootBeer.checkForBinary(Const.BINARY_BUSYBOX)).thenReturn(false); when(rootBeer.checkForBinary(Const.BINARY_SU)).thenReturn(false); when(rootBeer.checkForDangerousProps()).thenReturn(false); when(rootBeer.checkForRWPaths()).thenReturn(false); @@ -40,7 +39,7 @@ public void testIsRooted() { when(rootBeer.checkForRootNative()).thenReturn(false); // Test we return false when all methods return false - assertTrue(!rootBeer.isRooted()); + assertFalse(rootBeer.isRooted()); when(rootBeer.checkForRootNative()).thenReturn(true); @@ -49,13 +48,11 @@ public void testIsRooted() { } @Test - public void testIsRootedWithoutBusyBoxCheck() { + public void testIsRootedWithBusyBoxCheck() { RootBeer rootBeer = Mockito.mock(RootBeer.class); when(rootBeer.isRooted()).thenCallRealMethod(); - when(rootBeer.isRootedWithoutBusyBoxCheck()).thenCallRealMethod(); - when(rootBeer.detectRootManagementApps()).thenReturn(false); when(rootBeer.detectPotentiallyDangerousApps()).thenReturn(false); when(rootBeer.checkForBinary(Const.BINARY_BUSYBOX)).thenReturn(true); @@ -66,12 +63,11 @@ public void testIsRootedWithoutBusyBoxCheck() { when(rootBeer.checkSuExists()).thenReturn(false); when(rootBeer.checkForRootNative()).thenReturn(false); - // Test we return false when all methods return false - assertTrue(rootBeer.isRooted()); - - // Test it doesn't matter what checkForBinary("busybox") returns - assertTrue(!rootBeer.isRootedWithoutBusyBoxCheck()); + // Test we return false as busybox binary presence is ignored + assertFalse(rootBeer.isRooted()); + // Check busybox present is detected + assertTrue(rootBeer.checkForBinary(Const.BINARY_BUSYBOX)); } @Test