Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/test"/>
<classpathentry kind="src" path="src/main"/>
<classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/>
<classpathentry kind="lib" path="lib/jacocoant.jar"/>
<classpathentry kind="lib" path="lib/junit-4.12.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>poolobject</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
46 changes: 43 additions & 3 deletions src/test/ubu/gii/dass/test/c01/ReusablePoolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {





}

/**
Expand All @@ -34,23 +49,48 @@ public void tearDown() throws Exception {
*/
@Test
public void testGetInstance() {
fail("Not yet implemented");
ReusablePool pool = ReusablePool.getInstance();
assert(pool==ReusablePool.getInstance());

}

/**
* Test method for {@link ubu.gii.dass.c01.ReusablePool#acquireReusable()}.
*/
@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--;
}
}

/**
* Test method for {@link ubu.gii.dass.c01.ReusablePool#releaseReusable(ubu.gii.dass.c01.Reusable)}.
*/
@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--;
}
}

}