RemoteFile extends File { @Override public long length() { return length; } private  RemoteFile(String filepath); @Override long length(); @Override boolean setLastModified(long time); @Override long lastModified(); @Override boolean isFile(); @Override boolean isDirectory();  }
@Test public void testLength() { RemoteFile f = new RemoteFile.Builder().setPath("hello").build(); assertEquals(-1, f.length()); long size = 10L; assertEquals(size, new RemoteFile.Builder().setPath("hello").setLength(size).build().length()); }