diff --git a/Lab00App-build/Lab00App-code/src/main/java/ch/heigvd/res/lab00/Application.java b/Lab00App-build/Lab00App-code/src/main/java/ch/heigvd/res/lab00/Application.java index 63b4a00..d123d5d 100644 --- a/Lab00App-build/Lab00App-code/src/main/java/ch/heigvd/res/lab00/Application.java +++ b/Lab00App-build/Lab00App-code/src/main/java/ch/heigvd/res/lab00/Application.java @@ -29,7 +29,7 @@ public String getMessage() { } public int add(int a, int b) { - return a * b; + return a + b; } } diff --git a/Lab00App-build/Lab00App-code/src/main/java/ch/heigvd/res/lab00/Flute.java b/Lab00App-build/Lab00App-code/src/main/java/ch/heigvd/res/lab00/Flute.java new file mode 100644 index 0000000..a5ed029 --- /dev/null +++ b/Lab00App-build/Lab00App-code/src/main/java/ch/heigvd/res/lab00/Flute.java @@ -0,0 +1,31 @@ +/* + * 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; + +/** + * + * @author GuillaumeBlanco + */ +public class Flute implements IInstrument{ + + + + public int getSoundVolume(){ + return 5; + } + + public String getColor(){ + return "grey"; + } + + public String play(){ + return "tut"; + } + + + + +} diff --git a/Lab00App-build/Lab00App-code/src/main/java/ch/heigvd/res/lab00/IInstrument.java b/Lab00App-build/Lab00App-code/src/main/java/ch/heigvd/res/lab00/IInstrument.java new file mode 100644 index 0000000..d5d1848 --- /dev/null +++ b/Lab00App-build/Lab00App-code/src/main/java/ch/heigvd/res/lab00/IInstrument.java @@ -0,0 +1,22 @@ +/* + * 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; + +/** + * + * @author GuillaumeBlanco + */ +public interface IInstrument { + + public int getSoundVolume(); + + public String getColor(); + + public String play(); + + + +} diff --git a/Lab00App-build/Lab00App-code/src/main/java/ch/heigvd/res/lab00/Trumpet.java b/Lab00App-build/Lab00App-code/src/main/java/ch/heigvd/res/lab00/Trumpet.java new file mode 100644 index 0000000..e6b5c29 --- /dev/null +++ b/Lab00App-build/Lab00App-code/src/main/java/ch/heigvd/res/lab00/Trumpet.java @@ -0,0 +1,30 @@ +/* + * 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; + +/** + * + * @author GuillaumeBlanco + */ +public class Trumpet implements IInstrument{ + + + public int getSoundVolume(){ + return 10; + } + + public String getColor(){ + return "golden"; + } + + public String play(){ + return "pouet"; + } + + + + +} diff --git a/Lab00App-build/Lab00App-tests/src/test/java/ch/heigvd/res/lab00/TrumpetTest.java b/Lab00App-build/Lab00App-tests/src/test/java/ch/heigvd/res/lab00/TrumpetTest.java index c5953b5..bdb3f84 100644 --- a/Lab00App-build/Lab00App-tests/src/test/java/ch/heigvd/res/lab00/TrumpetTest.java +++ b/Lab00App-build/Lab00App-tests/src/test/java/ch/heigvd/res/lab00/TrumpetTest.java @@ -15,7 +15,7 @@ */ public class TrumpetTest { - /* + @Test public void thereShouldBeAnIInstrumentInterfaceAndATrumpetClass() { IInstrument trumpet = new Trumpet(); @@ -51,6 +51,6 @@ public void aTrumpetShouldBeGolden() { String color = trumpet.getColor(); Assert.assertEquals("golden", color); } - */ + } diff --git a/Lab00App-build/Lab00App-tests/test-results.json b/Lab00App-build/Lab00App-tests/test-results.json index 7bda462..b9365e2 100644 --- a/Lab00App-build/Lab00App-tests/test-results.json +++ b/Lab00App-build/Lab00App-tests/test-results.json @@ -1 +1 @@ -{"ignoreCount":0,"failures":[{"message":"expected:<42> but was:<80>","exception":{"cause":null,"stackTrace":[{"methodName":"fail","fileName":"Assert.java","lineNumber":88,"className":"org.junit.Assert","nativeMethod":false},{"methodName":"failNotEquals","fileName":"Assert.java","lineNumber":834,"className":"org.junit.Assert","nativeMethod":false},{"methodName":"assertEquals","fileName":"Assert.java","lineNumber":645,"className":"org.junit.Assert","nativeMethod":false},{"methodName":"assertEquals","fileName":"Assert.java","lineNumber":631,"className":"org.junit.Assert","nativeMethod":false},{"methodName":"thereShouldBeAMethodToAddIntegers","fileName":"ApplicationTest.java","lineNumber":53,"className":"ch.heigvd.res.lab00.ApplicationTest","nativeMethod":false},{"methodName":"invoke0","fileName":"NativeMethodAccessorImpl.java","lineNumber":-2,"className":"sun.reflect.NativeMethodAccessorImpl","nativeMethod":true},{"methodName":"invoke","fileName":"NativeMethodAccessorImpl.java","lineNumber":62,"className":"sun.reflect.NativeMethodAccessorImpl","nativeMethod":false},{"methodName":"invoke","fileName":"DelegatingMethodAccessorImpl.java","lineNumber":43,"className":"sun.reflect.DelegatingMethodAccessorImpl","nativeMethod":false},{"methodName":"invoke","fileName":"Method.java","lineNumber":497,"className":"java.lang.reflect.Method","nativeMethod":false},{"methodName":"runReflectiveCall","fileName":"FrameworkMethod.java","lineNumber":50,"className":"org.junit.runners.model.FrameworkMethod$1","nativeMethod":false},{"methodName":"run","fileName":"ReflectiveCallable.java","lineNumber":12,"className":"org.junit.internal.runners.model.ReflectiveCallable","nativeMethod":false},{"methodName":"invokeExplosively","fileName":"FrameworkMethod.java","lineNumber":47,"className":"org.junit.runners.model.FrameworkMethod","nativeMethod":false},{"methodName":"evaluate","fileName":"InvokeMethod.java","lineNumber":17,"className":"org.junit.internal.runners.statements.InvokeMethod","nativeMethod":false},{"methodName":"runLeaf","fileName":"ParentRunner.java","lineNumber":325,"className":"org.junit.runners.ParentRunner","nativeMethod":false},{"methodName":"runChild","fileName":"BlockJUnit4ClassRunner.java","lineNumber":78,"className":"org.junit.runners.BlockJUnit4ClassRunner","nativeMethod":false},{"methodName":"runChild","fileName":"BlockJUnit4ClassRunner.java","lineNumber":57,"className":"org.junit.runners.BlockJUnit4ClassRunner","nativeMethod":false},{"methodName":"run","fileName":"ParentRunner.java","lineNumber":290,"className":"org.junit.runners.ParentRunner$3","nativeMethod":false},{"methodName":"schedule","fileName":"ParentRunner.java","lineNumber":71,"className":"org.junit.runners.ParentRunner$1","nativeMethod":false},{"methodName":"runChildren","fileName":"ParentRunner.java","lineNumber":288,"className":"org.junit.runners.ParentRunner","nativeMethod":false},{"methodName":"access$000","fileName":"ParentRunner.java","lineNumber":58,"className":"org.junit.runners.ParentRunner","nativeMethod":false},{"methodName":"evaluate","fileName":"ParentRunner.java","lineNumber":268,"className":"org.junit.runners.ParentRunner$2","nativeMethod":false},{"methodName":"run","fileName":"ParentRunner.java","lineNumber":363,"className":"org.junit.runners.ParentRunner","nativeMethod":false},{"methodName":"execute","fileName":"JUnit4Provider.java","lineNumber":264,"className":"org.apache.maven.surefire.junit4.JUnit4Provider","nativeMethod":false},{"methodName":"executeTestSet","fileName":"JUnit4Provider.java","lineNumber":153,"className":"org.apache.maven.surefire.junit4.JUnit4Provider","nativeMethod":false},{"methodName":"invoke","fileName":"JUnit4Provider.java","lineNumber":124,"className":"org.apache.maven.surefire.junit4.JUnit4Provider","nativeMethod":false},{"methodName":"invokeProviderInSameClassLoader","fileName":"ForkedBooter.java","lineNumber":200,"className":"org.apache.maven.surefire.booter.ForkedBooter","nativeMethod":false},{"methodName":"runSuitesInProcess","fileName":"ForkedBooter.java","lineNumber":153,"className":"org.apache.maven.surefire.booter.ForkedBooter","nativeMethod":false},{"methodName":"main","fileName":"ForkedBooter.java","lineNumber":103,"className":"org.apache.maven.surefire.booter.ForkedBooter","nativeMethod":false}],"message":"expected:<42> but was:<80>","localizedMessage":"expected:<42> but was:<80>","suppressed":[]},"trace":"java.lang.AssertionError: expected:<42> but was:<80>\n\tat org.junit.Assert.fail(Assert.java:88)\n\tat org.junit.Assert.failNotEquals(Assert.java:834)\n\tat org.junit.Assert.assertEquals(Assert.java:645)\n\tat org.junit.Assert.assertEquals(Assert.java:631)\n\tat ch.heigvd.res.lab00.ApplicationTest.thereShouldBeAMethodToAddIntegers(ApplicationTest.java:53)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:497)\n\tat org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)\n\tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)\n\tat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)\n\tat org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)\n\tat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)\n\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)\n\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:363)\n\tat org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)\n\tat org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)\n\tat org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)\n\tat org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)\n\tat org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)\n\tat org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)\n","testHeader":"thereShouldBeAMethodToAddIntegers(ch.heigvd.res.lab00.ApplicationTest)","description":{"empty":false,"annotations":[{}],"className":"ch.heigvd.res.lab00.ApplicationTest","methodName":"thereShouldBeAMethodToAddIntegers","displayName":"thereShouldBeAMethodToAddIntegers(ch.heigvd.res.lab00.ApplicationTest)","testClass":"ch.heigvd.res.lab00.ApplicationTest","suite":false,"test":true,"children":[]}}],"runTime":97,"runCount":5,"failureCount":1} \ No newline at end of file +{"ignoreCount":0,"failures":[],"runTime":39,"failureCount":0,"runCount":5} \ No newline at end of file