1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
CVDA_TP_Note/test/cvdatpjunit/CVDATPJUnitTest.java

42 lines
1.7 KiB
Java
Raw Normal View History

package cvdatpjunit;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Assertions;
2020-04-24 10:40:19 +02:00
/**
* This class are tests for the CVDATPJUnit class
* @author Florian Charlaix
*/
class CVDATPJUnitTest {
2020-04-24 10:40:19 +02:00
/**
* 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));
}
}