๐Ÿ“ฆ savankansagra / 50InterviewQuestions

๐Ÿ“„ _14_get_substring_index_test.java ยท 30 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;

class _14_get_substring_index_test {

	_14_get_substring_index obj = new _14_get_substring_index();
	
	@Test
	void test() {
		//fail("Not yet implemented");
	}

	@Test
	void test1() {
		String str1 = "abcdabcdr";
		String str2 = "bcdr";
		int testResult = obj.substrIndex(str1, str2);
		assertEquals(5, testResult);
	}
	
	@Test
	void test2() {
		String str1 = "abcdabcd";
		String str2 = "bcdg";
		int testResult = obj.substrIndex(str1, str2);
		assertEquals(-1, testResult);
	}
}