diff --git a/src/main/java/org/easetech/easytest/annotation/Param.java b/src/main/java/org/easetech/easytest/annotation/Param.java index 3314ac5..ccf25b5 100644 --- a/src/main/java/org/easetech/easytest/annotation/Param.java +++ b/src/main/java/org/easetech/easytest/annotation/Param.java @@ -22,16 +22,17 @@ import java.util.Set; import java.util.TreeSet; import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.LinkedBlockingDeque; +import java.util.concurrent.LinkedBlockingQueue; +import org.easetech.easytest.converter.AbstractConverter; import org.easetech.easytest.converter.Converter; import org.easetech.easytest.converter.ConverterManager; import org.easetech.easytest.internal.EasyParamSignature; import org.easetech.easytest.util.DataContext; import org.easetech.easytest.util.GeneralUtil; import org.junit.Assert; +import org.junit.BeforeClass; import org.junit.experimental.theories.ParameterSignature; import org.junit.experimental.theories.ParameterSupplier; -import org.junit.experimental.theories.ParametersSuppliedBy; import org.junit.experimental.theories.PotentialAssignment; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,48 +45,91 @@ import sun.beans.editors.ShortEditor; /** - * An extension of Junit's {@link ParametersSuppliedBy} annotation that converts the data for Junit to consume. This - * Annotation gives the ability to get the data per method rather than per class. Also Junit will automatically call the + * A parameter level optional annotation that converts the data for EasyTest based test methods to consume. This + * Annotation gives the ability to pass input parameters to the test method. EasyTest will automatically call the test * method as many times as there are number of data sets to be run against that particular method. For example, if the - * user has specified 5 data set for a single junit method, Junit will call the method five times, each time providing + * user has specified 5 data set for a single test method, EasyTest will call the method five times, each time providing * the test data that was provided by the user.
- * The annotation is normally used in conjunction with {@link DataLoader} annotation although it can be used with it as - * well.

- * The annotation contains a single optional field : + * The annotation is used in conjunction with {@link DataLoader} annotation. {@link DataLoader} annotation is + * used to provide test data to the test cases. + *

+ * The annotation is optional. In case the name of the input parameter provided in the data file(XML, Excel, CSV or custom) + * is same as the name of the input parameter type then this annotation can be omitted. + * For eg:
+ * + * public void testWithStrongParameters(LibraryId id , + *@Param(name="itemid") ItemId + * itemId) { .... } + * + *
+ * In the above example we have not provided @Param annotation to the input paramater LibraryId. In this case the test parameter name in the test file should be LibraryId. + * You have to take care that in scenario where the input parameters are of the same type, the + * names should be different. Thus if you have two input parameters of type LibraryId then you should + * provide atleast @Param annotation on one of the input parameters. + * + * The annotation contains a single mandatory field : * - *
  • name : the name of the parameter(OPTIONAL) as is present in the input test data file.
  • In case the - * param name value is not specified and the Parameter type is Map, {@link DataSupplier} simply provides the HashMap + *
  • name : the name of the parameter(Mandatory) as is present in the input test data file.
  • In case the + * param annotation is not specified and the Parameter type is Map, {@link DataSupplier} simply provides the HashMap * instance that was created while loading the data. This {@link HashMap} represents a single set of test data for the - * test method.
  • In case the param name is not specified and the parameter type is a strongly typed Object of - * the client using this annotation(for eg LibraryId), it will try to search for the parameter with the name which is - * the class name of the Object parameter.
  • In case the param name is specified the framework will look for the + * test method.
  • In case the param name is specified along with the {link @Param} annotation, the framework will look for the * parameter with the specified name in the loaded test data. + *
    * * Moreover, the framework supports PropertyEditors support for strongly typed objects. If you have a custom object and - * its property editor in the same package, the JUnit framework will convert the String value to your specified custom + * its property editor in the same package, the EasyTest framework will convert the String value to your specified custom * object by calling the right property editor and pass an instance of custom object to your test case. This provides - * the users facility to write test cases such as this : + * the users facility to write test cases such as this :
    * * @Test - * @DataLoader(filePaths ={ "getItemsData.csv" }) public void testWithStrongParameters(@Param() LibraryId id , - * @Param(name="itemid") ItemId itemId) { .... - * - * }
    - *
  • Example of using Map to get the entire data:


  • + * @DataLoader(filePaths ={ "getItemsData.csv" })
    public void testWithStrongParameters(LibraryId id ,@Param(name="itemid") ItemId itemId) { .... + * }


    + *
  • Example of using Map to get the entire data:


  • *
    * @Test - * @DataLoader(filePaths= {"getItemsData.csv" })
    public void testGetItemsWithoutFileType(@Paramr() - * Map inputData) {
    ........ + *(@)DataLoader(filePaths= {"getItemsData.csv" })
    public void testGetItemsWithoutFileType(@Paramr() + * Map inputData) {
    ........ * * }
    + * + * + *

    + *The EasyTest framework also supports custom {@link Converter}s. Converters are a mechanism for the user to translate a map of key/value pair into + *custom objects that can be passed as input parameters to the test cases. + *For example, if you want to pass a complex object as input parameter to a test case then you will simply write a custom converter that extends {@link AbstractConverter} + *and will override the {@link AbstractConverter#convert(Map)} method. You can look at example of CustomConverter here : + *https://github.com/EaseTech/easytest-core/blob/master/src/test/java/org/easetech/easytest/example/ItemConverter.java + * + *
    + *If you want to pass a Collection type, then EasyTest framework provides the functionality to instantiate the Collection class for you and pass in the right generic parameter if possible. + *For eg. if you have a test method like this :
    + *
    + * + * (At)Test
    + * public void testArrayList(@Param(name="items") ArrayList<ItemId> items){
    + * Assert.assertNotNull(items);
    + * for(ItemId item : items){
    + * System.out.println("testArrayList : "+item);
    + *   }
    + * }
    + * + * then all you have to do is : + *
  • pass the list of itemIds as ":" separated list in the test data file(XML, CSV,Excel or custom), for eg: 23:56:908:666

  • + *
  • and register an editor or converter for converting the String data to object.
    + * In case the generic type argument to the Collection is a standard Java type(Date, Character, Timestamp, Long, Interger, Float, Double etc) + * then you don't have to do anything and the framework will take care of converting the String data to the requested type. + *

    + *Finally, even though the EasyTest framework is compiled with JDK 1.5, it does not stop you from using Java 6 Collection Types in case you are running your code on JRE 6. + *For using Java 6 Collection type(like Deque , LinkedBlockingDeque etc) in your test cases, all you have to do is register an empty implementation of {@link AbstractConverter} in the {@link BeforeClass} method. + *Note that you should pass only the Concrete type as parameter argument while extending the {@link AbstractConverter} and not the Abstract type or the interface type. + *You can always override the default implementation of creating a specific type instance for use in your test cases by overriding the {@link AbstractConverter#instanceOfType()} method. + * * * @author Anuj Kumar */ @Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER }) +@Target({ElementType.PARAMETER }) public @interface Param { - - /** The name of the parameter for which value needs to be fetched from the data set */ String name(); @@ -97,8 +141,11 @@ * */ static class DataSupplier { - - protected final Logger LOG = LoggerFactory.getLogger(DataSupplier.class); + + /** + * Logger + */ + protected final static Logger LOG = LoggerFactory.getLogger(DataSupplier.class); private static final String COLON = ":"; @@ -113,7 +160,6 @@ static class DataSupplier { PropertyEditorManager.registerEditor(Float.class, FloatEditor.class); PropertyEditorManager.registerEditor(Byte.class, ByteEditor.class); PropertyEditorManager.registerEditor(Short.class, ShortEditor.class); - //PropertyEditorManager.registerEditor(Character.class, CharacterEditor.class); PropertyEditorManager.registerEditor(Double.class, DoubleEditor.class); PropertyEditorManager.registerEditor(Boolean.class, BoolEditor.class); @@ -181,12 +227,14 @@ private List convert(List> convertFrom, try { dataValues = (Map) mapType.newInstance(); } catch (InstantiationException e) { - LOG.error("InstantiationException occured while trying to convert the data to Map(using newInstance() method). " + - "The type of Map passed as input parameter is :" + mapType , e); + LOG.error( + "InstantiationException occured while trying to convert the data to Map(using newInstance() method). " + + "The type of Map passed as input parameter is :" + mapType, e); throw new RuntimeException(e); } catch (IllegalAccessException e) { - LOG.error("IllegalAccessException occured while trying to convert the data to Map(using newInstance() method). " + - "The type of Map passed as input parameter is :" + mapType , e); + LOG.error( + "IllegalAccessException occured while trying to convert the data to Map(using newInstance() method). " + + "The type of Map passed as input parameter is :" + mapType, e); throw new RuntimeException(e); } dataValues.putAll(map); @@ -212,8 +260,8 @@ private List convert(Class idClass, String paramName, List finalData = new ArrayList(); PropertyEditor editor = PropertyEditorManager.findEditor(idClass); if (editor != null) { - if(LOG.isDebugEnabled()){ - LOG.debug("Editor for class " + idClass +" found."); + if (LOG.isDebugEnabled()) { + LOG.debug("Editor for class " + idClass + " found."); } for (Map object : convertFrom) { if (paramName != null && !EMPTY_STRING.equals(paramName)) { @@ -231,21 +279,21 @@ private List convert(Class idClass, String paramName, } } else { - if(LOG.isDebugEnabled()){ - LOG.debug("Editor for class " + idClass +" not found. Trying to find converter."); + if (LOG.isDebugEnabled()) { + LOG.debug("Editor for class " + idClass + " not found. Trying to find converter."); } // Try to find the Converter Converter converter = ConverterManager.findConverter(idClass); if (converter != null) { - if(LOG.isDebugEnabled()){ - LOG.debug("Converter for class " + idClass +" found. "); + if (LOG.isDebugEnabled()) { + LOG.debug("Converter for class " + idClass + " found. "); } for (Map object : convertFrom) { finalData.add(PotentialAssignment.forValue(EMPTY_STRING, converter.convert(object))); } } else { - if(LOG.isDebugEnabled()){ - LOG.debug("Converter for class " + idClass +" not found. Final try to resolve the object."); + if (LOG.isDebugEnabled()) { + LOG.debug("Converter for class " + idClass + " not found. Final try to resolve the object."); } // if there is no coverter and editor, values will be converted using our GeneralUtil methods // these methods cover multiple combinations of types from test data file @@ -273,12 +321,18 @@ private List convert(Class idClass, String paramName, finalData.add(PotentialAssignment.forValue(EMPTY_STRING, GeneralUtil.convertToUtilDate(object.get(paramName)))); } - } else if (Object.class.isAssignableFrom(idClass)) { + } else if (Character.class.isAssignableFrom(idClass)) { + for (Map object : convertFrom) { + finalData.add(PotentialAssignment.forValue(EMPTY_STRING, + GeneralUtil.convertToCharacter(object.get(paramName)))); + } + } + else if (Object.class.isAssignableFrom(idClass)) { for (Map object : convertFrom) { finalData.add(PotentialAssignment.forValue(EMPTY_STRING, object.get(paramName))); } } else { - if(LOG.isDebugEnabled()){ + if (LOG.isDebugEnabled()) { LOG.debug("Could not find either Editor or Converter instance for class :" + idClass); } Assert.fail("Could not find either Editor or Converter instance for class :" + idClass); @@ -297,7 +351,7 @@ private List convert(Class idClass, String paramName, * {@link PotentialAssignment} * @param paramName the optional name of the parameter with which to search for the data. * @param convertFrom the list of raw data read from the CSV file. - * @param parameterType The Class of the parameter type + * @param parameterType The Class of the parameter type * @return list of {@link PotentialAssignment} */ @@ -307,11 +361,11 @@ private List convertCollection(Class idClass, String par List finalData = new ArrayList(); PropertyEditor editor = PropertyEditorManager.findEditor(idClass); if (editor != null) { - if(LOG.isDebugEnabled()){ - LOG.debug("Editor for class " + idClass +" found."); + if (LOG.isDebugEnabled()) { + LOG.debug("Editor for class " + idClass + " found."); } for (Map object : convertFrom) { - Collection objectValues = getCollectionInstance(parameterType , idClass); + Collection objectValues = getCollectionInstance(parameterType, idClass); String strValue = null; if (paramName != null && !EMPTY_STRING.equals(paramName)) { strValue = getStringValue(paramName, object); @@ -331,29 +385,29 @@ private List convertCollection(Class idClass, String par } } else { - if(LOG.isDebugEnabled()){ - LOG.debug("Editor for class " + idClass +" not found. Trying to find converter."); + if (LOG.isDebugEnabled()) { + LOG.debug("Editor for class " + idClass + " not found. Trying to find converter."); } - Collection objectValues = getCollectionInstance(parameterType , idClass); - + Collection objectValues = getCollectionInstance(parameterType, idClass); + Converter converter = ConverterManager.findConverter(idClass); if (converter != null) { - if(LOG.isDebugEnabled()){ - LOG.debug("Converter for class " + idClass +" found. "); + if (LOG.isDebugEnabled()) { + LOG.debug("Converter for class " + idClass + " found. "); } for (Map object : convertFrom) { - Map tempMap = new HashMap(); - String values = (String)object.get(paramName); + Map tempMap = new HashMap(); + String values = (String) object.get(paramName); String[] splitValues = values.split(COLON); - for(int i = 0 ; i < splitValues.length ; i++){ + for (int i = 0; i < splitValues.length; i++) { tempMap.put(paramName, splitValues[i]); objectValues.add(converter.convert(tempMap)); } finalData.add(PotentialAssignment.forValue(EMPTY_STRING, objectValues)); } } else { - if(LOG.isDebugEnabled()){ - LOG.debug("Converter for class " + idClass +" not found. Final try to resolve the object."); + if (LOG.isDebugEnabled()) { + LOG.debug("Converter for class " + idClass + " not found. Final try to resolve the object."); } // if there is no editor, values will be converted using our GeneralUtil methods @@ -362,7 +416,7 @@ private List convertCollection(Class idClass, String par // There are scenarios where param name will be null(in cases where user has not specified @Param // annotation). // That scenario needs to be handled as well - + if (objectValues == null) { Assert.fail("Unable to identify the Collection with Class :" + parameterType); } @@ -411,7 +465,7 @@ private List convertCollection(Class idClass, String par } } else { - if(LOG.isDebugEnabled()){ + if (LOG.isDebugEnabled()) { LOG.debug("Could not find either Editor or Converter instance for class :" + idClass); } Assert.fail("Could not find either Editor or Converter instance for class :" + idClass); @@ -421,44 +475,79 @@ private List convertCollection(Class idClass, String par } return finalData; - + } /** - * Method that is responsible for returning the right instance of the Collection based on user's input. - * If the collection type is abstract or if the collection type is an interface a default collection type is returned. + * Method that is responsible for returning the right instance of the Collection based on user's input. If the + * collection type is abstract or if the collection type is an interface a default collection type is returned. + * * @param parameterType the Class object representing the Collection Type * @param genericType the optional generic type for the Collection * @return an instance of {@link Collection} */ @SuppressWarnings("unchecked") - private static Collection getCollectionInstance(Class parameterType , Class genericType) { + private static Collection getCollectionInstance(Class parameterType, Class genericType) { try { if (Set.class.isAssignableFrom(parameterType)) { - if(EnumSet.class.isAssignableFrom(parameterType)){ - return EnumSet.noneOf(genericType == null ? Object.class : genericType); + if (EnumSet.class.isAssignableFrom(parameterType)) { + if(LOG.isDebugEnabled()){ + LOG.debug("Returning an instance of " + EnumSet.class.getSimpleName() + " for the input parameter of Type :" + parameterType); + } + return EnumSet.noneOf(genericType == null ? Object.class : genericType); + } + + return (Collection) (parameterType.isInterface() + || Modifier.isAbstract(parameterType.getModifiers()) ? new TreeSet() : parameterType + .newInstance()); + } else if (List.class.isAssignableFrom(parameterType)) { + return (Collection) (parameterType.isInterface() + || Modifier.isAbstract(parameterType.getModifiers()) ? new LinkedList() : parameterType + .newInstance()); + } else if ("Deque".equals(parameterType.getSimpleName()) || "LinkedBlockingDeque".equals(parameterType.getSimpleName()) || "BlockingDeque".equals(parameterType.getSimpleName())) { + // Try to find an instance of the Class from the ConverterManager + Converter converter = ConverterManager.findConverter(parameterType); + if (converter == null) { + Assert + .fail("EasyTest does not natively support the Collection of type " + + parameterType + + " . In order to use this Collection type as parameter, provide an empty implementation of AbstractConveter " + + "class or provide an implementation of instance() method of the Converter interface "); + }else{ + return (Collection)converter.instanceOfType(); } - return (Collection) (parameterType.isInterface() || Modifier.isAbstract(parameterType.getModifiers()) ? new TreeSet() : parameterType.newInstance()); } else if (Queue.class.isAssignableFrom(parameterType)) { - if(ArrayBlockingQueue.class.isAssignableFrom(parameterType)){ + if (ArrayBlockingQueue.class.isAssignableFrom(parameterType)) { return new ArrayBlockingQueue(100); } - return (Collection) (parameterType.isInterface() || Modifier.isAbstract(parameterType.getModifiers()) ? new LinkedBlockingDeque() : parameterType.newInstance()); - } else if (List.class.isAssignableFrom(parameterType)) { - - return (Collection) (parameterType.isInterface() || Modifier.isAbstract(parameterType.getModifiers()) ? new LinkedList() : parameterType.newInstance()); - }else if(Collection.class.isAssignableFrom(parameterType)){ + return (Collection) (parameterType.isInterface() + || Modifier.isAbstract(parameterType.getModifiers()) ? new LinkedBlockingQueue() + : parameterType.newInstance()); + } else if (Collection.class.isAssignableFrom(parameterType)) { return new ArrayList(); } } catch (InstantiationException e) { - throw new RuntimeException(e); + if(LOG.isDebugEnabled()){ + LOG.error("InstantiationException occured while trying to instantiate a Collection of Type : " + parameterType , e); + } + Assert.fail("InstantiationException occured while trying to instantiate a Collection of Type : " + parameterType + " . The exception is :" + e.getMessage()); } catch (IllegalAccessException e) { - throw new RuntimeException(e); + + if(LOG.isDebugEnabled()){ + LOG.error("IllegalAccessException occured while trying to instantiate a Collection of Type : " + parameterType , e); + } + Assert.fail("IllegalAccessException occured while trying to instantiate a Collection of Type : " + parameterType + " . The exception is :" + e.getMessage()); } catch (IllegalArgumentException e) { - throw new RuntimeException(e); + if(LOG.isDebugEnabled()){ + LOG.error("IllegalArgumentException occured while trying to instantiate a Collection of Type : " + parameterType , e); + } + Assert.fail("IllegalArgumentException occured while trying to instantiate a Collection of Type : " + parameterType + " . The exception is :" + e.getMessage()); } catch (SecurityException e) { - throw new RuntimeException(e); - } + if(LOG.isDebugEnabled()){ + LOG.error("SecurityException occured while trying to instantiate a Collection of Type : " + parameterType , e); + } + Assert.fail("SecurityException occured while trying to instantiate a Collection of Type : " + parameterType + " . The exception is :" + e.getMessage()); + } return null; } diff --git a/src/main/java/org/easetech/easytest/converter/AbstractConverter.java b/src/main/java/org/easetech/easytest/converter/AbstractConverter.java index f56938f..bcd4281 100644 --- a/src/main/java/org/easetech/easytest/converter/AbstractConverter.java +++ b/src/main/java/org/easetech/easytest/converter/AbstractConverter.java @@ -1,12 +1,17 @@ + package org.easetech.easytest.converter; +import java.lang.reflect.Modifier; + +import junit.framework.Assert; + import java.lang.reflect.ParameterizedType; /** * - * An abstract class that can be used by the user to define their converters. - * It hides behind it the convertTo method implementation to get the converted object's class - * + * An abstract class that can be used by the user to define their converters. It hides behind it the convertTo method + * implementation to get the converted object's class + * * @param the type of object to convert to. */ public abstract class AbstractConverter implements Converter { @@ -24,4 +29,46 @@ public Class convertTo() { return type; } + /** + * Method responsible for returning an instance of the provided Generic Type argument. + * The default implementation assumes that the generic type argument is a concrete type with a default + * no arg constructor. It calls the {@link Class#newInstance()} method to return the instance. + * If the passed generic type argument is an interface or an abstract type, then the method calls the {@link Assert#fail()} + * telling the user that the passed Class object was not a Concrete class. + * + *
    + * A user can always extend this behavior to return specific instances in case the passed instance is an interface or an abstract class. + * It is recommended to extend the Abstract Converter instead of implementing the Converter interface directly. + * @return an instance of the generic type argument passed to the {@link AbstractConverter} + */ + @Override + public Type instanceOfType() { + Type type = null; + Class classType = convertTo(); + try { + type = classType.newInstance(); + } catch (InstantiationException e) { + if (classType.isInterface()) { + Assert + .fail(classType.getCanonicalName() + + " is not of Concrete type. EasyTest cannot instantiate an interface. Please provide a Concrete type as Generic Parameter Type while extending " + + AbstractConverter.class.getSimpleName()); + } else if (Modifier.isAbstract(convertTo().getModifiers())) { + Assert + .fail(classType.getCanonicalName() + + " is not of Concrete type. EasyTest cannot instantiate an abstract class. Please provide a Concrete type as Generic Parameter Type while extending " + + AbstractConverter.class.getSimpleName()); + } + else{ + Assert + .fail("Error instantiating a class of type "+ classType.toString() + e.getMessage()); + } + + } catch (IllegalAccessException e) { + Assert + .fail("IllegalAccessException occured while instantiating a class of type "+ classType.toString() + e.getMessage()); + } + return type; + } + } \ No newline at end of file diff --git a/src/main/java/org/easetech/easytest/converter/Converter.java b/src/main/java/org/easetech/easytest/converter/Converter.java index d8e0760..e4fdde2 100644 --- a/src/main/java/org/easetech/easytest/converter/Converter.java +++ b/src/main/java/org/easetech/easytest/converter/Converter.java @@ -11,7 +11,7 @@ public interface Converter { /** - * The class of the object to convert to + * The class of the generic type argument to which the data should be converted to. * @return the class of the object to convert to */ Class convertTo(); @@ -22,5 +22,12 @@ public interface Converter { * @return the object to convert to identified by {@link #convertTo()} class. */ Type convert(Map convertFrom); + + /** + * Method responsible for returning an instance of the provided Generic Type argument. + * Look at {@link AbstractConverter#instanceOfType()} methods Javadoc for details on the default implementation. + * @return an instance of the provided Generic Type argument. + */ + Type instanceOfType(); } diff --git a/src/main/java/org/easetech/easytest/converter/ConverterManager.java b/src/main/java/org/easetech/easytest/converter/ConverterManager.java index 5f30be1..35b3080 100644 --- a/src/main/java/org/easetech/easytest/converter/ConverterManager.java +++ b/src/main/java/org/easetech/easytest/converter/ConverterManager.java @@ -1,7 +1,6 @@ package org.easetech.easytest.converter; - import java.util.HashSet; import java.util.Iterator; import java.util.Set; @@ -21,30 +20,32 @@ public class ConverterManager { /** * Find the registered Converter for the given class type + * * @param targetType the class type to find teh converter for. * @return an instance of registered converter or Null if not found. */ public static Converter findConverter(Class targetType) { - Set cnvrtrs = converters.get(); - Converter result = null; - if(cnvrtrs!=null){ - Iterator itr = cnvrtrs.iterator(); - - while (itr.hasNext()) { - Converter converter = itr.next(); - if (converter.convertTo().equals(targetType)) { - result = converter; - break; - } - } - } - + Set cnvrtrs = converters.get(); + Converter result = null; + if (cnvrtrs != null) { + Iterator itr = cnvrtrs.iterator(); + + while (itr.hasNext()) { + Converter converter = itr.next(); + if (converter.convertTo().equals(targetType)) { + result = converter; + break; + } + } + } + return result; } /** * Register the converter with the ConverterManager + * * @param converterClass the class object identifying the concrete {@link Converter} class. */ public static void registerConverter(Class converterClass) { @@ -69,7 +70,10 @@ public static void registerConverter(Class converterClass) { } } else { - System.out.println("Converter with class :" + converterClass + " not registered"); + throw new RuntimeException("Could not register the converter for " + converterClass + + " . Either the passed argument is NULL or the passed class does not extend the " + + AbstractConverter.class.getSimpleName() + " abstract class or implement the " + + Converter.class.getSimpleName() + " interface."); } } diff --git a/src/main/java/org/easetech/easytest/exceptions/ParamAssertionError.java b/src/main/java/org/easetech/easytest/exceptions/ParamAssertionError.java index 301495c..1787f32 100644 --- a/src/main/java/org/easetech/easytest/exceptions/ParamAssertionError.java +++ b/src/main/java/org/easetech/easytest/exceptions/ParamAssertionError.java @@ -4,6 +4,13 @@ import java.util.Collection; import java.util.Iterator; +/** + * + * An extension of {@link RuntimeException} class that handles {@link ParamAssertionError} + * + * @author Anuj Kumar + * + */ public class ParamAssertionError extends RuntimeException { private static final long serialVersionUID = 1L; diff --git a/src/main/java/org/easetech/easytest/internal/EasyAssignments.java b/src/main/java/org/easetech/easytest/internal/EasyAssignments.java index ca59261..329bd8a 100644 --- a/src/main/java/org/easetech/easytest/internal/EasyAssignments.java +++ b/src/main/java/org/easetech/easytest/internal/EasyAssignments.java @@ -14,6 +14,8 @@ * A internal util class for working with the parameters of a test method. * This class provides EasyTest the facility to identify the method arguments, identify the DataSupplier * associated with the Test Framework and more. + * + * @author Anuj Kumar * */ public class EasyAssignments { @@ -94,9 +96,9 @@ public List potentialsForNextUnassigned() throws Instantiat /** * Get the instance of class that provides the functionality to provide Data. - * In our case, its always {@link Param.DataSupplier} + * In our case, its always {@link org.easetech.easytest.annotation.Param.DataSupplier} * @param unassigned - * @return {@link Param.DataSupplier} + * @return {@link org.easetech.easytest.annotation.Param.DataSupplier} * @throws InstantiationException * @throws IllegalAccessException */ diff --git a/src/main/java/org/easetech/easytest/internal/EasyParamSignature.java b/src/main/java/org/easetech/easytest/internal/EasyParamSignature.java index ee82d6f..0c6b027 100644 --- a/src/main/java/org/easetech/easytest/internal/EasyParamSignature.java +++ b/src/main/java/org/easetech/easytest/internal/EasyParamSignature.java @@ -12,6 +12,8 @@ * * A single instance of {@link EasyParamSignature} * identifies a single test method parameter associated with the test method + * + * @author Anuj Kumar * */ public class EasyParamSignature { diff --git a/src/main/java/org/easetech/easytest/loader/CSVDataLoader.java b/src/main/java/org/easetech/easytest/loader/CSVDataLoader.java index 21ed667..f85fa5a 100644 --- a/src/main/java/org/easetech/easytest/loader/CSVDataLoader.java +++ b/src/main/java/org/easetech/easytest/loader/CSVDataLoader.java @@ -1,6 +1,8 @@ package org.easetech.easytest.loader; +import java.lang.reflect.Array; + import com.csvreader.CsvReader; import com.csvreader.CsvWriter; import java.io.FileNotFoundException; @@ -38,6 +40,10 @@ * A CSV cannot have a blank line in between test data whether it is for a single test or for multiple tests. * The framework is capable of handling multiple test datas for multiple test methods in a single CSV file. * Although a user can choose to define the test data in multiple files as well. + *
    + * If you want to pass a Collection to the test method, just separate each instance with a ":". For eg. to pass + * a list of Itemids , pass them as a colon separated list like this -> 12:34:5777:9090 + * * * @author Anuj Kumar * @@ -179,7 +185,8 @@ public void writeData(String[] filePaths, String methodName, Map 0 && "".equals(splitValues[0])) { isKeyRow = false; @@ -199,7 +206,8 @@ public void writeData(String[] filePaths, String methodName, Map>> loadData(String[] filePaths) { @Override public void writeData(String[] filePaths, String methodName, Map>> actualData) { - // TODO Auto-generated method stub + //do nothing } } diff --git a/src/main/java/org/easetech/easytest/loader/ExcelDataLoader.java b/src/main/java/org/easetech/easytest/loader/ExcelDataLoader.java index 5411772..60b40cb 100644 --- a/src/main/java/org/easetech/easytest/loader/ExcelDataLoader.java +++ b/src/main/java/org/easetech/easytest/loader/ExcelDataLoader.java @@ -48,6 +48,10 @@ * The framework is capable of handling multiple test data for multiple test methods in a single Excel file. * Although a user can choose to define the test data in multiple files as well. * + *
    + * If you want to pass a Collection to the test method, just separate each instance with a ":". For eg. to pass + * a list of Itemids , pass them as a colon separated list like this -> 12:34:5777:9090 + * * @author Anuj Kumar * */ diff --git a/src/main/java/org/easetech/easytest/loader/XMLDataLoader.java b/src/main/java/org/easetech/easytest/loader/XMLDataLoader.java index e122c64..0a27c28 100644 --- a/src/main/java/org/easetech/easytest/loader/XMLDataLoader.java +++ b/src/main/java/org/easetech/easytest/loader/XMLDataLoader.java @@ -49,14 +49,14 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:org:easetech:easytest:1.0 testDataSchema.xsd">
    * <TestMethod name="getSimpleData">
    - *   <TestRecord>
    + *   <TestRecord id="1">
    *   <InputData>
    *    <Entry key="libraryId" value="91475" />
    *    <Entry key="itemId" value="12" />
    *    <Entry key="itemType" value="book" />
    *   </InputData>
    *   </TestRecord>
    - *   <TestRecord>
    + *   <TestRecord id="2">
    *   <InputData>
    *    <Entry key="libraryId" value="234" />
    *    <Entry key="itemId" value="1452" />
    @@ -65,14 +65,14 @@ *   </TestRecord>
    * </TestMethod>
    * <TestMethod name="getAnotherData">
    - *   <TestRecord>
    + *   <TestRecord id="3">
    *   <InputData>
    *    <Entry key="picId" value="1111" />
    *    <Entry key="picNum" value="12" />
    *    <Entry key="picFormat" value="jpeg" />
    *   </InputData>
    *   </TestRecord>
    - *   <TestRecord>
    + *   <TestRecord id="4">
    *   <InputData>
    *    <Entry key="picId" value="1561" />
    *    <Entry key="picNum" value="178" />
    @@ -85,6 +85,9 @@ * As you can guess, the root element is {@link InputTestData} that can have multiple {@link TestMethod} elements in it.
    * Each {@link TestMethod} element identifies a method to test with its name attribute.
    * Each {@link TestMethod} can have many TestRecords. Each Record identifies data for a single test execution.
    + * Each {@link TestRecord} element has an id attribute. This id attribute has to be unique in the entire XML file. + * So you should not have the id = 1 for more than one test record. If you do, then the behavior is undefined in such a scenario. + *
    * {@link TestRecord} contains {@link InputData} element as well as {@link OutputData} element. A user never specifies an {@link OutputData} element. * If it is specified, it will be ignored by the {@link Loader}. {@link OutputData} is used internally by the {@link XMLDataLoader} to write output data back to the file. * Each Entry element identifies a method parameter. diff --git a/src/main/java/org/easetech/easytest/reports/data/DurationBean.java b/src/main/java/org/easetech/easytest/reports/data/DurationBean.java index 2b0e6da..8357ebd 100644 --- a/src/main/java/org/easetech/easytest/reports/data/DurationBean.java +++ b/src/main/java/org/easetech/easytest/reports/data/DurationBean.java @@ -83,7 +83,7 @@ public void setEndInNano(long endInNano) { /** * Time difference in nano seconds * - * @return + * @return Time difference in nano seconds */ public long getNanoDifference() { return (this.endInNano - this.startInNano); diff --git a/src/main/java/org/easetech/easytest/runner/DataDrivenTestRunner.java b/src/main/java/org/easetech/easytest/runner/DataDrivenTestRunner.java index d8bf5c4..2602a9f 100644 --- a/src/main/java/org/easetech/easytest/runner/DataDrivenTestRunner.java +++ b/src/main/java/org/easetech/easytest/runner/DataDrivenTestRunner.java @@ -124,14 +124,16 @@ public class DataDrivenTestRunner extends Suite { * contains all the available test data key / value pairs for easy consumption by the user. It also supports user * defined custom Objects as parameters.
    *
    - * Finally, EasyTest also supports {@link Intercept} annotation. This annotation can be used to intercept calls to - * the test subject that is currently being tested. For eg. if you want to capture how much time a particular method - * of the actual service class is taking, then you can mark the field representing the testSubject with - * {@link Intercept} annotation. The framework also provides convenient way to write your own custom method - * interceptors. + * * * @author Anuj Kumar */ + +// Finally, EasyTest also supports {@link Intercept} annotation. This annotation can be used to intercept calls to +// * the test subject that is currently being tested. For eg. if you want to capture how much time a particular method +// * of the actual service class is taking, then you can mark the field representing the testSubject with +// * {@link Intercept} annotation. The framework also provides convenient way to write your own custom method +// * interceptors. private class EasyTestRunner extends BlockJUnit4ClassRunner { /** @@ -436,7 +438,7 @@ public void evaluate() throws Throwable { * This method encapsulates the actual change in behavior from the traditional JUnit Theories way of * populating and supplying the test data to the test method. This method creates a list of * {@link Assignments} identified by {@link #listOfAssignments} and then calls - * {@link #runWithCompleteAssignment(Assignments)} for each {@link Assignments} element in the + * {@link #runWithCompleteAssignment(EasyAssignments)} for each {@link Assignments} element in the * {@link #listOfAssignments} * * @param parameterAssignment an instance of {@link Assignments} identifying the parameters that needs to be diff --git a/src/main/java/org/easetech/easytest/util/CommonUtils.java b/src/main/java/org/easetech/easytest/util/CommonUtils.java index d4f3e03..78205fb 100644 --- a/src/main/java/org/easetech/easytest/util/CommonUtils.java +++ b/src/main/java/org/easetech/easytest/util/CommonUtils.java @@ -42,7 +42,7 @@ public static Double getRounded(double valueToRound, int numberOfDecimalPlaces) * Create directory * * @param destinationFolder - * @return + * @return a string representing the path to the output folder. */ public static String createDefaultOutputFolder(String destinationFolder) { if (destinationFolder == null || destinationFolder.equals("")) { diff --git a/src/main/java/org/easetech/easytest/util/ReflectionsUtil.java b/src/main/java/org/easetech/easytest/util/ReflectionsUtil.java deleted file mode 100644 index b71006d..0000000 --- a/src/main/java/org/easetech/easytest/util/ReflectionsUtil.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.easetech.easytest.util; - -public class ReflectionsUtil { - - - -} diff --git a/src/main/java/org/easetech/easytest/util/RunAftersWithOutputData.java b/src/main/java/org/easetech/easytest/util/RunAftersWithOutputData.java index 11c3f93..a1dc60b 100644 --- a/src/main/java/org/easetech/easytest/util/RunAftersWithOutputData.java +++ b/src/main/java/org/easetech/easytest/util/RunAftersWithOutputData.java @@ -29,16 +29,6 @@ public class RunAftersWithOutputData extends Statement { */ protected static final Logger LOG = LoggerFactory.getLogger(RunAftersWithOutputData.class); - /** - * An instance of {@link Loader} responsible for writing the data to the file. - */ - // private final Loader loader; - - /** - * An array of File paths containing the path to the file to which data needs to be written. Currently we take the - * first path in the array and try to write the output data to that file. - */ - // private final String[] filePath; /** * The actual data structure that contains both the input as well as output data @@ -80,6 +70,7 @@ public class RunAftersWithOutputData extends Statement { * {@link AfterClass} are always declared as static. * @param testInfoList the list of {@link TestInfo} containing information required to write data back to the file. * @param writableData the writable data that needs to be written to the file. + * @param testReportContainer a container class representing everything required to generate reports */ public RunAftersWithOutputData(Statement next, List afters, Object target, List testInfoList, Map>> writableData , ReportDataContainer testReportContainer) { @@ -135,17 +126,17 @@ public void evaluate() throws Throwable { String outputLocation = CommonUtils.createFolder(absoluteLocation); if (outputLocation != null) { EXPORT_FORMAT[] outputFormats = annotation.outputFormats(); - LOG.info("Reporting phase started " + new Date()); - LOG.info("Writing reports to folder: " + outputLocation); + LOG.debug("Reporting phase started " + new Date()); + LOG.debug("Writing reports to folder: " + outputLocation); ReportRunner testReportHelper = new ReportRunner(testReportContainer); testReportHelper.runReports(outputFormats, outputLocation); - LOG.info("Reporting phase finished " + new Date()); + LOG.debug("Reporting phase finished " + new Date()); } else { LOG.error("Can't write reports. Report output location " + outputLocationFromAnnotation + " can't be created."); } } } - LOG.info("evaluate finished"); + LOG.debug("evaluate finished"); } } diff --git a/src/test/java/org/easetech/easytest/example/DequeConverter.java b/src/test/java/org/easetech/easytest/example/DequeConverter.java new file mode 100644 index 0000000..e92d95f --- /dev/null +++ b/src/test/java/org/easetech/easytest/example/DequeConverter.java @@ -0,0 +1,19 @@ +package org.easetech.easytest.example; + +import java.util.Map; +import java.util.concurrent.LinkedBlockingQueue; +import org.easetech.easytest.converter.AbstractConverter; + +public class DequeConverter extends AbstractConverter { + + /** + * @param convertFrom + * @return + */ + @Override + public LinkedBlockingQueue convert(Map convertFrom) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/src/test/java/org/easetech/easytest/example/TestDifferentConditionsSupportedByParam.java b/src/test/java/org/easetech/easytest/example/TestDifferentConditionsSupportedByParam.java index 2369ecb..625263e 100644 --- a/src/test/java/org/easetech/easytest/example/TestDifferentConditionsSupportedByParam.java +++ b/src/test/java/org/easetech/easytest/example/TestDifferentConditionsSupportedByParam.java @@ -1,45 +1,10 @@ package org.easetech.easytest.example; -import junit.framework.Assert; - -import java.util.AbstractCollection; -import java.util.AbstractList; -import java.util.AbstractQueue; -import java.util.AbstractSequentialList; -import java.util.AbstractSet; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.Deque; -import java.util.EnumSet; -import java.util.LinkedHashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.PriorityQueue; -import java.util.Queue; -import java.util.Set; -import java.util.SortedSet; -import java.util.Stack; -import java.util.TreeSet; -import java.util.Vector; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.BlockingDeque; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.ConcurrentSkipListSet; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.CopyOnWriteArraySet; -import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.PriorityBlockingQueue; -import javax.management.AttributeList; -import javax.management.relation.RoleList; -import javax.management.relation.RoleUnresolvedList; +import junit.framework.Assert; import org.easetech.easytest.annotation.DataLoader; import org.easetech.easytest.annotation.Param; import org.easetech.easytest.converter.ConverterManager; -import org.easetech.easytest.example.EnumObject.Workingday; import org.easetech.easytest.runner.DataDrivenTestRunner; import org.junit.BeforeClass; import org.junit.Test; @@ -55,302 +20,303 @@ public static void before(){ ConverterManager.registerConverter(ComparableObjectConverter.class); ConverterManager.registerConverter(EnumConverter.class); ConverterManager.registerConverter(DelayedObjectConverter.class); - } - - @Test - public void testNonGenericListInterface(@Param(name="items") List items){ - Assert.assertNotNull(items); - for(Object item : items){ - System.out.println("testNonGenericListInterface : "+item); - } - } - - @Test - public void testGenericListInterface(@Param(name="items") List items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testGenericListInterface : "+item); - } - } - - @Test - public void testGenericListImplementation(@Param(name="items") LinkedList items){ + ConverterManager.registerConverter(DequeConverter.class); + } + +// @Test +// public void testNonGenericListInterface(@Param(name="items") List items){ +// Assert.assertNotNull(items); +// for(Object item : items){ +// System.out.println("testNonGenericListInterface : "+item); +// } +// } +// +// @Test +// public void testGenericListInterface(@Param(name="items") List items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testGenericListInterface : "+item); +// } +// } +// +// @Test +// public void testGenericListImplementation(@Param(name="items") LinkedList items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testNonGenericListImplementation(@Param(name="items") LinkedList items){ +// Assert.assertNotNull(items); +// for(Object item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testGenericSetInterface(@Param(name="dates") Set items){ +// Assert.assertNotNull(items); +// for(Date date : items){ +// System.out.println("testNonGenericListImplementation : "+date); +// } +// } +// +// @Test +// public void testNonGenericSetInterface(@Param(name="items") Set items){ +// Assert.assertNotNull(items); +// for(Object item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testNonGenericSetImplementation(@Param(name="items") TreeSet items){ +// Assert.assertNotNull(items); +// for(Object item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testGenericSetImplementation(@Param(name="items") SortedSet items){ +// Assert.assertNotNull(items); +// for(Long item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testGenericQueueInterface(@Param(name="items") Queue items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testNonGenericQueueInterface(@Param(name="items") Queue items){ +// Assert.assertNotNull(items); +// for(Object item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testNonGenericQueueImplementation(@Param(name="items") BlockingDeque items){ +// Assert.assertNotNull(items); +// for(Object item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testNonGenericBlockingQueueImplementation(@Param(name="items") BlockingQueue items){ +// Assert.assertNotNull(items); +// for(Object item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testNonGenericDequeImplementation(@Param(name="items") Deque items){ +// Assert.assertNotNull(items); +// for(Object item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testGenericQueueImplementation(@Param(name="items") Collection items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// //FROM HERE +// @Test +// public void testAbstractCollection(@Param(name="items") AbstractCollection items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testAbstractList(@Param(name="items") AbstractList items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testAbstractQueue(@Param(name="items") AbstractQueue items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testAbstractSequentialList(@Param(name="items") AbstractSequentialList items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testAbstractSet(@Param(name="items") AbstractSet items){ +// Assert.assertNotNull(items); +// for(ComparableObject item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testArrayBlockingQueue(@Param(name="items") ArrayBlockingQueue items){ +// Assert.assertNotNull(items); +// for(Float item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testArrayDeque(@Param(name="items") ArrayDeque items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testArrayList(@Param(name="items") ArrayList items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testAttributeList(@Param(name="items") AttributeList items){ +// Assert.assertNotNull(items); +// for(Object item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testConcurrentLinkedQueue(@Param(name="items") ConcurrentLinkedQueue items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testConcurrentSkipListSet(@Param(name="items") ConcurrentSkipListSet items){ +// Assert.assertNotNull(items); +// for(ComparableObject item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testCopyOnWriteArrayList(@Param(name="items") CopyOnWriteArrayList items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testCopyOnWriteArraySet(@Param(name="items") CopyOnWriteArraySet items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// @Test +// public void testEnumSet(@Param(name="items") EnumSet items){ +// +// Assert.assertNotNull(items); +// for(Object item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// + @Test + public void testLinkedBlockingDeque(@Param(name="items") LinkedBlockingQueue items){ Assert.assertNotNull(items); for(ItemId item : items){ - System.out.println("testGenericListImplementation : "+item); - } - } - - @Test - public void testNonGenericListImplementation(@Param(name="items") LinkedList items){ - Assert.assertNotNull(items); - for(Object item : items){ System.out.println("testNonGenericListImplementation : "+item); } } - @Test - public void testGenericSetInterface(@Param(name="dates") Set items){ - Assert.assertNotNull(items); - for(Date date : items){ - System.out.println("testNonGenericListImplementation : "+date); - } - } - - @Test - public void testNonGenericSetInterface(@Param(name="items") Set items){ - Assert.assertNotNull(items); - for(Object item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testNonGenericSetImplementation(@Param(name="items") TreeSet items){ - Assert.assertNotNull(items); - for(Object item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testGenericSetImplementation(@Param(name="items") SortedSet items){ - Assert.assertNotNull(items); - for(Long item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testGenericQueueInterface(@Param(name="items") Queue items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testNonGenericQueueInterface(@Param(name="items") Queue items){ - Assert.assertNotNull(items); - for(Object item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testNonGenericQueueImplementation(@Param(name="items") BlockingDeque items){ - Assert.assertNotNull(items); - for(Object item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testNonGenericBlockingQueueImplementation(@Param(name="items") BlockingQueue items){ - Assert.assertNotNull(items); - for(Object item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testNonGenericDequeImplementation(@Param(name="items") Deque items){ - Assert.assertNotNull(items); - for(Object item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testGenericQueueImplementation(@Param(name="items") Collection items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - //FROM HERE - @Test - public void testAbstractCollection(@Param(name="items") AbstractCollection items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testAbstractList(@Param(name="items") AbstractList items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testAbstractQueue(@Param(name="items") AbstractQueue items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testAbstractSequentialList(@Param(name="items") AbstractSequentialList items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testAbstractSet(@Param(name="items") AbstractSet items){ - Assert.assertNotNull(items); - for(ComparableObject item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testArrayBlockingQueue(@Param(name="items") ArrayBlockingQueue items){ - Assert.assertNotNull(items); - for(Float item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testArrayDeque(@Param(name="items") ArrayDeque items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testArrayList(@Param(name="items") ArrayList items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testAttributeList(@Param(name="items") AttributeList items){ - Assert.assertNotNull(items); - for(Object item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testConcurrentLinkedQueue(@Param(name="items") ConcurrentLinkedQueue items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testConcurrentSkipListSet(@Param(name="items") ConcurrentSkipListSet items){ - Assert.assertNotNull(items); - for(ComparableObject item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testCopyOnWriteArrayList(@Param(name="items") CopyOnWriteArrayList items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testCopyOnWriteArraySet(@Param(name="items") CopyOnWriteArraySet items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - @Test - public void testEnumSet(@Param(name="items") EnumSet items){ - - Assert.assertNotNull(items); - for(Object item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testLinkedBlockingDeque(@Param(name="items") LinkedBlockingDeque items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testLinkedBlockingQueue(@Param(name="items") LinkedBlockingQueue items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testLinkedHashSet(@Param(name="items") LinkedHashSet items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testPriorityBlockingQueue(@Param(name="items") PriorityBlockingQueue items){ - Assert.assertNotNull(items); - for(ComparableObject item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testPriorityQueue(@Param(name="items") PriorityQueue items){ - Assert.assertNotNull(items); - for(ComparableObject item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testRoleList(@Param(name="items") RoleList items){ - Assert.assertNotNull(items); - for(Object item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testRoleUnresolvedList(@Param(name="items") RoleUnresolvedList items){ - Assert.assertNotNull(items); - for(Object item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - @Test - public void testStack(@Param(name="items") Stack items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } - - - @Test - public void testVector(@Param(name="items") Vector items){ - Assert.assertNotNull(items); - for(ItemId item : items){ - System.out.println("testNonGenericListImplementation : "+item); - } - } +// @Test +// public void testLinkedBlockingQueue(@Param(name="items") LinkedBlockingQueue items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testLinkedHashSet(@Param(name="items") LinkedHashSet items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testPriorityBlockingQueue(@Param(name="items") PriorityBlockingQueue items){ +// Assert.assertNotNull(items); +// for(ComparableObject item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testPriorityQueue(@Param(name="items") PriorityQueue items){ +// Assert.assertNotNull(items); +// for(ComparableObject item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testRoleList(@Param(name="items") RoleList items){ +// Assert.assertNotNull(items); +// for(Object item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testRoleUnresolvedList(@Param(name="items") RoleUnresolvedList items){ +// Assert.assertNotNull(items); +// for(Object item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// @Test +// public void testStack(@Param(name="items") Stack items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } +// +// +// @Test +// public void testVector(@Param(name="items") Vector items){ +// Assert.assertNotNull(items); +// for(ItemId item : items){ +// System.out.println("testNonGenericListImplementation : "+item); +// } +// } }