### Question:
DeploymentPackageValidator { public int validateResourceCount(@Header(value="CamelFileAbsolutePath") String manifestPath, @Header(value="ResourceFileType") String resourceFileType, @Header(value="ResourceCount") Integer manifestResourceCount) throws IOException { log.debug("CamelFileAbsolutePath for the currently deployment package is: " +manifestPath); log.debug("The manifest resource count value is: " + manifestResourceCount); log.debug("The resource file type value is: " + resourceFileType); int returnCode; if (manifestResourceCount == null){ throw new IllegalArgumentException("The manifest resource count not found"); } if (manifestPath == null || manifestPath.length()==0){ throw new IllegalArgumentException("The camel absolute path for manifest file argument error"); } if (resourceFileType == null || resourceFileType.length()==0){ throw new IllegalArgumentException("The resource file type not found"); } int fsResourceCount = fsResourceCount(manifestPath, resourceFileType); Path deploymentPkgDir = Paths.get(manifestPath).getParent(); String deploymentPkg = deploymentPkgDir.getFileName().toString(); if (fsResourceCount == manifestResourceCount){ log.info("The resource counts match in deployment: " + deploymentPkg + " the count is: " + fsResourceCount); returnCode = 1; } else if (fsResourceCount > manifestResourceCount) { log.error("Extra resource(s) found in deployment: " + deploymentPkg + " the manifest count - " + manifestResourceCount + " and the fs count - " + fsResourceCount); returnCode = 0; } else { log.error("Less resource(s) found in deployment: " + deploymentPkg + " the manifest count - " + manifestResourceCount + " and the fs count - " + fsResourceCount); returnCode = -1; } return returnCode; }  int validateResourceCount(@Header(value="CamelFileAbsolutePath") String manifestPath, @Header(value="ResourceFileType") String resourceFileType,
                                        @Header(value="ResourceCount") Integer manifestResourceCount); String createChecksum(Exchange exchange); boolean validateChecksum(Exchange exchange);  }### Answer:
@Test public void testValidatResourceCountIllegalArgument() throws IOException { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("count not found"); validator.validateResourceCount("/opt/sidora/smx/CameraTrapData/path...","jpg,jpeg",null); }
@Test public void testValidateAbsolutePathIllegalArgument() throws IOException { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("absolute path"); validator.validateResourceCount("","jpg,jpeg",23); }
@Test public void testValidateAbsolutePathNotFound() throws IOException { thrown.expect(FileNotFoundException.class); thrown.expectMessage("path not found"); validator.validateResourceCount("/opt/sidora/smx/CameraTrapData/00000000/manifest.xml","jpg,jpeg",2); }
@Test public void testValidateExtraResourceFilesFound() throws IOException { int result = validator.validateResourceCount("src/test/resources/extraImagesDeploymentPkg/deployment_manifest.xml","jpg,jpeg",2); assertEquals(result, 0); }
@Test public void testValidateResourceFilesMissing() throws IOException { int result = validator.validateResourceCount("src/test/resources/missingImagesDeploymentPkg/deployment_manifest.xml","jpg,jpeg",2); assertEquals(result, -1); }
@Test public void testValidDeploymentPackage() throws IOException { int result = validator.validateResourceCount("src/test/resources/validDeploymentPkg/deployment_manifest.xml","jpg,jpeg",2); assertEquals(result, 1); }