Classes 2022 end
This commit is contained in:
parent
01ad4d8855
commit
253d060dfe
7
pom.xml
7
pom.xml
@ -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>
|
||||
|
||||
|
@ -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");
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
Loading…
Reference in New Issue
Block a user