Changeset 1220

Show
Ignore:
Timestamp:
07/07/08 14:34:35 (2 months ago)
Author:
phoenix
Message:

Fixed outdated tests to use reflection.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/mmrnmhrm.tests/.classpath

    r496 r1220  
    11<?xml version="1.0" encoding="UTF-8"?> 
    22<classpath> 
     3    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> 
     4    <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> 
    35    <classpathentry kind="src" path="src-core"/> 
    46    <classpathentry kind="src" path="src"/> 
    5     <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> 
    6     <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> 
    77    <classpathentry kind="output" path="bin"/> 
    88</classpath> 
  • trunk/mmrnmhrm.tests/src-core/dtool/tests/ref/FindDef__Common.java

    r833 r1220  
    66import java.util.Collection; 
    77 
    8 import mmrnmhrm.core.dltk.ParsingUtil; 
     8import mmrnmhrm.core.dltk.DeeParserUtil; 
    99 
    1010import org.eclipse.dltk.core.ISourceModule; 
     
    5151        System.out.println(modUnit.getBuffer().getContents().substring(offset).split("\\s")[0]); 
    5252         
    53         ASTNeoNode node = ASTNodeFinder.findElement(ParsingUtil.getNeoASTModule(modUnit), offset); 
     53        ASTNeoNode node = ASTNodeFinder.findElement(DeeParserUtil.getNeoASTModule(modUnit), offset); 
    5454 
    5555        Reference ref = (Reference) node; 
  • trunk/mmrnmhrm.tests/src/mmrnmhrm/org/eclipse/dltk/ui/wizards/ProjectWizardFirstPage__Accessor.java

    r833 r1220  
    11package mmrnmhrm.org.eclipse.dltk.ui.wizards; 
    22 
    3 import mmrnmhrm.org.eclipse.dltk.ui.wizards.ProjectWizardFirstPage_; 
    4 import mmrnmhrm.org.eclipse.dltk.ui.wizards.ProjectWizardFirstPage_.NameGroup; 
     3import java.lang.reflect.Field; 
     4import java.lang.reflect.InvocationTargetException; 
     5import java.lang.reflect.Method; 
    56 
    6 import org.eclipse.swt.widgets.Composite; 
     7import org.eclipse.dltk.ui.wizards.ProjectWizardFirstPage; 
    78 
    89 
    9 public abstract class TestAccessor extends ProjectWizardFirstPage_
     10public abstract class ProjectWizardFirstPage__Accessor
    1011 
    11     public static abstract class TestAccessor_NameGroup extends NameGroup { 
    12         public TestAccessor_NameGroup(Composite composite, String initialName) { 
    13             ((ProjectWizardFirstPage_)null).super(composite, initialName); 
     12    public static class NameGroup__Accessor { 
     13 
     14        Object nameGroup; 
     15 
     16        public NameGroup__Accessor(Object object) { 
     17            nameGroup = object; 
    1418        } 
    15         public static void _setName(ProjectWizardFirstPage_ firstPage, String name) { 
    16             _fNameGroup(firstPage).setName(name); 
     19 
     20        public void _setName(String name) throws NoSuchMethodException, 
     21                IllegalAccessException, InvocationTargetException { 
     22            Method method = getClass().getMethod("setName", String.class); 
     23            method.invoke(nameGroup, name); 
    1724        } 
    1825    } 
    19      
    20     protected static NameGroup _fNameGroup(ProjectWizardFirstPage_ firstPage) { 
    21         return firstPage.fNameGroup; 
     26 
     27    public static NameGroup__Accessor access_fNameGroup( 
     28            ProjectWizardFirstPage firstPage) throws SecurityException, 
     29            NoSuchFieldException, IllegalArgumentException, 
     30            IllegalAccessException { 
     31        Field field = firstPage.getClass().getDeclaredField("fNameGroup"); 
     32        return new NameGroup__Accessor(field.get(firstPage)); 
    2233    } 
    2334     
  • trunk/mmrnmhrm.tests/src/mmrnmhrm/tests/SampleMainProject.java

    r833 r1220  
    88 
    99import melnorme.miscutil.ExceptionAdapter; 
    10 import mmrnmhrm.core.dltk.ParsingUtil; 
     10import mmrnmhrm.core.dltk.DeeParserUtil; 
    1111import mmrnmhrm.core.model.CompilationUnit; 
    1212 
     
    9999    public static Module getModule(String filepath) throws CoreException { 
    100100        CompilationUnit cunit = new CompilationUnit(getFile(filepath)); 
    101         return ParsingUtil.getNeoASTModule(cunit.modUnit); 
     101        return DeeParserUtil.getNeoASTModule(cunit.modUnit); 
    102102    } 
    103103     
  • trunk/mmrnmhrm.tests/src/mmrnmhrm/ui/wizards/DeeProjectWizardTest.java

    r906 r1220  
    11package mmrnmhrm.ui.wizards; 
    22 
     3import static melnorme.miscutil.Assert.assertTrue; 
    34import mmrnmhrm.core.DeeCore; 
    45import mmrnmhrm.core.model.ModelUtil; 
    5 import mmrnmhrm.org.eclipse.dltk.ui.wizards.TestAccessor; 
     6import mmrnmhrm.org.eclipse.dltk.ui.wizards.ProjectWizardFirstPage__Accessor; 
    67import mmrnmhrm.tests.BaseUITest; 
    78import mmrnmhrm.tests.SampleMainProject; 
     
    1920import org.junit.Before; 
    2021import org.junit.Test; 
    21  
    22 import static melnorme.miscutil.Assert.assertTrue; 
    2322 
    2423 
     
    8180    @Test 
    8281    public void test_P1Validation() throws Throwable { 
    83         //wizard.fFirstPage.fNameGroup.setName(SampleMainProject.SAMPLEPROJNAME); 
    84         TestAccessor.TestAccessor_NameGroup._setName(wizard.fFirstPage, SampleMainProject.SAMPLEPROJNAME); 
     82        ProjectWizardFirstPage__Accessor.access_fNameGroup(wizard.fFirstPage)._setName(SampleMainProject.SAMPLEPROJNAME); 
    8583        assertTrue(!wizard.canFinish()); 
    8684 
     
    9290    public void test_P1_Finish() throws Throwable { 
    9391        wizard.fFirstPage.getProjectName(); 
    94         TestAccessor.TestAccessor_NameGroup._setName(wizard.fFirstPage, NEWPROJNAME); 
     92        ProjectWizardFirstPage__Accessor.access_fNameGroup(wizard.fFirstPage)._setName(NEWPROJNAME); 
    9593        assertTrue(wizard.canFinish()); 
    9694 
     
    120118    @Test 
    121119    public void test_P1_P2_P1_Finish() throws Throwable { 
    122         TestAccessor.TestAccessor_NameGroup._setName(wizard.fFirstPage, NEWPROJNAME); 
     120        ProjectWizardFirstPage__Accessor.access_fNameGroup(wizard.fFirstPage)._setName(NEWPROJNAME); 
    123121        assertTrue(wizard.canFinish()); 
    124122        simulateEnterPage2(); 
     
    135133    @Test 
    136134    public void test_P1_Cancel() throws Throwable { 
    137         TestAccessor.TestAccessor_NameGroup._setName(wizard.fFirstPage, NEWPROJNAME); 
     135        ProjectWizardFirstPage__Accessor.access_fNameGroup(wizard.fFirstPage)._setName(NEWPROJNAME); 
    138136        assertTrue(wizard.canFinish()); 
    139137