### Question:
PrimaryTerm { public PrimaryTerm(long term, GroupMember primary, List<GroupMember> candidates) { this.term = term; this.primary = primary; this.candidates = candidates; } PrimaryTerm(long term, GroupMember primary, List<GroupMember> candidates); long term(); GroupMember primary(); List<GroupMember> candidates(); List<GroupMember> backups(int numBackups); @Override int hashCode(); @Override boolean equals(Object object); @Override String toString();  }### Answer:
@Test public void testPrimaryTerm() throws Exception { GroupMember primary = new GroupMember(MemberId.from("1"), MemberGroupId.from("1")); List<GroupMember> candidates = Arrays.asList( new GroupMember(MemberId.from("1"), MemberGroupId.from("1")), new GroupMember(MemberId.from("2"), MemberGroupId.from("2")), new GroupMember(MemberId.from("3"), MemberGroupId.from("2")), new GroupMember(MemberId.from("4"), MemberGroupId.from("3")), new GroupMember(MemberId.from("5"), MemberGroupId.from("3"))); PrimaryTerm term = new PrimaryTerm(1, primary, candidates); assertEquals(primary, term.primary()); assertEquals(candidates, term.candidates()); assertEquals(Arrays.asList(), term.backups(0)); assertEquals(Arrays.asList(candidates.get(1)), term.backups(1)); assertEquals(Arrays.asList(candidates.get(1), candidates.get(2)), term.backups(2)); assertEquals(Arrays.asList(candidates.get(1), candidates.get(2), candidates.get(3)), term.backups(3)); assertEquals(Arrays.asList(candidates.get(1), candidates.get(2), candidates.get(3), candidates.get(4)), term.backups(4)); assertEquals(Arrays.asList(candidates.get(1), candidates.get(2), candidates.get(3), candidates.get(4)), term.backups(5)); }