// Path: Bindroid/src/com/bindroid/utils/Action.java
// public interface Action<T> {
//   /**
//    * The method to invoke.
//    * 
//    * @param parameter
//    *          the parameter to the action.
//    */
//   void invoke(T parameter);
// }
// 
// Path: Bindroid/src/com/bindroid/utils/GarbageCollectionListener.java
// public final class GarbageCollectionListener {
//   private static List<Action<Void>> listeners;
// 
//   static {
//     GarbageCollectionListener.listeners = new LinkedList<Action<Void>>();
//     new WeakReference<GarbageCollectionListener>(new GarbageCollectionListener());
//   }
// 
//   /**
//    * Adds a listener for garbage collections.
//    *
//    * @param action the method to call whenever a garbage collection is detected.
//    */
//   public static synchronized void addListener(Action<Void> action) {
//     synchronized (listeners) {
//       GarbageCollectionListener.listeners.add(action);
//     }
//   }
// 
//   private static synchronized void notifyListeners() {
//     synchronized (listeners) {
//       for (Action<Void> l : new LinkedList<Action<Void>>(GarbageCollectionListener.listeners)) {
//         try {
//           l.invoke(null);
//         } catch (Exception e) {
//         }
//       }
//       new WeakReference<GarbageCollectionListener>(new GarbageCollectionListener());
//     }
//   }
// 
//   /**
//    * Removes a listener for garbage collections.
//    *
//    * @param action the action to remove.
//    */
//   public static synchronized void removeListener(Action<Void> action) {
//     synchronized (listeners) {
//       GarbageCollectionListener.listeners.remove(action);
//     }
//   }
// 
//   private GarbageCollectionListener() {
//   }
// 
//   @Override
//   protected void finalize() throws Throwable {
//     GarbageCollectionListener.notifyListeners();
//     super.finalize();
//   }
// }


import java.util.concurrent.atomic.AtomicBoolean;
import junit.framework.TestCase;
import com.bindroid.utils.Action;
import com.bindroid.utils.GarbageCollectionListener;
package com.bindroid.test;




public class GarbageCollectionListenerTest extends TestCase {
  public void testNotification() throws Exception {
    final Object lock = new Object();
    final AtomicBoolean bool = new AtomicBoolean(false);
    synchronized (lock) {
// Path: Bindroid/src/com/bindroid/utils/Action.java
// public interface Action<T> {
//   /**
//    * The method to invoke.
//    * 
//    * @param parameter
//    *          the parameter to the action.
//    */
//   void invoke(T parameter);
// }
// 
// Path: Bindroid/src/com/bindroid/utils/GarbageCollectionListener.java
// public final class GarbageCollectionListener {
//   private static List<Action<Void>> listeners;
// 
//   static {
//     GarbageCollectionListener.listeners = new LinkedList<Action<Void>>();
//     new WeakReference<GarbageCollectionListener>(new GarbageCollectionListener());
//   }
// 
//   /**
//    * Adds a listener for garbage collections.
//    *
//    * @param action the method to call whenever a garbage collection is detected.
//    */
//   public static synchronized void addListener(Action<Void> action) {
//     synchronized (listeners) {
//       GarbageCollectionListener.listeners.add(action);
//     }
//   }
// 
//   private static synchronized void notifyListeners() {
//     synchronized (listeners) {
//       for (Action<Void> l : new LinkedList<Action<Void>>(GarbageCollectionListener.listeners)) {
//         try {
//           l.invoke(null);
//         } catch (Exception e) {
//         }
//       }
//       new WeakReference<GarbageCollectionListener>(new GarbageCollectionListener());
//     }
//   }
// 
//   /**
//    * Removes a listener for garbage collections.
//    *
//    * @param action the action to remove.
//    */
//   public static synchronized void removeListener(Action<Void> action) {
//     synchronized (listeners) {
//       GarbageCollectionListener.listeners.remove(action);
//     }
//   }
// 
//   private GarbageCollectionListener() {
//   }
// 
//   @Override
//   protected void finalize() throws Throwable {
//     GarbageCollectionListener.notifyListeners();
//     super.finalize();
//   }
// }


// Path: BindroidTest/src/com/bindroid/test/GarbageCollectionListenerTest.java
import java.util.concurrent.atomic.AtomicBoolean;
import junit.framework.TestCase;
import com.bindroid.utils.Action;
import com.bindroid.utils.GarbageCollectionListener;

package com.bindroid.test;




public class GarbageCollectionListenerTest extends TestCase {
  public void testNotification() throws Exception {
    final Object lock = new Object();
    final AtomicBoolean bool = new AtomicBoolean(false);
    synchronized (lock) {
      GarbageCollectionListener.addListener(new Action<Void>() {