diff --git a/.classpath b/.classpath new file mode 100644 index 00000000..e230ae57 --- /dev/null +++ b/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 00000000..d1b45046 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + poolobject + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/README.md b/README.md index 4078dc6e..2e082eeb 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,9 @@ poolobject Java code example of design creational pattern pool object Example to apply good practise in software developmemnt: test and mesurement. + +Jesús Manuel Calvo Ruiz de Temiño + +Ignacio Aparicio Blanco + +Yeray Sardón Ibañez \ No newline at end of file diff --git a/src/test/ubu/gii/dass/test/c01/ReusablePoolTest.java b/src/test/ubu/gii/dass/test/c01/ReusablePoolTest.java index ae9b0d18..d70b7e0c 100644 --- a/src/test/ubu/gii/dass/test/c01/ReusablePoolTest.java +++ b/src/test/ubu/gii/dass/test/c01/ReusablePoolTest.java @@ -5,21 +5,36 @@ import static org.junit.Assert.*; +import java.lang.reflect.Array; + import org.junit.After; import org.junit.Before; import org.junit.Test; +import ubu.gii.dass.c01.Client; +import ubu.gii.dass.c01.DuplicatedInstanceException; +import ubu.gii.dass.c01.NotFreeInstanceException; +import ubu.gii.dass.c01.Reusable; +import ubu.gii.dass.c01.ReusablePool; + /** * @author alumno * */ public class ReusablePoolTest { + + /** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { + + + + + } /** @@ -34,7 +49,9 @@ public void tearDown() throws Exception { */ @Test public void testGetInstance() { - fail("Not yet implemented"); + ReusablePool pool = ReusablePool.getInstance(); + assert(pool==ReusablePool.getInstance()); + } /** @@ -42,7 +59,17 @@ public void testGetInstance() { */ @Test public void testAcquireReusable() { - fail("Not yet implemented"); + ReusablePool RPool=ReusablePool.getInstance(); + int cont=10; + while(cont>0) { + try{ + RPool.acquireReusable(); + + }catch(NotFreeInstanceException ex){ + assert(true); + } + cont--; + } } /** @@ -50,7 +77,20 @@ public void testAcquireReusable() { */ @Test public void testReleaseReusable() { - fail("Not yet implemented"); + ReusablePool RPool=ReusablePool.getInstance(); + Reusable r = new Reusable(); + Reusable a = new Reusable(); + int cont=3; + while(cont>0) { + try { + RPool.releaseReusable(r); + RPool.releaseReusable(a); + } catch (DuplicatedInstanceException e) { + // TODO Auto-generated catch block + assert(true); + } + cont--; + } } }