Package org.jboss.forge.roaster.model.source

Examples of org.jboss.forge.roaster.model.source.Import


        assertEquals(secondImport, firstImport);
    }
   
    @Test
    public void testEqualsReturnsFalseForDifferentImport() throws Exception {
        Import classImport = buildImport(DEFAULT_IMPORT);
        Import interfaceImport = buildImport("org.jboss.forge.roaster.model.impl.ImportImpl");
        assertFalse(classImport.equals(interfaceImport));
    }
View Full Code Here


        assertFalse(classImport.equals(interfaceImport));
    }
   
    @Test
    public void testEqualsIsReflexive() throws Exception {
        Import reflexiveImport = buildImport(DEFAULT_IMPORT);
        assertEquals(reflexiveImport, reflexiveImport);
    }
View Full Code Here

        assertEquals(reflexiveImport, reflexiveImport);
    }
   
    @Test
    public void testEqualsIsTransitive() throws Exception {
        Import firstImport = buildImport(DEFAULT_IMPORT);
        Import secondImport = buildImport(DEFAULT_IMPORT);
        Import thirdImport = buildImport(DEFAULT_IMPORT);
        assertEquals(firstImport, secondImport);
        assertEquals(secondImport, thirdImport);
        assertEquals(firstImport, thirdImport);
    }
View Full Code Here

        assertFalse(buildImport(DEFAULT_IMPORT).equals(null));
    }
   
    @Test
    public void testNotEqualsToDifferentClass() throws Exception {
        Import myImport = buildImport(DEFAULT_IMPORT);
        assertFalse(myImport.equals(DEFAULT_IMPORT));
    }
View Full Code Here

        assertFalse(myImport.equals(DEFAULT_IMPORT));
    }
   
    @Test
    public void testEqualsToDifferentImportImplementation() throws Exception {
        Import myImport = buildImport(DEFAULT_IMPORT);
        Import mockImport = new MockImportImpl(DEFAULT_IMPORT_PACKAGE, DEFAULT_IMPORT_CLASS);
        assertEquals(myImport, mockImport);
    }
View Full Code Here

   @Override
   public Import addImport(final String className)
   {
      String strippedClassName = Types.stripGenerics(Types.stripArray(className));
      Import imprt;
      if (Types.isSimpleName(strippedClassName) && !hasImport(strippedClassName))
      {
         throw new IllegalArgumentException("Cannot import class without a package [" + strippedClassName + "]");
      }

      if (!hasImport(strippedClassName) && validImport(strippedClassName))
      {
         imprt = new ImportImpl(this).setName(strippedClassName);
         unit.imports().add(imprt.getInternal());
      }
      else if (hasImport(strippedClassName))
      {
         imprt = getImport(strippedClassName);
      }
View Full Code Here

   @Override
   @SuppressWarnings("unchecked")
   public Import addImport(final String className)
   {
      String strippedClassName = Types.stripGenerics(Types.stripArray(className));
      Import imprt;
      if (Types.isSimpleName(strippedClassName) && !hasImport(strippedClassName))
      {
         throw new IllegalArgumentException("Cannot import class without a package [" + strippedClassName + "]");
      }

      if (!hasImport(strippedClassName) && validImport(strippedClassName))
      {
         imprt = new ImportImpl(this).setName(strippedClassName);
         unit.imports().add(imprt.getInternal());
      }
      else if (hasImport(strippedClassName))
      {
         imprt = getImport(strippedClassName);
      }
View Full Code Here

TOP

Related Classes of org.jboss.forge.roaster.model.source.Import

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.