// Path: src/main/java/com/rmn/qa/task/AbstractAutomationCleanupTask.java
// public abstract class AbstractAutomationCleanupTask extends Thread {
// 
//     private static final Logger log = LoggerFactory.getLogger(AbstractAutomationCleanupTask.class);
// 
//     protected RegistryRetriever registryRetriever;
//     private Throwable t;
// 
//     public AbstractAutomationCleanupTask(RegistryRetriever registryRetriever) {
//         this.registryRetriever = registryRetriever;
//     }
// 
//     @Override
//     public void run() {
//         try{
//             this.doWork();
//         }catch(Throwable t) {
//             this.t = t;
//             log.error(String.format("Error executing cleanup thread [%s]: %s", getDescription(), t), t);
//         }
//     }
// 
//     /**
//      * Performs the work of the task
//      */
//     public abstract void doWork();
// 
//     /**
//      * Returns the description of the task
//      * @return
//      */
//     public abstract String getDescription();
// 
//     /**
//      * Returns the exception of this task if any was encountered
//      * @return
//      */
//     public Throwable getThrowable() {
//         return t;
//     }
// 
// }


import org.junit.Test;
import com.rmn.qa.task.AbstractAutomationCleanupTask;
import junit.framework.Assert;
/*
 * Copyright (C) 2014 RetailMeNot, Inc.
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 */

package com.rmn.qa;


/**
 * Created by mhardin on 4/25/14.
 */
public class AbstractAutomationCleanupTaskTest {

    @Test
    public void testExceptionHandled() {
        TestTask task = new TestTask(null);
        task.run();
        Assert.assertEquals("Correct exception should have been thrown",task.getThrowable(),task.re);
    }

// Path: src/main/java/com/rmn/qa/task/AbstractAutomationCleanupTask.java
// public abstract class AbstractAutomationCleanupTask extends Thread {
// 
//     private static final Logger log = LoggerFactory.getLogger(AbstractAutomationCleanupTask.class);
// 
//     protected RegistryRetriever registryRetriever;
//     private Throwable t;
// 
//     public AbstractAutomationCleanupTask(RegistryRetriever registryRetriever) {
//         this.registryRetriever = registryRetriever;
//     }
// 
//     @Override
//     public void run() {
//         try{
//             this.doWork();
//         }catch(Throwable t) {
//             this.t = t;
//             log.error(String.format("Error executing cleanup thread [%s]: %s", getDescription(), t), t);
//         }
//     }
// 
//     /**
//      * Performs the work of the task
//      */
//     public abstract void doWork();
// 
//     /**
//      * Returns the description of the task
//      * @return
//      */
//     public abstract String getDescription();
// 
//     /**
//      * Returns the exception of this task if any was encountered
//      * @return
//      */
//     public Throwable getThrowable() {
//         return t;
//     }
// 
// }


// Path: src/test/java/com/rmn/qa/AbstractAutomationCleanupTaskTest.java
import org.junit.Test;
import com.rmn.qa.task.AbstractAutomationCleanupTask;
import junit.framework.Assert;

/*
 * Copyright (C) 2014 RetailMeNot, Inc.
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 */

package com.rmn.qa;


/**
 * Created by mhardin on 4/25/14.
 */
public class AbstractAutomationCleanupTaskTest {

    @Test
    public void testExceptionHandled() {
        TestTask task = new TestTask(null);
        task.run();
        Assert.assertEquals("Correct exception should have been thrown",task.getThrowable(),task.re);
    }

    private static class TestTask extends AbstractAutomationCleanupTask {