Skip to content

Commit

Permalink
feat(qmp): new Recomendador
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasanchez committed Apr 28, 2021
1 parent 86d7886 commit 27789cd
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
39 changes: 39 additions & 0 deletions 01-lecture/quemepongo/src/main/java/quemepongo/Recomendador.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package quemepongo;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
* Recomendador de uniformes
*
* @since 04.28.2021
* @version 1.0
*/
public class Recomendador {

/**
* Listado de modistas actuales.
*
* @since 1.0
*/
private List<Modista> modistas;

/**
* Instancia un recomendador con los modistas Jhonson y San Juan
*/
public Recomendador() {
modistas = new ArrayList<Modista>();
modistas.add(new ModistaJhonson());
modistas.add(new ModistaSanJuan());
}

/**
* Recomienda un uniforme a un usuario.
*
* @return un Uniforme de alguno de los modistas
*/
public Uniforme recomendarUniforme() {
return modistas.get(new Random().nextInt(modistas.size())).fabricarUniforme();
}
}
6 changes: 4 additions & 2 deletions 01-lecture/quemepongo/src/test/java/quemepongo/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

/**
* Unit test for simple App.
Expand All @@ -13,6 +13,8 @@ class AppTest {
*/
@Test
void testApp() {
assertEquals(1, 1);
assertDoesNotThrow(() -> {
new Recomendador().recomendarUniforme();
}, "Error");
}
}

0 comments on commit 27789cd

Please sign in to comment.