41 lines
1.7 KiB
Java
41 lines
1.7 KiB
Java
package cvdatpjunit;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
import org.junit.jupiter.api.Assertions;
|
|
|
|
/**
|
|
* This class are tests for the CVDATPJUnit class
|
|
* @author Florian Charlaix
|
|
*/
|
|
class CVDATPJUnitTest {
|
|
|
|
/**
|
|
* This function test the swapTwoLast static function
|
|
*/
|
|
@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(""));
|
|
Assertions.assertNull(CVDATPJUnit.swapTwoLast(null));
|
|
}
|
|
|
|
/**
|
|
* This function test the removeAFromTwoFirstChars static function
|
|
*/
|
|
@Test
|
|
void removeAFromTwoFirstCharsTest() {
|
|
Assertions.assertEquals("BCD", CVDATPJUnit.removeAFromTwoFirstChars("ABCD"));
|
|
Assertions.assertEquals("BBAA", CVDATPJUnit.removeAFromTwoFirstChars("BBAA"));
|
|
Assertions.assertEquals("CD", CVDATPJUnit.removeAFromTwoFirstChars("AACD"));
|
|
Assertions.assertEquals("BCD", CVDATPJUnit.removeAFromTwoFirstChars("BACD"));
|
|
Assertions.assertEquals("BAA", CVDATPJUnit.removeAFromTwoFirstChars("AABAA"));
|
|
Assertions.assertEquals("B", CVDATPJUnit.removeAFromTwoFirstChars("AB"));
|
|
Assertions.assertEquals("B", CVDATPJUnit.removeAFromTwoFirstChars("B"));
|
|
Assertions.assertEquals("", CVDATPJUnit.removeAFromTwoFirstChars("A"));
|
|
Assertions.assertEquals("", CVDATPJUnit.removeAFromTwoFirstChars(""));
|
|
Assertions.assertNull(CVDATPJUnit.removeAFromTwoFirstChars(null));
|
|
}
|
|
}
|