TPTP 4.4.0 Testing Tools Project
Internal API Specification

org.eclipse.hyades.test.tools.core.internal.common.codegen
Class Helper

java.lang.Object
  extended byorg.eclipse.hyades.test.tools.core.internal.common.codegen.Helper
Direct Known Subclasses:
CodeGeneratorHelper

public class Helper
extends java.lang.Object

Since:
1.0.1

Nested Class Summary
static class Helper.LineIterator
           
static class Helper.StringIterator
          String iterator that iterates character by character through a string.
 
Field Summary
static java.lang.String EXCEPTION_CLASS_NAME
           
static java.lang.String HYADES_DEFAULT_TEST_ARBITER_CLASS_NAME
           
static java.lang.String HYADES_JUNIT_RUNNER
           
static java.lang.String HYADES_TEST_CASE_CLASS_NAME
           
static java.lang.String HYADES_TEST_SUITE_CLASS_NAME
           
static java.lang.String JUNIT_TEST_CASE_CLASS_NAME
           
static java.lang.String JUNIT_TEST_CLASS_NAME
           
static java.lang.String JUNIT_TEST_METHOD_PREFIX
           
static java.lang.String JUNIT_TEST_SUITE_CLASS_NAME
           
 
Constructor Summary
Helper()
           
 
Method Summary
 void addImport(java.lang.String qualifiedName)
           
static boolean compareJavaComments(java.lang.CharSequence comment1, java.lang.String comment2)
          Compares two strings appearing within a java comment/javadoc comment and return true if they contain the same strings, ignoring differences such as line breaks, tabs and space indentation.
 java.lang.String computeTestMethodName(org.eclipse.hyades.models.common.facades.behavioral.ITestCase testCase, boolean strictJUnitConventions)
          Computes a valid unique name for a test method that would implement the specified test case.
 void dispose()
           
 void emitSortedImports()
           
 void emitSortedImports(org.eclipse.jdt.core.dom.CompilationUnit cu)
           
 void emitSortedImports(org.eclipse.jdt.core.ICompilationUnit cu)
          Update the specified compilation unit with the list of imports that were recorded by the helper using addImport.
static java.lang.String formatContent(java.lang.String content)
           
static java.lang.String formatContent(java.lang.String content, int offset)
           
 java.lang.String getFilePath(java.lang.Object object)
           
 java.lang.String getImportedName(java.lang.String qualifiedName)
           
protected  ImportManager getImportManager()
           
 java.lang.String getLabel(java.lang.Object object)
          Deprecated.  
 org.eclipse.ltk.core.refactoring.Change getMethodNamesChange()
           
 java.lang.String getPackageName(java.lang.Object object)
           
 java.lang.String getSuperclassName()
           
static java.lang.String getTestMethodName(org.eclipse.hyades.models.common.facades.behavioral.ITestCase testCase)
           
 java.lang.String getTestMethodName(org.eclipse.hyades.models.common.facades.behavioral.ITestCase testCase, boolean directModelAccess)
          Returns the test method name that implements the specified testCase in the JUnit source code, if this value was set.
protected  java.lang.String getUniqueName(java.lang.String namespace, java.lang.Object object)
          Returns a created unique name for a given object derived from the the base name argument.
static boolean isDestructiveChange(org.eclipse.ltk.core.refactoring.Change change)
           
 java.lang.String lowerCaseIdentifier(java.lang.String identifier)
          Returns a modified identifier with first letter lower case.
 void markImportLocation(java.lang.StringBuffer stringBuffer)
           
 java.lang.String retrieveClassName(org.eclipse.hyades.models.common.facades.behavioral.INamedElement namedElement)
           
 java.lang.String retrieveIdentifierName(org.eclipse.hyades.models.common.facades.behavioral.INamedElement namedElement, java.lang.Object namespace)
           
