@Test public void testGenerateLocator() throws OseeCoreException { // Test Protocol not found try { manager.generateResourceLocator("dummyProcotol", "", ""); Assert.fail("This line should not be executed"); } catch (OseeCoreException ex) { Assert.assertTrue(ex instanceof MalformedLocatorException); } IResourceLocator locator = manager.generateResourceLocator("protocol1", "ABCDE", "name1"); Assert.assertTrue(locator instanceof MockResourceLocator); MockResourceLocator mockLocator = (MockResourceLocator) locator; Assert.assertEquals("ABCDE", mockLocator.getSeed()); Assert.assertEquals("name1", mockLocator.getName()); Assert.assertNull(mockLocator.getRawPath()); }
@Test public void testEmptyProvider() { ResourceManager manager = new ResourceManager(); Assert.assertEquals(0, manager.getProtocols().size()); try { manager.getResourceLocator("protocol"); Assert.fail("This line should not be executed"); } catch (OseeCoreException ex) { Assert.assertTrue(ex instanceof OseeStateException); } try { manager.generateResourceLocator(null, null, null); } catch (OseeCoreException ex) { Assert.assertTrue(ex instanceof OseeStateException); } }