DXFile extends DXDataObject { public static DXFile getInstance(String fileId) { return new DXFile(fileId, null); } private  DXFile(String fileId, DXContainer project, DXEnvironment env, JsonNode describe); private  DXFile(String fileId, DXEnvironment env); static DXFile getInstance(String fileId); static DXFile getInstance(String fileId, DXContainer project); static DXFile getInstanceWithEnvironment(String fileId, DXContainer project, DXEnvironment env); static DXFile getInstanceWithEnvironment(String fileId, DXEnvironment env); static Builder newFile(); static Builder newFileWithEnvironment(DXEnvironment env); @Override DXFile close(); @Override DXFile closeAndWait(); @Override Describe describe(); @Override Describe describe(DXDataObject.DescribeOptions options); byte[] downloadBytes(); byte[] downloadBytes(long start, long end); void downloadToOutputStream(OutputStream os); void downloadToOutputStream(OutputStream os, long start, long end); @Override Describe getCachedDescribe(); InputStream getDownloadStream(); InputStream getDownloadStream(long start, long end); OutputStream getUploadStream(); void upload(byte[] data); void upload(InputStream data);  }
@Test public void testGetInstance() { DXFile file = DXFile.getInstance("file-000000000000000000000000"); Assert.assertEquals("file-000000000000000000000000", file.getId()); Assert.assertEquals(null, file.getProject()); DXFile file2 = DXFile.getInstance("file-000000000000000000000001", DXProject.getInstance("project-123412341234123412341234")); Assert.assertEquals("file-000000000000000000000001", file2.getId()); Assert.assertEquals("project-123412341234123412341234", file2.getProject().getId()); try { DXFile.getInstance(null); Assert.fail("Expected creation without setting ID to fail"); } catch (NullPointerException e) { } try { DXFile.getInstance("file-123412341234123412341234", (DXContainer) null); Assert.fail("Expected creation without setting project to fail"); } catch (NullPointerException e) { } try { DXFile.getInstance(null, DXProject.getInstance("project-123412341234123412341234")); Assert.fail("Expected creation without setting ID to fail"); } catch (NullPointerException e) { } }