ValidateInterpretation implements Callable<Integer> { static int matchByField(final String allele0, final String allele1) { checkNotNull(allele0); checkNotNull(allele1); List<String> allele0Parts = Splitter.on(":").splitToList(allele0); List<String> allele1Parts = Splitter.on(":").splitToList(allele1); int smallest = Math.min(allele0Parts.size(), allele1Parts.size()); for (int i = 0; i < smallest; i++) { if (!allele0Parts.get(i).equals(allele1Parts.get(i))) { return i; } } return smallest; } ValidateInterpretation(final File expectedFile,
                                  final File observedFile,
                                  final File outputFile,
                                  final int resolution,
                                  final List<String> loci,
                                  final boolean printSummary,
                                  final GlClient glclient); @Override Integer call(); static void main(final String[] args);  }
@Test(expected=NullPointerException.class) public void testMatchByFieldNullFirstAllele() { matchByField(null, "HLA-A*01:01:01:01"); }
@Test(expected=NullPointerException.class) public void testMatchByFieldNullSecondAllele() { matchByField("HLA-A*01:01:01:01", null); }
@Test public void testMatchByField() { assertEquals(1, matchByField("HLA-A*01", "HLA-A*01")); assertEquals(1, matchByField("HLA-A*01:01", "HLA-A*01")); assertEquals(1, matchByField("HLA-A*01:02:01", "HLA-A*01:01:01")); assertEquals(2, matchByField("HLA-DQB1*05:02:01", "HLA-DQB1*05:02:04")); assertEquals(3, matchByField("HLA-A*01:01:01", "HLA-A*01:01:01")); assertEquals(4, matchByField("HLA-A*01:01:01:01", "HLA-A*01:01:01:01")); assertEquals(0, matchByField("HLA-DRB1*13:01:01", "HLA-DRB3*01:01:02:01")); assertEquals(0, matchByField("HLA-DRB1*13:01:01", "HLA-DRB3*01:01:02:02")); }