@Before public void setUp() throws Exception { String nexusUrl = Settings.getString(Settings.KEYS.ANALYZER_NEXUS_URL); LOGGER.fine(nexusUrl); searcher = new NexusSearch(new URL(nexusUrl)); Assume.assumeTrue(searcher.preflightRequest()); }
// This test does generate network traffic and communicates with a host // you may not be able to reach. Remove the @Ignore annotation if you want to // test it anyway @Test public void testValidSha1() throws Exception { MavenArtifact ma = searcher.searchSha1("9977a8d04e75609cf01badc4eb6a9c7198c4c5ea"); assertEquals("Incorrect group", "org.apache.maven.plugins", ma.getGroupId()); assertEquals("Incorrect artifact", "maven-compiler-plugin", ma.getArtifactId()); assertEquals("Incorrect version", "3.1", ma.getVersion()); assertNotNull("URL Should not be null", ma.getArtifactUrl()); }
// This test does generate network traffic and communicates with a host // you may not be able to reach. Remove the @Ignore annotation if you want to // test it anyway @Test(expected = FileNotFoundException.class) public void testMissingSha1() throws Exception { searcher.searchSha1("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); }
@Test(expected = IllegalArgumentException.class) public void testMalformedSha1() throws Exception { searcher.searchSha1("invalid"); }
@Test(expected = IllegalArgumentException.class) public void testNullSha1() throws Exception { searcher.searchSha1(null); }