ModShardLocator extends AbstractCommonShardLocator<CTX> { @Override public Set<String> locateForEqual(ConditionContext ctx) { return locateByValue(ctx.getValue()); } ModShardLocator(Integer mod);  ModShardLocator(Integer mod, String zeroPaddingFormat); Set<String> locateByValue(Object value); @Override Set<String> locateForEqual(ConditionContext ctx); @Override Set<String> locateForGreaterThan(CTX ctx); @Override Set<String> locateForLessThan(CTX ctx); @Override Set<String> locateForBetween(ConditionContext ctx);  }
@Test public void testValueType() { try { test.locateForEqual(exp(M, null)); fail(); }catch (Exception e) { assertEquals(IllegalArgumentException.class, e.getClass()); } assertEquals(set(0), test.locateForEqual(exp(M, 0L))); assertEquals(set(0), test.locateForEqual(exp(M, new Long(0)))); assertEquals(set(0), test.locateForEqual(exp(M, "0"))); try { test.locateForEqual(exp(M, new Object())); fail(); }catch (Exception e) { assertEquals(IllegalArgumentException.class, e.getClass()); } }
@Test public void testLocateForEqual() { assertEquals(set(0), test.locateForEqual(exp(M, 0))); assertEquals(set(1), test.locateForEqual(exp(M, 1))); assertEquals(set(2), test.locateForEqual(exp(M, 2))); assertEquals(set(0), test.locateForEqual(exp(M, 3))); assertEquals(set(1), test.locateForEqual(exp(M, 4))); }