Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7825710

Browse files
refactor 160
1 parent 2a49859 commit 7825710

File tree

2 files changed

+45
-26
lines changed

2 files changed

+45
-26
lines changed

src/main/java/com/fishercoder/solutions/_160.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import java.util.HashSet;
66
import java.util.Set;
77

8-
/**160. Intersection of Two Linked Lists
9-
*
10-
* Write a program to find the node at which the intersection of two singly linked lists begins.
8+
/**
9+
* 160. Intersection of Two Linked Lists
10+
Write a program to find the node at which the intersection of two singly linked lists begins.
1111
1212
1313
For example, the following two linked lists:

src/test/java/com/fishercoder/_160Test.java

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,54 @@
33
import com.fishercoder.common.classes.ListNode;
44
import com.fishercoder.solutions._160;
55
import org.junit.BeforeClass;
6+
import org.junit.Ignore;
67
import org.junit.Test;
78

89
import static org.junit.Assert.assertEquals;
910

1011
public class _160Test {
11-
private static _160.Solution1 solution1;
12-
private static _160.Solution2 solution2;
13-
private static _160.Solution3 solution3;
14-
private static ListNode headA;
15-
private static ListNode headB;
16-
private static ListNode expected;
12+
private static _160.Solution1 solution1;
13+
private static _160.Solution2 solution2;
14+
private static _160.Solution3 solution3;
15+
private static ListNode headA;
16+
private static ListNode headB;
17+
private static ListNode expected;
1718

18-
@BeforeClass
19-
public static void setup() {
20-
solution1 = new _160.Solution1();
21-
solution2 = new _160.Solution2();
22-
solution3 = new _160.Solution3();
23-
}
19+
@BeforeClass
20+
public static void setup() {
21+
solution1 = new _160.Solution1();
22+
solution2 = new _160.Solution2();
23+
solution3 = new _160.Solution3();
24+
}
2425

25-
@Test
26-
public void test1() {
27-
headA = new ListNode(3);
28-
headB = new ListNode(2);
29-
headB.next = new ListNode(3);
30-
expected = new ListNode(3);
31-
/**TODO: both solution1 and solution2 are ACCEPTED on OJ, but somehow it's not passing in this unit test.*/
32-
// assertEquals(expected, solution1.getIntersectionNode(headA, headB));
33-
// assertEquals(expected, solution2.getIntersectionNode(headA, headB));
34-
assertEquals(expected, solution3.getIntersectionNode(headA, headB));
35-
}
26+
@Test
27+
@Ignore
28+
public void test1() {
29+
headA = new ListNode(3);
30+
headB = new ListNode(2);
31+
headB.next = new ListNode(3);
32+
expected = new ListNode(3);
33+
/**TODO: both solution1 and solution2 are ACCEPTED on OJ, but somehow it's not passing in this unit test.*/
34+
assertEquals(expected, solution1.getIntersectionNode(headA, headB));
35+
}
3636

37+
@Test
38+
@Ignore
39+
public void test2() {
40+
headA = new ListNode(3);
41+
headB = new ListNode(2);
42+
headB.next = new ListNode(3);
43+
expected = new ListNode(3);
44+
/**TODO: both solution1 and solution2 are ACCEPTED on OJ, but somehow it's not passing in this unit test.*/
45+
assertEquals(expected, solution2.getIntersectionNode(headA, headB));
46+
}
47+
48+
@Test
49+
public void test3() {
50+
headA = new ListNode(3);
51+
headB = new ListNode(2);
52+
headB.next = new ListNode(3);
53+
expected = new ListNode(3);
54+
assertEquals(expected, solution3.getIntersectionNode(headA, headB));
55+
}
3756
}

0 commit comments

Comments
 (0)