  @Test
  public void testPartition() {

    byte[] foo = new byte[1];
    foo[0] = 1;

    foo[0] = 2;

    byte[] empty = new byte[0];
    GramKey a = new GramKey(new Gram("foo", 1, Gram.Type.HEAD), empty);
    GramKey b = new GramKey(new Gram("foo", 1, Gram.Type.HEAD), foo);
    byte[] bar = new byte[1];
    GramKey c = new GramKey(new Gram("foo", 2, Gram.Type.HEAD), bar);
    GramKey d = new GramKey(new Gram("foo", 1, Gram.Type.TAIL), empty);
    GramKey e = new GramKey(new Gram("foo", 2, Gram.Type.TAIL), foo);
    
    GramKeyPartitioner p = new GramKeyPartitioner();
    int numPartitions = 5;
    
    int ap = p.getPartition(a, null, numPartitions);
    int bp = p.getPartition(b, null, numPartitions);
    int cp = p.getPartition(c, null, numPartitions);
    int dp = p.getPartition(d, null, numPartitions);
    int ep = p.getPartition(e, null, numPartitions);
    
    Assert.assertEquals(ap, bp);
    Assert.assertEquals(ap, cp);
    Assert.assertEquals(dp, ep);
  }