public static NamenodeRole convert(NamenodeRoleProto role) {
    switch (role) {
    case NAMENODE:
      return NamenodeRole.NAMENODE;
    case BACKUP:
      return NamenodeRole.BACKUP;
    case CHECKPOINT:
      return NamenodeRole.CHECKPOINT;
    }
    return null;
  }
@Test
  public void testConvertBlockWithLocations() {
    boolean[] testSuite = new boolean[]{false, true};
    for (int i = 0; i < testSuite.length; i++) {
      BlockWithLocations locs = getBlockWithLocations(1, testSuite[i]);
      BlockWithLocationsProto locsProto = PBHelper.convert(locs);
      BlockWithLocations locs2 = PBHelper.convert(locsProto);
      compare(locs, locs2);
    }
  }