### Question:
HiveChord extends ChordBase implements IWeightable, IInfluenceable, Serializable { public String extractRoot(String chordName){ for(String type:chordTypes){ if(chordName.contains(type)){ String[] split = chordName.split(type); return split[0] .replace("3", "") .replace("4", "") .replace("5", ""); } } throw new RuntimeException("Could not extract chord root!!"); } HiveChord();  HiveChord(String chordName); boolean isEqual(HiveChord chord); boolean isEqual(String chordName); Integer getId(); void setId(Integer id); @Override void setFileName(String fileName); @Override String getFileName(); String getChordName(); String getRawChordName(); void setChordName(String chordName); String extractRoot(String chordName); boolean isEqualOrTriadMatch(HiveChord harmonicLoopChord); boolean hasMatchingRoot(HiveChord chord); boolean hasMatchingRoot(HarmonicLoop harmonicLoop); @Override WeightClass getVerticalWeight(); @Override void setVerticalWeight( WeightClass weight); @Override WeightClass getTimeseriesWeight(); @Override void setTimeseriesWeight(WeightClass weight); @Override WeightClass getThemeWeight(); @Override void setThemeWeight(WeightClass weight); @Override void setRhythmicWeight( WeightClass weight); @Override WeightClass getRhythmicWeight(); @Override WeightClass getEqWeight(); @Override void setEqWeight(WeightClass weight); @Override Integer getTotalWeight(); ChordCategory getChordCatagory(); void setChordCatagory(ChordCategory chordCatagory); WeightClass getHarmonicWeight(); void setHarmonicWeight(WeightClass harmonicWeight); List<String> getChordTypes(); void setChordTypes(List<String> chordTypes);  }### Answer:
@Test public void shouldNotExtractSameRoot(){ HiveChord hiveChord = new HiveChord(); String chordCRoot = hiveChord.extractRoot("cmaj7"); String chordCSharpRoot = hiveChord.extractRoot("c#maj7"); assertNotEquals(chordCRoot, chordCSharpRoot); }
@Test public void shouldExtractSameRoot(){ HiveChord hiveChord = new HiveChord(); String chordCRoot = hiveChord.extractRoot("cmaj7"); String chordCSharpRoot = hiveChord.extractRoot("c4maj7"); assertEquals(chordCRoot, chordCSharpRoot); }
@Test public void shouldExtractCorrectRoot(){ HiveChord hiveChord = new HiveChord(); String chordCRoot = hiveChord.extractRoot("cmaj7"); String chordCSharpRoot = hiveChord.extractRoot("c#maj7"); String chordCRoot4 = hiveChord.extractRoot("c4maj7"); String chordCSharpRoot4 = hiveChord.extractRoot("c#4maj7"); assertEquals(chordCRoot, "c"); assertEquals(chordCSharpRoot, "c#"); assertEquals(chordCRoot4, "c"); assertEquals(chordCSharpRoot4, "c#"); }