protected  java.lang.String retrieveUniqueName(java.lang.String namespace, java.lang.Object object, java.lang.String baseName, boolean caseSensitive)
          Returns a unique name for a given object derived from the the base name argument.
 void setImportManager(ImportManager importManager)
           
 void setSuperclassName(java.lang.String name)
           
static void setTestMethodName(org.eclipse.hyades.models.common.facades.behavioral.ITestCase testCase, java.lang.String name)
           
 void setTestMethodName(org.eclipse.hyades.models.common.facades.behavioral.ITestCase testCase, java.lang.String name, boolean directModelAccess)
          Records the name of the test method associated to a testCase.
 java.lang.String upperCaseIdentifier(java.lang.String identifier)
          Returns a modified identifier with first letter lower case.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JUNIT_TEST_CLASS_NAME

public static final java.lang.String JUNIT_TEST_CLASS_NAME
See Also:
Constant Field Values

JUNIT_TEST_CASE_CLASS_NAME

public static final java.lang.String JUNIT_TEST_CASE_CLASS_NAME
See Also:
Constant Field Values

JUNIT_TEST_SUITE_CLASS_NAME

public static final java.lang.String JUNIT_TEST_SUITE_CLASS_NAME
See Also:
Constant Field Values

HYADES_TEST_CASE_CLASS_NAME

public static final java.lang.String HYADES_TEST_CASE_CLASS_NAME
See Also:
Constant Field Values

HYADES_TEST_SUITE_CLASS_NAME

public static final java.lang.String HYADES_TEST_SUITE_CLASS_NAME
See Also:
Constant Field Values

HYADES_DEFAULT_TEST_ARBITER_CLASS_NAME

public static final java.lang.String HYADES_DEFAULT_TEST_ARBITER_CLASS_NAME
See Also:
Constant Field Values

HYADES_JUNIT_RUNNER

public static final java.lang.String HYADES_JUNIT_RUNNER
See Also:
Constant Field Values

EXCEPTION_CLASS_NAME

public static final java.lang.String EXCEPTION_CLASS_NAME
See Also:
Constant Field Values

JUNIT_TEST_METHOD_PREFIX

public static final java.lang.String JUNIT_TEST_METHOD_PREFIX
See Also:
Constant Field Values
Constructor Detail

Helper

public Helper()
Method Detail

formatContent

public static java.lang.String formatContent(java.lang.String content)

formatContent

public static java.lang.String formatContent(java.lang.String content,
                                             int offset)

dispose

public void dispose()
See Also:
IDisposable.dispose()

getPackageName

public java.lang.String getPackageName(java.lang.Object object)

getLabel

public java.lang.String getLabel(java.lang.Object object)
Deprecated.  

This method does nothing and only returns an empty string "". Use TestUIUtil instead since this is a UI utility.

Parameters:
object -
Returns:

getFilePath

public java.lang.String getFilePath(java.lang.Object object)

retrieveClassName

public java.lang.String retrieveClassName(org.eclipse.hyades.models.common.facades.behavioral.INamedElement namedElement)

lowerCaseIdentifier

public java.lang.String lowerCaseIdentifier(java.lang.String identifier)
Returns a modified identifier with first letter lower case.
E.g. lowerCaseIdentifier("MyIdentifier") returns "myIdentifier". The same identifier is returned if it already starts with a lower case letter.

Parameters:
identifier - An identifier. null is allowed.
Returns:
An identifier starting with a lower case, or null if identifier was null.

upperCaseIdentifier

public java.lang.String upperCaseIdentifier(java.lang.String identifier)
Returns a modified identifier with first letter lower case.
E.g. lowerCaseIdentifier("MyIdentifier") returns "myIdentifier". The same identifier is returned if it already starts with a lower case letter.

Parameters:
identifier - An identifier. null is allowed.
Returns:
An identifier starting with a lower case, or null if identifier was null.

retrieveIdentifierName

