@Test(expected = IllegalArgumentException.class) public void nameViaPathNull() throws IOException { try (final MemoryNamedAsset asset = new MemoryNamedAsset((Path) null)) { } catch (final IOException e) { throw e; } }
@Test(expected = IllegalArgumentException.class) public void nameViaArchivePathNull() throws IOException { try (final MemoryNamedAsset asset = new MemoryNamedAsset((ArchivePath) null)) { } catch (final IOException e) { throw e; } }
@Test(expected = IllegalArgumentException.class) public void nameViaStringNull() throws IOException { try (final MemoryNamedAsset asset = new MemoryNamedAsset((String) null)) { } catch (final IOException e) { throw e; } }
@Test public void nameViaString() { final String name = "ALR"; final MemoryNamedAsset asset = new MemoryNamedAsset(name); final String roundtrip = asset.getName(); Assert.assertEquals(name, roundtrip); try { asset.close(); } catch (final IOException ioe) { throw new RuntimeException(ioe); } }
@Test public void nameViaArchivePath() { final String name = "ALR"; final ArchivePath path = new ArchivePath() { @Override public int compareTo(ArchivePath o) { return 0; } @Override public ArchivePath getParent() { return null; } @Override public String get() { return name; } }; final MemoryNamedAsset asset = new MemoryNamedAsset(path); final String roundtrip = asset.getName(); Assert.assertEquals(name, roundtrip); try { asset.close(); } catch (final IOException ioe) { throw new RuntimeException(ioe); } }
final MemoryNamedAsset channel = new MemoryNamedAsset(archivePath);
final MemoryNamedAsset asset = new MemoryNamedAsset(path); final String roundtrip = asset.getName(); Assert.assertEquals(name, roundtrip);