Advertisement
PedroPauloFO

MinhaCDtecaTest

Nov 20th, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.44 KB | None | 0 0
  1. package lp2.lab06;
  2.  
  3. import org.junit.Assert;
  4. import org.junit.Before;
  5. import org.junit.Test;
  6.  
  7. public class MinhaCDtecaTest {
  8.     CD cd1 = null;
  9.     CD cd2 = null;
  10.     CD cd3 = null;
  11.     CD cd4 = null;
  12.    
  13.     @Before
  14.     public void criaCDtecas(){
  15.         criaCDs();
  16.        
  17.         MinhaCDteca colec1 = new MinhaCDteca();
  18.         colec1.adicionaCD(cd1);
  19.         colec1.adicionaCD(cd2);
  20.         colec1.adicionaCD(cd3);
  21.        
  22.         MinhaCDteca colec2 = new MinhaCDteca();
  23.         colec2.adicionaCD(cd1);
  24.         colec2.adicionaCD(cd3);
  25.        
  26.         MinhaCDteca colec3 = new MinhaCDteca();
  27.         colec3.adicionaCD(cd2);
  28.         colec3.adicionaCD(cd4);
  29.        
  30.         MinhaCDteca colec4 = new MinhaCDteca();
  31.         colec4.adicionaCD(cd1);
  32.         colec4.adicionaCD(cd3);
  33.        
  34.     }
  35.    
  36.     private void criaCDs(){
  37.         cd1 = new CD("CD 01", "Cantor tal");
  38.         cd2 = new CD("CD 02", "Cantora tal", 21);
  39.         cd3 = new CD("CD 03", "Ivete");
  40.         cd4 = new CD("CD 04", "Joelma", 15);
  41.        
  42.         try{
  43.             cd1.cadastraFaixa("Faixa 0");
  44.         }catch(Exception e){
  45.             System.err.print(e);
  46.         }
  47.         try{
  48.             cd1.cadastraFaixa("Faixa 1");
  49.         }catch(Exception e){
  50.             System.err.print(e);
  51.         }
  52.        
  53.         try{
  54.             cd3.cadastraFaixa("Alegria");
  55.         }catch(Exception e){
  56.             System.err.print(e);
  57.         }
  58.        
  59.         try{
  60.             cd1.mudaMusicaPrincipal("Faixa 1");
  61.         }catch(Exception e){
  62.             System.err.print(e);
  63.         }
  64.        
  65.         try{
  66.             cd3.mudaMusicaPrincipal("Alegria");
  67.         }catch(Exception e){
  68.             System.err.print(e);
  69.         }
  70.     }
  71.  
  72.     @Test
  73.     public void test() {
  74.         System.out.println(nova + "fim");
  75.     }
  76.  
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement