@@ -0,0 +1,2403 @@
+package scratchlib.objects;%0A%0Aimport static org.hamcrest.CoreMatchers.instanceOf;%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertSame;%0Aimport static org.junit.Assert.assertThat;%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport java.io.ByteArrayInputStream;%0Aimport java.io.IOException;%0A%0Aimport org.junit.Test;%0A%0Aimport scratchlib.objects.fixed.data.ScratchObjectString;%0Aimport scratchlib.objects.inline.ScratchObjectBoolean;%0Aimport scratchlib.project.ScratchProject;%0Aimport scratchlib.project.ScratchVersion;%0Aimport scratchlib.reader.ScratchInputStream;%0A%0A%0Apublic class ScratchObjectsTest%0A%7B%0A    @Test%0A    public void looksUpConstructor()%0A    %7B%0A        assertSame(ScratchObjectBoolean.NIL,%0A                ScratchObjects.lookupConstructor(1).get());%0A        assertSame(ScratchObjectBoolean.FALSE,%0A                ScratchObjects.lookupConstructor(3).get());%0A%0A        assertThat(ScratchObjects.lookupConstructor(9).get(),%0A                instanceOf(ScratchObjectString.class));%0A    %7D%0A%0A    @Test%0A    public void readsReferences() throws IOException%0A    %7B%0A        ScratchProject project = new ScratchProject(ScratchVersion.SCRATCH14);%0A%0A        ByteArrayInputStream bin = new ByteArrayInputStream(%0A                new byte%5B%5D %7B 99, 0, 1, 37 %7D);%0A%0A        ScratchOptionalField result = ScratchObjects%0A                .read(new ScratchInputStream(bin), project);%0A%0A        assertFalse(result.isResolved());%0A        assertEquals(293, result.getReferenceID());%0A    %7D%0A%0A    @Test%0A    public void readsObjects() throws IOException%0A    %7B%0A        ScratchProject project = new ScratchProject(ScratchVersion.SCRATCH14);%0A%0A        ByteArrayInputStream bin = new ByteArrayInputStream(%0A                new byte%5B%5D %7B 9, 0, 0, 0, 0 %7D);%0A%0A        ScratchOptionalField result = ScratchObjects%0A                .read(new ScratchInputStream(bin), project);%0A%0A        assertTrue(result.isResolved());%0A        assertThat(result.get(), instanceOf(ScratchObjectString.class));%0A    %7D%0A%0A    @Test(expected = IOException.class)%0A    public void throwsForUnknownClassID() throws IOException%0A    %7B%0A        ScratchProject project = new ScratchProject(ScratchVersion.SCRATCH14);%0A%0A        ByteArrayInputStream bin = new ByteArrayInputStream(%0A                new byte%5B%5D %7B (byte) 255, 0, 0, 0, 0 %7D);%0A%0A        ScratchObjects.read(new ScratchInputStream(bin), project);%0A    %7D%0A%7D%0A

Add unit tests for ScratchObjects