Advertisement
Guest User

meh

a guest
Jun 19th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1. package dominio;
  2.  
  3. import org.junit.After;
  4. import org.junit.Before;
  5. import org.junit.Test;
  6. import static org.junit.Assert.*;
  7.  
  8. /**
  9. *
  10. * @author bueda
  11. */
  12. public class QuizTest {
  13. Quiz quiz;
  14. Sistema sistema;
  15.  
  16. public QuizTest() {
  17. }
  18.  
  19. @Before
  20. public void setUp() {
  21. this.sistema = new Sistema();
  22. this.quiz = new Quiz(sistema);
  23. }
  24.  
  25. @After
  26. public void tearDown() {
  27. }
  28.  
  29. @Test
  30. public void testAgregarRespuestaCorrectaOIncorrecta(){
  31. this.quiz.agregarRespuestaCorrectaOIncorrecta(true);
  32. assertTrue(this.quiz.getListaRespuestaCorrectaOIncorrecta().get(0));
  33. }
  34.  
  35. @Test
  36. public void testCargarDatosDelGiftTextoPreguntaVerdaderoOFalso(){
  37. this.quiz.cargarDatosDelGift("src/rutasRelativas/TextoPruebaVerdaderoOFalso.txt");
  38. assertEquals("Grant fue sepultado en una tumba en la ciudad de Nueva York.",sistema.getListaPreguntas().get(0).getStringPregunta());
  39. }
  40.  
  41. @Test
  42. public void testCargarDatosDelGiftTextoPreguntaMultipleOpcion(){
  43. this.quiz.cargarDatosDelGift("src/rutasRelativas/TextoPruebaMultipleOpcion.txt");
  44. assertEquals("Quién esta enterrado en la tumba de Grant en la Ciudad de Nueva York?",sistema.getListaPreguntas().get(0).getStringPregunta());
  45. }
  46.  
  47. @Test
  48. public void testCargarDatosDelGiftTextoPreguntaRespuestaCorta(){
  49. this.quiz.cargarDatosDelGift("src/rutasRelativas/TextoPruebaRespuestaCorta.txt");
  50. assertEquals("Quien esta sepultado en la tumba de Grant?",sistema.getListaPreguntas().get(0).getStringPregunta());
  51. }
  52.  
  53. @Test
  54. public void testEsRespuestaCorrecta(){
  55. this.quiz.cargarDatosDelGift("src/rutasRelativas/TextoPruebaRespuestaCorta.txt");
  56. boolean esCorrecta = this.quiz.esRespuestaCorrecta("Grant",0);
  57. assertTrue(esCorrecta);
  58. }
  59.  
  60. @Test
  61. public void testCantidadRespuestasCorrectas(){
  62. quiz.agregarRespuestaCorrectaOIncorrecta(true);
  63. int numeroPrueba = this.quiz.cantidadRespuestasCorrectas();
  64. assertEquals(1,numeroPrueba);
  65. }
  66.  
  67. @Test
  68. public void testConstructor(){
  69. Pregunta pregunta = new Pregunta(1,"2 + 2?", 30);
  70. this.sistema.agregarPregunta(pregunta);
  71. this.quiz = new Quiz(sistema);
  72. assertEquals(1,pregunta.getTipo());
  73. }
  74.  
  75. @Test
  76. public void testSinTiempo(){
  77. boolean resultado = this.quiz.cargarDatosDelGift("src/rutasRelativas/TextoPruebaSinTiempo.txt");
  78. assertTrue(resultado);
  79. }
  80.  
  81. @Test
  82. public void testSinTipo(){
  83. boolean resultado = this.quiz.cargarDatosDelGift("src/rutasRelativas/TextoPruebaSinTipo.txt");
  84. assertTrue(!resultado);
  85. }
  86.  
  87. @Test
  88. public void testSinCorchete(){
  89. boolean resultado = this.quiz.cargarDatosDelGift("src/rutasRelativas/TextoPruebaSin{.txt");
  90. assertTrue(!resultado);
  91. }
  92.  
  93. @Test
  94. public void testMasRespuestasQueElMax(){
  95. boolean resultado = this.quiz.cargarDatosDelGift("src/rutasRelativas/TextoPruebaMasDe6RespuestasMultipleOpcion.txt");
  96. assertTrue(!resultado);
  97. }
  98.  
  99. @Test
  100. public void testTextoPruebaSinCorrectaNiIncorrecta(){
  101. boolean resultado = this.quiz.cargarDatosDelGift("src/rutasRelativas/TextoPruebaSinCorrectaNiIncorrecta.txt");
  102. assertTrue(!resultado);
  103. }
  104.  
  105. @Test
  106. public void testTextoPruebaMasDe5RespuestasCorrectasRespuestaCorta(){
  107. boolean resultado = this.quiz.cargarDatosDelGift("src/rutasRelativas/TextoPruebaMasDe5RespuestasCorrectasRespuestaCorta.txt");
  108. assertTrue(!resultado);
  109. }
  110.  
  111. @Test
  112. public void testTextoPruebaMasDeUnaRespuestaCorrectaVerdaderoOFalso(){
  113. boolean resultado = this.quiz.cargarDatosDelGift("src/rutasRelativas/TextoPruebaMasDeUnaRespuestaCorrectaVerdaderoOFalso.txt");
  114. assertTrue(!resultado);
  115. }
  116.  
  117. @Test
  118. public void testTextoPruebaTiempoIncorrecto(){
  119. this.quiz.cargarDatosDelGift("src/rutasRelativas/TextoPruebaTiempoIncorrecto.txt");
  120. assertTrue(true);
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement