Code example for JarEntry

Methods: getSize

0
	/** 
	 * Given a {@link JarFileUrlConnection} when getContentLength is called then the implementation will delegate. 
	 * @throws Exception 
	 */ 
	public void testGetContentLength() throws Exception { 
		when(jarEntry.getSize()).thenReturn(123L);
		assertEquals(123, connection.getContentLength());
	} 
 
	/** 
	 * Given a {@link JarFileUrlConnection} backed by a file larger than the maximum int size when getContentLength is 
	 * called then -1 is returned. 
	 * @throws Exception 
	 */ 
	public void testGetContentLengtWhenTooBig() throws Exception { 
		when(jarEntry.getSize()).thenReturn(Integer.MAX_VALUE + 1L);
		assertEquals(-1, connection.getContentLength());
	} 
 
	/** 
	 * Given a {@link JarFileUrlConnection} when getInputStream is called then the implementation will delegate.