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> <artifactId>httpclient</artifactId>
<version>4.5.10</version> <version>4.5.10</version>
</dependency> </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> </dependencies>

View File

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