### Question:
HttpResumableSession extends HttpSessionAbstract { public boolean valid(final HttpResumableInfo resumableInfo) { return (resumableInfo.getChunkSize() > 0 && resumableInfo.getTotalSize() > 0 && resumableInfo.getChunkNumber() > 0 && !Strings.isNullOrEmpty(resumableInfo.getIdentifier()) && !Strings.isNullOrEmpty(resumableInfo.getFilename()) && !Strings.isNullOrEmpty(resumableInfo.getRelativePath()) && httpResumableInfo.isCompatible(resumableInfo)); } HttpResumableSession(final HttpResumableInfo resumableInfo,
                       final String rulename, final String comment,
                       final HttpAuthent authent); HttpResumableInfo getHttpResumableInfo(); boolean tryWrite(final HttpResumableInfo resumableInfo,
                          final InputStream stream); boolean valid(final HttpResumableInfo resumableInfo); boolean contains(final HttpResumableInfo resumableInfo); boolean checkIfUploadFinished(final String sha256); @Override String toString();  }### Answer:
@Test public void testValid() throws Exception { HttpResumableSession session = new HttpResumableSession(resumableInfo, "rule", "comment", authent); assertTrue(session.valid(resumableInfo)); resumableInfo.setChunkSize(0); assertFalse(session.valid(resumableInfo)); resumableInfo.setChunkSize(chunkSize); assertTrue(session.valid(resumableInfo)); resumableInfo.setTotalSize(0); assertFalse(session.valid(resumableInfo)); resumableInfo.setTotalSize(totalSize); assertTrue(session.valid(resumableInfo)); resumableInfo.setChunkNumber(0); assertFalse(session.valid(resumableInfo)); resumableInfo.setChunkNumber(chunkNumber); assertTrue(session.valid(resumableInfo)); resumableInfo.setIdentifier(null); assertFalse(session.valid(resumableInfo)); resumableInfo.setIdentifier(identifier); assertTrue(session.valid(resumableInfo)); resumableInfo.setFilename(null); assertFalse(session.valid(resumableInfo)); resumableInfo.setFilename(filename); assertTrue(session.valid(resumableInfo)); resumableInfo.setRelativePath(null); assertFalse(session.valid(resumableInfo)); resumableInfo.setRelativePath(relativePath); assertTrue(session.valid(resumableInfo)); resumableInfo.setIdentifier(null); assertFalse(session.valid(resumableInfo)); resumableInfo.setIdentifier(identifier); assertTrue(session.valid(resumableInfo)); HttpResumableInfo resumableInfo2 = new HttpResumableInfo(chunkNumber, chunkSize + 1, totalSize + 1, identifier, filename, relativePath); assertFalse(session.valid(resumableInfo2)); assertTrue(session.valid(resumableInfo)); }