### Question:
TPMBaselineGenerator { public final String generateNameForKernelUpdateBaseline(final IntegrityReport report) throws NullPointerException, TPMBaselineGeneratorException { LOGGER.debug("retrieving Device Info data to create kernel update baseline name"); if (report == null) { LOGGER.error("null argument: report"); throw new NullPointerException("report"); } if (report.contains(DeviceInfoReport.class)) { final DeviceInfoReport diReport = report.extractReport(DeviceInfoReport.class); final OSInfo osInfo = diReport.getOSInfo(); return String.format(KERNEL_UPDATE_BASELINE_NAME, osInfo.getOSName(), osInfo.getOSVersion()); } final String msg = "The integrity report did not contain a device info report." + " Investigate how the appraiser got this far."; throw new TPMBaselineGeneratorException(msg); }  final TpmWhiteListBaseline generateWhiteListBaselineFromCSVFile(
            final String baselineName, final InputStream in); TpmBlackListBaseline generateBlackListBaselineFromCSVFile(final String baselineName,
         final InputStream in); final TpmWhiteListBaseline generateBaselineFromIntegrityReport(
            final String baselineName, final IntegrityReport report); final TpmWhiteListBaseline generateWhiteListBaselineOnKernelUpdate(
            final String baselineName, final IntegrityReport report, final int kernelPcrMask); final String generateNameForKernelUpdateBaseline(final IntegrityReport report);  }### Answer:
@Test public final void generateNameForKernelUpdateBaseline() throws Exception { final IntegrityReport report = getIntegrityReport(DEFAULT_INTEGRITY_REPORT); final TPMBaselineGenerator generator = new TPMBaselineGenerator(); final String expected = "Kernel Update Linux 3.10.0-693.11.1.el7.x86_64"; Assert.assertEquals(generator.generateNameForKernelUpdateBaseline(report), expected); }
@Test public final void generateNameForKernelUpdateBaselineNoDeviceInfoReport() throws Exception { final IntegrityReport report = getIntegrityReport(DEFAULT_INTEGRITY_REPORT); report.removeReport(report.extractReport(DeviceInfoReport.class)); final TPMBaselineGenerator generator = new TPMBaselineGenerator(); final String expected = "not contain a device info report"; try { generator.generateNameForKernelUpdateBaseline(report); } catch (TPMBaselineGeneratorException e) { Assert.assertTrue(e.getMessage().contains(expected)); } }
@Test public final void generateNameForKernelUpdateBaselineNoRelevantDeviceInfo() throws Exception { final IntegrityReport report = getIntegrityReport(DEFAULT_INTEGRITY_REPORT); DeviceInfoReport diReport = report.extractReport(DeviceInfoReport.class); report.removeReport(diReport); diReport = new DeviceInfoReport(diReport.getNetworkInfo(), new OSInfo(), diReport.getFirmwareInfo(), diReport.getHardwareInfo(), diReport.getTPMInfo()); report.addReport(diReport); final TPMBaselineGenerator generator = new TPMBaselineGenerator(); final String expected = "Kernel Update " + DeviceInfoReport.NOT_SPECIFIED + " " + DeviceInfoReport.NOT_SPECIFIED; Assert.assertEquals(generator.generateNameForKernelUpdateBaseline(report), expected); }