@@ -0,0 +1,1545 @@
+package edu.oregonstate.cope.eclipse.listeners;%0A%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport java.io.BufferedInputStream;%0Aimport java.io.ByteArrayInputStream;%0Aimport java.util.Arrays;%0Aimport java.util.Random;%0A%0Aimport org.apache.commons.codec.binary.Base64;%0Aimport org.apache.commons.codec.binary.Base64InputStream;%0Aimport org.eclipse.core.resources.IFile;%0Aimport org.eclipse.core.resources.IProject;%0Aimport org.eclipse.core.runtime.NullProgressMonitor;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport edu.oregonstate.cope.eclipse.FileUtil;%0A%0Apublic class ResourceListenerTest %7B%0A%09%0A%09private static final int FILE_SIZE_BYTES = 10000;%0A%09private IProject project;%0A%09private IFile file;%0A%09private byte%5B%5D randomBytes;%0A%0A%09@Before%0A%09public void before() throws Exception %7B%0A%09%09project = FileUtil.createProject(%22TestProject%22);%0A%09%09file = FileUtil.createFile(%22bla.jar%22, project);%0A%09%09randomBytes = new byte%5BFILE_SIZE_BYTES%5D;%0A%09%09new Random().nextBytes(randomBytes);%0A%09%09file.appendContents(new ByteArrayInputStream(randomBytes), true, false, new NullProgressMonitor());%0A%09%7D%0A%09%0A%09@After%0A%09public void after() throws Exception %7B%0A%09%09FileUtil.deleteProject(project);%0A%09%7D%0A%09%0A%09@Test%0A%09public void testReadBinaryFile() throws Exception %7B%0A%09%09ResourceListener listener = new ResourceListener();%0A%09%09String contents = listener.getFileContents(file);%0A%09%09%0A%09%09byte%5B%5D actualBytes = Base64.decodeBase64(contents.getBytes());%0A%09%09%0A%09%09System.out.println(randomBytes.length + %22 %22 + actualBytes.length);%0A%09%09%0A%09%09assertTrue(Arrays.equals(randomBytes, actualBytes));%0A%09%7D%0A%0A%7D%0A

Test for the binary file recording