/**
* Write a description of class TestMusicOrganizer here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class TestMusicOrganizer
{
public static void testCountLoveSongs() {
System.out.println("Testing countLoveSongs");
MusicOrganizer mo = new MusicOrganizer();
mo.addFile("First");
mo.addFile("Firstlove");
mo.addFile("Blah");
mo.addFile("LoVERboy");
mo.addFile("I love rock and roll");
mo.addFile("lavender");
int numLoveSongs = mo.countLoveSongs();
if(numLoveSongs!=3) {
System.out.println("Number of love songs was "+numLoveSongs+
" but should have been 3");
}
}
public static void testhasChristmasSong() {
System.out.println("Testing hasChristmasSong");
MusicOrganizer mo = new MusicOrganizer();
mo.addFile("First");
mo.addFile("Firstlove");
mo.addFile("Blah");
mo.addFile("LoVERboy");
mo.addFile("I love rock and roll");
mo.addFile("lavender");
if(mo.hasChristmasSong()) {
System.out.println("hasChristmasSong returned true but should have been false");
}
if(mo.hasChristmasSong2()) {
System.out.println("hasChristmasSong2 returned true but should have been false");
}
mo.addFile("A CHristmas song");
mo.addFile("LoVERboy2");
mo.addFile("Foo");
if(!mo.hasChristmasSong()) {
System.out.println("hasChristmasSong returned false but should have been true");
}
if(!mo.hasChristmasSong2()) {
System.out.println("hasChristmasSong2 returned false but should have been true");
}
}
public static void testBahHumbug() {
System.out.println("Testing bahHumbug");
MusicOrganizer mo = new MusicOrganizer();
mo.addFile("First");
mo.addFile("Firstlove");
mo.addFile("Christmas Time is here");
mo.addFile("Blah");
mo.addFile("LoVERboy");
mo.addFile("White Christmas");
mo.addFile("Another crappy White Christmas");
mo.addFile("I love rock and roll");
mo.addFile("lavender");
mo.addFile("A CHristmas song");
mo.addFile("LoVERboy2");
mo.addFile("Foo");
mo.bahHumbug3();
if(mo.getNumberOfFiles()!=8) {
System.out.println("There should be 8 songs left, but there are "
+mo.getNumberOfFiles());
}
}
}