// Path: src/main/java/com/budhash/cliche/OutputConversionEngine.java
// public class OutputConversionEngine {
// 
//     private List<OutputConverter> outputConverters = new ArrayList<OutputConverter>();
// 
//     public void addConverter(OutputConverter converter) {
//         if (converter == null ) {
//             throw new IllegalArgumentException("Converter == null");
//         }
//         outputConverters.add(converter);
//     }
// 
//     public boolean removeConverter(OutputConverter converter) {
//         return outputConverters.remove(converter);
//     }
// 
//     public Object convertOutput(Object anObject) {
//         Object convertedOutput = anObject;
//         for (ListIterator<OutputConverter> it = outputConverters.listIterator(outputConverters.size()); it.hasPrevious();) {
//             OutputConverter outputConverter = it.previous(); // last in --- first called.
//             Object conversionResult = outputConverter.convertOutput(convertedOutput);
//             if (conversionResult != null) {
//                 convertedOutput = conversionResult;
//             }
//         }
//         return convertedOutput;
//     }
// 
//     public void addDeclaredConverters(Object handler) {
//         Field[] fields = handler.getClass().getFields();
//         final String PREFIX = "CLI_OUTPUT_CONVERTERS";
//         for (Field field : fields) {
//             if (field.getName().startsWith(PREFIX)
//                     && field.getType().isArray()
//                     && OutputConverter.class.isAssignableFrom(field.getType().getComponentType())) {
//                 try {
//                     Object convertersArray = field.get(handler);
//                     for (int i = 0; i < Array.getLength(convertersArray); i++) {
//                         addConverter((OutputConverter)Array.get(convertersArray, i));
//                     }
//                 } catch (Exception ex) {
//                     throw new RuntimeException("Error getting converter from field " + field.getName(), ex);
//                 }
//             }
//         }
//     }
// 
// 
// }
// 
// Path: src/main/java/com/budhash/cliche/OutputConverter.java
// public interface OutputConverter {
//     /**
//      * Object-to--user-friendly-object (usually string) conversion method.
//      * The method must check argument's class, since it will be fed virtually all
//      * returned objects. Simply return null when not sure.
//      * @param toBeFormatted Object to be displayed to the user
//      * @return Object representing the object or Null if don't know how to make it.
//      *         Do not return default toString() !!
//      */
//     Object convertOutput(Object toBeFormatted);
// }


import org.junit.Before;
import org.junit.Test;
import com.budhash.cliche.OutputConversionEngine;
import com.budhash.cliche.OutputConverter;
import static org.junit.Assert.*;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.budhash.cliche;




/**
 *
 * @author ASG
 */
public class OutputConversionEngineTest {

    @Before
    public void setUp() {
// Path: src/main/java/com/budhash/cliche/OutputConversionEngine.java
// public class OutputConversionEngine {
// 
//     private List<OutputConverter> outputConverters = new ArrayList<OutputConverter>();
// 
//     public void addConverter(OutputConverter converter) {
//         if (converter == null ) {
//             throw new IllegalArgumentException("Converter == null");
//         }
//         outputConverters.add(converter);
//     }
// 
//     public boolean removeConverter(OutputConverter converter) {
//         return outputConverters.remove(converter);
//     }
// 
//     public Object convertOutput(Object anObject) {
//         Object convertedOutput = anObject;
//         for (ListIterator<OutputConverter> it = outputConverters.listIterator(outputConverters.size()); it.hasPrevious();) {
//             OutputConverter outputConverter = it.previous(); // last in --- first called.
//             Object conversionResult = outputConverter.convertOutput(convertedOutput);
//             if (conversionResult != null) {
//                 convertedOutput = conversionResult;
//             }
//         }
//         return convertedOutput;
//     }
// 
//     public void addDeclaredConverters(Object handler) {
//         Field[] fields = handler.getClass().getFields();
//         final String PREFIX = "CLI_OUTPUT_CONVERTERS";
//         for (Field field : fields) {
//             if (field.getName().startsWith(PREFIX)
//                     && field.getType().isArray()
//                     && OutputConverter.class.isAssignableFrom(field.getType().getComponentType())) {
//                 try {
//                     Object convertersArray = field.get(handler);
//                     for (int i = 0; i < Array.getLength(convertersArray); i++) {
//                         addConverter((OutputConverter)Array.get(convertersArray, i));
//                     }
//                 } catch (Exception ex) {
//                     throw new RuntimeException("Error getting converter from field " + field.getName(), ex);
//                 }
//             }
//         }
//     }
// 
// 
// }
// 
// Path: src/main/java/com/budhash/cliche/OutputConverter.java
// public interface OutputConverter {
//     /**
//      * Object-to--user-friendly-object (usually string) conversion method.
//      * The method must check argument's class, since it will be fed virtually all
//      * returned objects. Simply return null when not sure.
//      * @param toBeFormatted Object to be displayed to the user
//      * @return Object representing the object or Null if don't know how to make it.
//      *         Do not return default toString() !!
//      */
//     Object convertOutput(Object toBeFormatted);
// }


// Path: src/test/java/com/budhash/cliche/OutputConversionEngineTest.java
import org.junit.Before;
import org.junit.Test;
import com.budhash.cliche.OutputConversionEngine;
import com.budhash.cliche.OutputConverter;
import static org.junit.Assert.*;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.budhash.cliche;




/**
 *
 * @author ASG
 */
public class OutputConversionEngineTest {

    @Before
    public void setUp() {
        converter = new OutputConversionEngine();