Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package bg.sofia.uni.fmi.mjt.chat;
- import static org.junit.Assert.assertEquals;
- import static org.powermock.api.mockito.PowerMockito.mock;
- import static org.powermock.api.mockito.PowerMockito.whenNew;
- import java.io.FileInputStream;
- import org.junit.Test;
- import org.junit.runner.RunWith;
- import org.powermock.core.classloader.annotations.PrepareForTest;
- import org.powermock.modules.junit4.PowerMockRunner;
- @RunWith(PowerMockRunner.class)
- @PrepareForTest(FileInputStream.class)
- public class Class1Test {
- @Test
- public void method1Test() throws Exception {
- Class1 class1 = new Class1();
- FileInputStream fileInputStreamMock = mock(FileInputStream.class);
- whenNew(FileInputStream.class).withAnyArguments()
- .thenReturn(fileInputStreamMock);
- boolean expected = true;
- boolean actual = class1.method1();
- assertEquals(expected, actual);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement