	@Test
	public void testEOFBlocks() throws Exception
	{

		AbstractMemory memory = new MockMemory(ByteOrder.BIG_ENDIAN);

		memory.addMemorySource(new MockMemorySource(new byte[] { (byte)0xDE, (byte)0xAD, (byte)0xBE, (byte)0xEF}, 0, 0x10000,
				0x10000));
		
		memory.addMemorySource(new UnbackedMemorySource(0x20000, 0x10000, "Deliberately not backed"));
		
		IMemoryImageInputStream sut = new IMemoryImageInputStream(memory, 0x1FFFC);
		
		byte[] buffer = new byte[10];
		
		assertEquals(4,sut.read(buffer));
		
		assertEquals((byte)0xDE,buffer[0]);
		assertEquals((byte)0xAD,buffer[1]);
		assertEquals((byte)0xBE,buffer[2]);
		assertEquals((byte)0xEF,buffer[3]);
		
		assertEquals(-1,sut.read(buffer));
	}