Classes 2022 end

This commit is contained in:
marcin witkowski 2022-10-16 20:40:11 +02:00
parent 01ad4d8855
commit 253d060dfe
2 changed files with 32 additions and 39 deletions

View File

@ -68,13 +68,6 @@
<artifactId>httpclient</artifactId>
<version>4.5.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-core -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.8.0</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -1,32 +1,32 @@
package second.junit;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
public class MockTest {
HttpQueryClass httpQueryClass;
@Before
public void setUp() {
System.out.println("Run setUp");
httpQueryClass = Mockito.mock(HttpQueryClass.class);
}
@Test
public void mockTestExample() {
Mockito.when(httpQueryClass.query()).thenReturn("test");
ProcessQuery processQuery = new ProcessQuery(httpQueryClass);
String result = processQuery.process();
assertThat(result).isEqualTo("TEST");
}
}
//package second.junit;
//
//import org.junit.Assert;
//import org.junit.Before;
//import org.junit.Test;
//import org.mockito.Mock;
//import org.mockito.Mockito;
//
//import static org.assertj.core.api.Assertions.assertThat;
//import static org.mockito.Mockito.when;
//
//public class MockTest {
//
// HttpQueryClass httpQueryClass;
//
// @Before
// public void setUp() {
// System.out.println("Run setUp");
// httpQueryClass = Mockito.mock(HttpQueryClass.class);
// }
//
// @Test
// public void mockTestExample() {
// Mockito.when(httpQueryClass.query()).thenReturn("test");
//
// ProcessQuery processQuery = new ProcessQuery(httpQueryClass);
//
// String result = processQuery.process();
// assertThat(result).isEqualTo("TEST");
// }
//
//}