/**
   * Assert that two variant contexts are actually equal
   *
   * @param actual
   * @param expected
   */
  public static void assertEquals(final VariantContext actual, final VariantContext expected) {
    Assert.assertNotNull(actual, "VariantContext expected not null");
    Assert.assertEquals(actual.getChr(), expected.getChr(), "chr");
    Assert.assertEquals(actual.getStart(), expected.getStart(), "start");
    Assert.assertEquals(actual.getEnd(), expected.getEnd(), "end");
    Assert.assertEquals(actual.getID(), expected.getID(), "id");
    Assert.assertEquals(
        actual.getAlleles(), expected.getAlleles(), "alleles for " + expected + " vs " + actual);

    assertAttributesEquals(actual.getAttributes(), expected.getAttributes());
    Assert.assertEquals(
        actual.filtersWereApplied(), expected.filtersWereApplied(), "filtersWereApplied");
    Assert.assertEquals(actual.isFiltered(), expected.isFiltered(), "isFiltered");
    VariantBaseTest.assertEqualsSet(actual.getFilters(), expected.getFilters(), "filters");
    VariantBaseTest.assertEqualsDoubleSmart(
        actual.getPhredScaledQual(), expected.getPhredScaledQual());

    Assert.assertEquals(actual.hasGenotypes(), expected.hasGenotypes(), "hasGenotypes");
    if (expected.hasGenotypes()) {
      VariantBaseTest.assertEqualsSet(
          actual.getSampleNames(), expected.getSampleNames(), "sample names set");
      Assert.assertEquals(
          actual.getSampleNamesOrderedByName(),
          expected.getSampleNamesOrderedByName(),
          "sample names");
      final Set<String> samples = expected.getSampleNames();
      for (final String sample : samples) {
        assertEquals(actual.getGenotype(sample), expected.getGenotype(sample));
      }
    }
  }
 private static void assertAttributeEquals(
     final String key, final Object actual, final Object expected) {
   if (expected instanceof Double) {
     // must be very tolerant because doubles are being rounded to 2 sig figs
     VariantBaseTest.assertEqualsDoubleSmart(actual, (Double) expected, 1e-2);
   } else Assert.assertEquals(actual, expected, "Attribute " + key);
 }