/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package doublex.lib.lockableContainers;

/**
 *
 * @author kenneth.lau
 * @param <C>
 * @param <K>
 */
public final class UnitTestedLockableContainer<C, K> {

    private final LockableContainer<C, K> mLockableContainer;

    public UnitTestedLockableContainer(
            final LockableContainer<C, K> lockableContainer) {
        mLockableContainer = lockableContainer;
    }

    public final void tryPutContents(final C contents) {
        System.out.println(
                "UnitTestedLockableContainer tryPutContents contents: " + 
                        contents);
        mLockableContainer.tryPutContents(contents);
    }

    public final C tryTakeContents() {
        final C contents = mLockableContainer.tryTakeContents();
        System.out.println("UnitTestedLockableContainer tryTakeContents");
        if (mLockableContainer.mLocks.isLocked() && contents != null) {
            System.out.println("Failed! Actual value: " + contents);
        } else {
            System.out.println(
                    "At least nothing can be taken from a locked container!");
        }
        return contents;
    }

}

@@ -241,19 +241,15 @@
 hor 
-kenneth.lau
+DoubleX
 %0A * 
@@ -830,21 +830,24 @@
 nal C tr
-y
+ied
 Take
+n
 Contents
@@ -899,21 +899,24 @@
 ainer.tr
-y
+ied
 Take
+n
 Contents
@@ -981,13 +981,16 @@
 r tr
-y
+ied
 Take
+n
 Cont

Update UnitTestedLockableContainer.java