1
0
Fork 0

Add prototype of swapTwoLast, add unitary test swapTwoLastTest and add some JavaDoc

This commit is contained in:
Ethanell 2020-04-14 11:41:13 +02:00
parent 092d080cdf
commit 50e9e5e219
3 changed files with 25 additions and 0 deletions

View file

@ -3,3 +3,4 @@
## Exercice 1
* Création de la classe principale `CVDATPJUnit` et de sa classe de test `CVDATPJUnitTest` tous deux vides
* Prototype de la méthode `swapTwoLast`, elle est statique car elle nas pas besoin dattributs de la classe. Ajout des test unitaires `swapTwoLastTest` et de la documentation dans la classe principale.

View file

@ -1,7 +1,20 @@
package cvdatpjunit;
/**
* This class contain various functions tested by JUnit
* @author Florian Charlaix
*/
public class CVDATPJUnit {
public static void main(String[] args) {
}
/**
* This function swap the two last characters
* @param in The string to swap
* @return The swapped string
*/
public static String swapTwoLast(String in) {
return null;
}
}

View file

@ -1,5 +1,16 @@
package cvdatpjunit;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Assertions;
class CVDATPJUnitTest {
@Test
void swapTwoLastTest() {
Assertions.assertEquals("BA", CVDATPJUnit.swapTwoLast("AB"));
Assertions.assertEquals("RANI", CVDATPJUnit.swapTwoLast("RAIN"));
Assertions.assertEquals("TENRANI", CVDATPJUnit.swapTwoLast("TENRAIN"));
Assertions.assertEquals("A", CVDATPJUnit.swapTwoLast("A"));
Assertions.assertEquals("", CVDATPJUnit.swapTwoLast(""));
}
}