### Question:
RandomPartitionerTokenRing implements TokenRing { @Override public BigInteger getTokenCountInRange(String startToken, String endToken) { BigInteger start = new BigInteger(startToken); checkTokenBounds(start); BigInteger end = new BigInteger(endToken); checkTokenBounds(end); if (start.equals(end)) { if (start.equals(MIN_TOKEN)) { return TOTAL_TOKEN_COUNT; } else { return ZERO; } } BigInteger result = end.subtract(start); if (end.compareTo(start) <= 0) { result = result.add(TOTAL_TOKEN_COUNT); } return result; } private  RandomPartitionerTokenRing(); @Override double getRingFraction(String start, String end); @Override BigInteger getTokenCountInRange(String startToken, String endToken); static final RandomPartitionerTokenRing INSTANCE; }### Answer:
@Test public void testGetTokenCountInRange() { assertEquals(tokenRing.getRingFraction("0", "0"), 0.0, 0.001); assertEquals(tokenRing.getRingFraction("1", "0"), 1.0, 0.001); assertEquals(tokenRing.getRingFraction("-1", "-1"), 1.0, 0.001); assertEquals(tokenRing.getRingFraction("0", BigInteger.valueOf(2).pow(126).toString()), 0.5, 0.001); assertEquals(tokenRing.getRingFraction(BigInteger.valueOf(2).pow(126).toString(), BigInteger.valueOf(2).pow(127).toString()), 0.5, 0.001); assertEquals(tokenRing.getRingFraction("0", BigInteger.valueOf(2).pow(126).toString()), 0.5, 0.001); assertEquals(tokenRing.getRingFraction("0", BigInteger.valueOf(2).pow(127).toString()), 1.0, 0.001); }