FossologyUploader { protected FossologyStatus parseResultStatus(String output) { final Pattern pattern = Pattern.compile("status=(\\w*)"); final Matcher matcher = pattern.matcher(output); if (matcher.find()) { try { return FossologyStatus.valueOf(matcher.group(1)); } catch (Exception e) { log.error("fossology output parser caught exception: " + e.getMessage(), e); } } log.error("cannot parse output from fossology check status: '" + output + "'"); return FossologyStatus.CONNECTION_FAILED; } @Autowired  FossologyUploader(FossologySshConnector fossologySshConnector); int uploadToFossology(InputStream inputStream, AttachmentContent attachment, String clearingTeam); boolean duplicateInFossology(int uploadId, String clearingTeam); FossologyStatus getStatusInFossology(int uploadId, String clearingTeam); boolean copyToFossology(String filename, InputStream content, boolean execBit);  }
@Test public void testParseResult() { final FossologyStatus fossologyStatus = FossologyStatus.CLOSED; assertThat( fossologyUploader.parseResultStatus("status=" + fossologyStatus), is(fossologyStatus)); }
@Test public void testParseResultWithBadStatus() { assertThat( fossologyUploader.parseResultStatus("status=CLOPED"), is(FossologyStatus.CONNECTION_FAILED)); }