-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathClassBTest.java
More file actions
35 lines (27 loc) · 915 Bytes
/
ClassBTest.java
File metadata and controls
35 lines (27 loc) · 915 Bytes
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
30
31
32
33
34
35
package com.engflow.internship.cycleexample.class_b;
import com.engflow.internship.cycleexample.class_c.ClassC;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
public class ClassBTest {
private static class TestClassC extends ClassC {
boolean methodACalled = false;
public TestClassC() {
super(null);
}
@Override
public void methodA(String input) {
methodACalled = true;
}
}
@Test
public void testMethodB() {
// Create a TestClassC instance
TestClassC testClassC = new TestClassC();
// Create an instance of ClassB with the TestClassC object
ClassB classB = new ClassB(testClassC);
// Call methodB on classB
classB.methodB("Sample input");
// Verify that methodA on the TestClassC was called
assertTrue(testClassC.methodACalled);
}
}