public java.lang.String retrieveIdentifierName(org.eclipse.hyades.models.common.facades.behavioral.INamedElement namedElement,
                                               java.lang.Object namespace)

retrieveUniqueName

protected java.lang.String retrieveUniqueName(java.lang.String namespace,
                                              java.lang.Object object,
                                              java.lang.String baseName,
                                              boolean caseSensitive)
Returns a unique name for a given object derived from the the base name argument. The namespace argument defines the context in which the returned name must be unique. If null then a default namespace is default.

If a name has been already created for a given object in the same namespace this name is returned.

Parameters:
namespace -
object -
Returns:
a not null String

getUniqueName

protected java.lang.String getUniqueName(java.lang.String namespace,
                                         java.lang.Object object)
Returns a created unique name for a given object derived from the the base name argument. The namespace argument defines the context in which the returned name must be unique. If null then a default namespace is default.

Parameters:
namespace -
object -
Returns:
a unique name or null if none was created by the {@link #retrieveUniqueName(String, Object, String).

markImportLocation

public void markImportLocation(java.lang.StringBuffer stringBuffer)

emitSortedImports

public void emitSortedImports()

emitSortedImports

public void emitSortedImports(org.eclipse.jdt.core.ICompilationUnit cu)
                       throws org.eclipse.jdt.core.JavaModelException
Update the specified compilation unit with the list of imports that were recorded by the helper using addImport.

Throws:
org.eclipse.jdt.core.JavaModelException

emitSortedImports

public void emitSortedImports(org.eclipse.jdt.core.dom.CompilationUnit cu)

getImportedName

public java.lang.String getImportedName(java.lang.String qualifiedName)

addImport

public void addImport(java.lang.String qualifiedName)

getImportManager

protected ImportManager getImportManager()

setImportManager

public void setImportManager(ImportManager importManager)

computeTestMethodName

public java.lang.String computeTestMethodName(org.eclipse.hyades.models.common.facades.behavioral.ITestCase testCase,
                                              boolean strictJUnitConventions)
Computes a valid unique name for a test method that would implement the specified test case.

Parameters:
testCase -
strictJUnitConventions -
Returns:

getTestMethodName

public java.lang.String getTestMethodName(org.eclipse.hyades.models.common.facades.behavioral.ITestCase testCase,
                                          boolean directModelAccess)
Returns the test method name that implements the specified testCase in the JUnit source code, if this value was set.

Parameters:
testCase -
Returns:
The test method name, or null if this value was not set.
See Also:
computeTestMethodName(ITestCase, boolean)

getTestMethodName

public static java.lang.String getTestMethodName(org.eclipse.hyades.models.common.facades.behavioral.ITestCase testCase)

setTestMethodName

public void setTestMethodName(org.eclipse.hyades.models.common.facades.behavioral.ITestCase testCase,
                              java.lang.String name,
                              boolean directModelAccess)
Records the name of the test method associated to a testCase.

Parameters:
testCase -
name -
See Also:
computeTestMethodName(ITestCase, boolean), getTestMethodName(ITestCase, boolean)

setTestMethodName

public static void setTestMethodName(org.eclipse.hyades.models.common.facades.behavioral.ITestCase testCase,
                                     java.lang.String name)

getMethodNamesChange

public org.eclipse.ltk.core.refactoring.Change getMethodNamesChange()

setSuperclassName

public void setSuperclassName(java.lang.String name)

getSuperclassName

public java.lang.String getSuperclassName()

compareJavaComments

public static boolean compareJavaComments(java.lang.CharSequence comment1,
                                          java.lang.String comment2)
Compares two strings appearing within a java comment/javadoc comment and return true if they contain the same strings, ignoring differences such as line breaks, tabs and space indentation.

Parameters:
comment1 -
comment2 -
Returns:

isDestructiveChange

public static boolean isDestructiveChange(org.eclipse.ltk.core.refactoring.Change change)

TPTP 4.4.0 Testing Tools Project
Internal API Specification