### Question:
SingleAlleleProteinVariant extends ProteinVariant { @Override public String toHGVSString(AminoAcidCode code) { if (hasOnlyOneChange()) return Joiner.on("").join(getSequenceNamePrefix(), ":p.", getChange().toHGVSString(code)); final String sep = allele.getVarConfig().toHGVSSeparator(); ArrayList<String> parts = new ArrayList<>(); parts.add(getSequenceNamePrefix()); parts.add(":p."); if (hasOnlyOneChange()) { parts.add(getChange().toHGVSString(code)); } else { parts.add("["); boolean first = true; for (ProteinChange change : allele) { if (first) first = false; else parts.add(sep); parts.add(change.toHGVSString(code)); } parts.add("]"); } return Joiner.on("").join(parts); } SingleAlleleProteinVariant(String proteinID, VariantConfiguration varConfig,
									  Collection<? extends ProteinChange> changes); static SingleAlleleProteinVariant makeSingleChangeVariant(String proteinID, ProteinChange change); static SingleAlleleProteinVariant build(String proteinID, VariantConfiguration varConfig,
												   ProteinChange... changes); boolean hasOnlyOneChange(); ProteinChange getChange(); ProteinChangeAllele getAllele(); @Override String toHGVSString(AminoAcidCode code); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }### Answer:
@Test public void testToHGVSStringSingleChange() { Assert.assertEquals("PROTEIN:p.A100G", singleChangeVariant.toHGVSString(AminoAcidCode.ONE_LETTER)); Assert.assertEquals("PROTEIN:p.Ala100Gly", singleChangeVariant.toHGVSString(AminoAcidCode.THREE_LETTER)); Assert.assertEquals("PROTEIN:p.Ala100Gly", singleChangeVariant.toHGVSString()); }
@Test public void testToHGVSStringMultiChange() { Assert.assertEquals("PROTEIN:p.[C100T;A301G]", multiChangeVariant.toHGVSString(AminoAcidCode.ONE_LETTER)); Assert.assertEquals("PROTEIN:p.[Cys100Thr;Ala301Gly]", multiChangeVariant.toHGVSString(AminoAcidCode.THREE_LETTER)); Assert.assertEquals("PROTEIN:p.[Cys100Thr;Ala301Gly]", multiChangeVariant.toHGVSString()); }