Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fb harmonica #86

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package ch.heigvd.res.lab00;

/*
-----------------------------------------------------------------------------------
Laboratoire : 00
Fichier : Harmonica.java
Auteur(s) : Labinot Rashiti
Date : 02.03.2018

But : Fichier contenant la classe Harmonica

Remarque(s) : Implémente l'interface IInstrument

Compilateur : jdk1.8.0_144
-----------------------------------------------------------------------------------
*/

public class Harmonica implements IInstrument {
public Harmonica() {

}

public String play() {
return "touet";
}

@Override
public int getSoundVolume() {
return 7;
}

@Override
public String getColor() {
return "silver";
}




}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package ch.heigvd.res.lab00;

import org.junit.Assert;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;

/**
* *** IMPORTANT WARNING : DO NOT EDIT THIS FILE ***
*
* This file is used to specify what you have to implement. To check your work,
* we will run our own copy of the automated tests. If you change this file,
* then you will introduce a change of specification!!!
*
* @author Labinot Rashiti
*/
public class HarmonicaTest {


@Test
public void thereShouldBeAnIInstrumentInterfaceAndAHarmonicaClass() {
IInstrument harmonica = new Harmonica();
assertNotNull(harmonica);
}

@Test
public void itShouldBePossibleToPlayAnInstrument() {
IInstrument harmonica = new Harmonica();
String sound = harmonica.play();
assertNotNull(sound);
}

@Test
public void aHarmonicaShouldMakeTouet() {
IInstrument harmonica = new Harmonica();
String sound = harmonica.play();
Assert.assertEquals("touet", sound);
}

@Test
public void aHarmonicaShouldBeLouderThanAFlute() {
IInstrument harmonica = new Harmonica();
IInstrument flute = new Flute();
int harmonicaVolume = harmonica.getSoundVolume();
int fluteVolume = flute.getSoundVolume();
Assert.assertTrue(harmonicaVolume > fluteVolume);
}

@Test
public void aHarmonicaShouldBeSilver() {
IInstrument harmonica = new Harmonica();
String color = harmonica.getColor();
Assert.assertEquals("silver", color);
}


}