### Question:
RepoPackage { public final void setAllMeasurements(final Set<IMABaselineRecord> packageRecords, final Digest packageMeasurement) { if (packageRecords == null) { throw new IllegalArgumentException("Measurements cannot be null."); } if (packageMeasurement == null) { throw new IllegalArgumentException("Package measurement cannot be null."); } if (!measured) { this.packageRecords = new HashSet<>(packageRecords); this.packageMeasurement = packageMeasurement; measured = true; measurementDate = new Date(); } else { throw new IllegalStateException("RepoPackage measurements already set."); } } RepoPackage(final String name, final String version, final String release,
                       final String architecture, final Repository sourceRepository); protected  RepoPackage(); final String getName(); final String getVersion(); final String getRelease(); final String getArchitecture(); final Repository<?> getSourceRepository(); final void setAllMeasurements(final Set<IMABaselineRecord> packageRecords,
                                         final Digest packageMeasurement); final Set<IMABaselineRecord> getPackageRecords(); final Digest getPackageMeasurement(); final boolean isMeasured(); final Date getMeasurementDate(); final UUID getId(); @Override final boolean equals(final Object o); @Override final int hashCode(); @Override final String toString(); static final String PACKAGE_RECORDS_FIELD; }### Answer:
@Test public final void testSetMeasurements() throws UnsupportedEncodingException { repoPackage.setAllMeasurements(new HashSet<IMABaselineRecord>(), getTestDigest()); }
@Test(expectedExceptions = RuntimeException.class) public final void testSetMeasurementsTwice() throws UnsupportedEncodingException { repoPackage.setAllMeasurements(new HashSet<IMABaselineRecord>(), getTestDigest()); repoPackage.setAllMeasurements(new HashSet<IMABaselineRecord>(), getTestDigest()); }