The petitioner and the contestant may appear and produce evidence at the hearing, and no person other than the petitioner or a contestant shall be made a party to the proceedings on such petition, or be heard thereon. If more than one petition is pending, or the election of more than one person is contested, the court may order the cases to be heard together and shall apportion the costs between them, and shall finally determine all questions of law and fact. No person shall be excused from testifying or producing papers or documents therein on the ground that his testimony or the production of the papers or documents will tend to criminate him; but no person so testifying shall be liable to any suit or prosecution, civil or criminal, for any matter or cause in respect to which he shall be so examined or to which his testimony shall relate, except to a prosecution for perjury committed in such testimony. The court shall forthwith certify its decision to the governor, who shall thereupon issue certificates of election in accordance therewith. If the petitioner does not prosecute his petition it shall be dismissed and notice thereof given to the governor, who shall issue certificates of election to the persons entitled thereto.
Mass. Gen. Laws ch. 54, § 120