    @Test
    public void testPackageResolvesCorrectly() throws CompileException, IOException {

        File dir = Files.createTempDir();
        dir.deleteOnExit();
        
        File f1 = new File(dir, "bagpathimport");
        File f2 = createFile();
        
        write(f1, "package edu.brown.cs;\nbag MyBag1 {bool test = 0;}");
        write(f2, "import \"%s\";\nbag MyBag2 {MyBag1 test = 0;}", f1.getName());

        List<String> inputFiles = Lists.newArrayList(f2.getAbsolutePath());
        List<String> bagPath = Lists.newArrayList(dir.getAbsolutePath());

        Set<BaggageBuffersDeclaration> processed = Linker.link(inputFiles, bagPath);
        BaggageBuffersDeclaration decl = processed.iterator().next();
        FieldType ft = decl.getBagDeclarations().get(0).getFieldDeclarations().get(0).fieldtype();
        assertTrue(ft instanceof UserDefinedType);
        UserDefinedType uft = (UserDefinedType) ft;
        assertTrue(uft.hasPackageName());
        assertEquals("edu.brown.cs", uft.packageName());
    }