[BAEL-16668] Split or move testing-modules/mockito module (#7835)
* Split or move testing-modules/mockito module * [BAEL-16668] fix after merge with master
This commit is contained in:
committed by
Josh Cummings
parent
4e31b41919
commit
2255577ffd
@@ -0,0 +1,12 @@
|
||||
## Hamcrest
|
||||
|
||||
This module contains articles about Hamcrest
|
||||
|
||||
### Relevant articles
|
||||
- [Hamcrest Text Matchers](https://www.baeldung.com/hamcrest-text-matchers)
|
||||
- [Hamcrest File Matchers](https://www.baeldung.com/hamcrest-file-matchers)
|
||||
- [Hamcrest Object Matchers](https://www.baeldung.com/hamcrest-object-matchers)
|
||||
- [Hamcrest Bean Matchers](https://www.baeldung.com/hamcrest-bean-matchers)
|
||||
- [Hamcrest Number Matchers](https://www.baeldung.com/hamcrest-number-matchers)
|
||||
- [Hamcrest Common Core Matchers](https://www.baeldung.com/hamcrest-core-matchers)
|
||||
- [Hamcrest Custom Matchers](https://www.baeldung.com/hamcrest-custom-matchers)
|
||||
@@ -0,0 +1,29 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>hamcrest</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>hamcrest</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-java</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-java</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>java-hamcrest</artifactId>
|
||||
<version>${hamcrest.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<hamcrest.version>2.0.0.0</hamcrest.version>
|
||||
</properties>
|
||||
</project>
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.hamcrest;
|
||||
package com.baeldung.hamcrest.objectmatchers;
|
||||
|
||||
public class City extends Location {
|
||||
String name;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package com.baeldung.hamcrest.objectmatchers;
|
||||
|
||||
public class Location {
|
||||
}
|
||||
+3
-8
@@ -1,5 +1,6 @@
|
||||
package org.baeldung.hamcrest;
|
||||
package com.baeldung.hamcrest;
|
||||
|
||||
import com.baeldung.hamcrest.objectmatchers.City;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
@@ -8,13 +9,7 @@ import java.util.List;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.hasProperty;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.equalToIgnoringCase;
|
||||
import static org.hamcrest.Matchers.samePropertyValuesAs;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.beans.PropertyUtil.getPropertyDescriptor;
|
||||
import static org.hamcrest.beans.PropertyUtil.propertyDescriptorsFor;
|
||||
|
||||
+1
-4
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.hamcrest;
|
||||
package com.baeldung.hamcrest;
|
||||
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -145,7 +145,6 @@ public class HamcrestCoreMatchersUnitTest {
|
||||
@Test
|
||||
public void givenString_WhenContainsStringIgnoringCase_ThenCorrect() {
|
||||
|
||||
|
||||
// GIVEN
|
||||
String testString = "hamcrest core";
|
||||
|
||||
@@ -164,7 +163,6 @@ public class HamcrestCoreMatchersUnitTest {
|
||||
assertThat(list, hasItem(isA(String.class)));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void givenTestInput_WhenUsingHasItemsInCollection() {
|
||||
|
||||
@@ -223,7 +221,6 @@ public class HamcrestCoreMatchersUnitTest {
|
||||
assertThat(testString, either(startsWith("Bael")).or(containsString("Core")));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void givenTestInput_WhenUsingEveryItemForMatchInCollection() {
|
||||
|
||||
+6
-15
@@ -1,22 +1,13 @@
|
||||
package org.baeldung.hamcrest;
|
||||
package com.baeldung.hamcrest;
|
||||
|
||||
import static org.hamcrest.core.StringContains.containsString;
|
||||
import static org.hamcrest.io.FileMatchers.aFileNamed;
|
||||
import static org.hamcrest.io.FileMatchers.aFileWithAbsolutePath;
|
||||
import static org.hamcrest.io.FileMatchers.aFileWithCanonicalPath;
|
||||
import static org.hamcrest.io.FileMatchers.aFileWithSize;
|
||||
import static org.hamcrest.io.FileMatchers.aReadableFile;
|
||||
import static org.hamcrest.io.FileMatchers.aWritableFile;
|
||||
import static org.hamcrest.io.FileMatchers.anExistingDirectory;
|
||||
import static org.hamcrest.io.FileMatchers.anExistingFile;
|
||||
import static org.hamcrest.io.FileMatchers.anExistingFileOrDirectory;
|
||||
import static org.hamcrest.number.OrderingComparison.greaterThan;
|
||||
import static org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.hamcrest.io.FileMatchers.*;
|
||||
import static org.hamcrest.number.OrderingComparison.greaterThan;
|
||||
import static org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
public class HamcrestFileUnitTest {
|
||||
|
||||
+2
-10
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.hamcrest;
|
||||
package com.baeldung.hamcrest;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -6,15 +6,7 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.closeTo;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
import static org.hamcrest.Matchers.lessThan;
|
||||
import static org.hamcrest.Matchers.lessThanOrEqualTo;
|
||||
import static org.hamcrest.Matchers.comparesEqualTo;
|
||||
import static org.hamcrest.Matchers.notANumber;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
public class HamcrestNumberUnitTest {
|
||||
|
||||
+4
-7
@@ -1,14 +1,11 @@
|
||||
package org.baeldung.hamcrest;
|
||||
package com.baeldung.hamcrest;
|
||||
|
||||
import com.baeldung.hamcrest.objectmatchers.City;
|
||||
import com.baeldung.hamcrest.objectmatchers.Location;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.hasToString;
|
||||
import static org.hamcrest.Matchers.equalToIgnoringCase;
|
||||
import static org.hamcrest.Matchers.emptyOrNullString;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.typeCompatibleWith;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
public class HamcrestObjectUnitTest {
|
||||
|
||||
+3
-3
@@ -1,4 +1,6 @@
|
||||
package org.baeldung.hamcrest;
|
||||
package com.baeldung.hamcrest;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.core.StringContains.containsString;
|
||||
import static org.hamcrest.core.StringContains.containsStringIgnoringCase;
|
||||
@@ -16,8 +18,6 @@ import static org.hamcrest.text.MatchesPattern.matchesPattern;
|
||||
import static org.hamcrest.text.StringContainsInOrder.stringContainsInOrder;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class HamcrestTextUnitTest {
|
||||
|
||||
@Test
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
package org.baeldung.hamcrest;
|
||||
package com.baeldung.hamcrest.custommatchers;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.baeldung.hamcrest.custommatchers.IsDivisibleBy.divisibleBy;
|
||||
import static org.baeldung.hamcrest.custommatchers.IsOnlyDigits.onlyDigits;
|
||||
import static org.baeldung.hamcrest.custommatchers.IsUppercase.uppercase;
|
||||
import static com.baeldung.hamcrest.custommatchers.IsDivisibleBy.divisibleBy;
|
||||
import static com.baeldung.hamcrest.custommatchers.IsOnlyDigits.onlyDigits;
|
||||
import static com.baeldung.hamcrest.custommatchers.IsUppercase.uppercase;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.hamcrest.custommatchers;
|
||||
package com.baeldung.hamcrest.custommatchers;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.hamcrest.custommatchers;
|
||||
package com.baeldung.hamcrest.custommatchers;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.hamcrest.custommatchers;
|
||||
package com.baeldung.hamcrest.custommatchers;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
@@ -1,5 +1,7 @@
|
||||
### Relevant articles
|
||||
|
||||
- [Mockito’s Java 8 Features](http://www.baeldung.com/mockito-2-java-8)
|
||||
- [Lazy Verification with Mockito 2](http://www.baeldung.com/mockito-2-lazy-verification)
|
||||
- [Mockito’s Java 8 Features](https://www.baeldung.com/mockito-2-java-8)
|
||||
- [Lazy Verification with Mockito 2](https://www.baeldung.com/mockito-2-lazy-verification)
|
||||
- [Mockito Strict Stubbing and The UnnecessaryStubbingException](https://www.baeldung.com/mockito-unnecessary-stubbing-exception)
|
||||
- [Quick Guide to BDDMockito](https://www.baeldung.com/bdd-mockito)
|
||||
- [Mockito – Using Spies](https://www.baeldung.com/mockito-spy)
|
||||
|
||||
+4
-4
@@ -1,7 +1,4 @@
|
||||
package org.baeldung.bddmockito;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
package com.baeldung.mockito.bddmockito;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
@@ -9,6 +6,9 @@ import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
|
||||
|
||||
public class BDDMockitoUnitTest {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.bddmockito;
|
||||
package com.baeldung.mockito.bddmockito;
|
||||
|
||||
public interface PhoneBookRepository {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.bddmockito;
|
||||
package com.baeldung.mockito.bddmockito;
|
||||
|
||||
public class PhoneBookService {
|
||||
|
||||
+7
-7
@@ -1,16 +1,16 @@
|
||||
package com.baeldung.mockito.java8;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import java.util.List;
|
||||
package com.baeldung.mockito.lazyverification;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.mockito.exceptions.base.MockitoAssertionError;
|
||||
import org.mockito.junit.MockitoJUnit;
|
||||
import org.mockito.junit.VerificationCollector;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
public class LazyVerificationUnitTest {
|
||||
|
||||
@Test
|
||||
+8
-8
@@ -1,11 +1,4 @@
|
||||
package org.baeldung.mockito.misusing;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
package com.baeldung.mockito.spy;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
@@ -13,6 +6,13 @@ import org.mockito.Mockito;
|
||||
import org.mockito.exceptions.misusing.NotAMockException;
|
||||
import org.mockito.internal.progress.ThreadSafeMockingProgress;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
public class MockitoMisusingUnitTest {
|
||||
|
||||
@After
|
||||
+6
-6
@@ -1,9 +1,4 @@
|
||||
package org.baeldung.mockito.spy;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
package com.baeldung.mockito.spy;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -11,6 +6,11 @@ import org.mockito.Mockito;
|
||||
import org.mockito.Spy;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class MockitoSpyUnitTest {
|
||||
|
||||
@@ -4,23 +4,13 @@
|
||||
|
||||
|
||||
### Relevant Articles:
|
||||
- [Mockito Verify Cookbook](http://www.baeldung.com/mockito-verify)
|
||||
- [Mockito When/Then Cookbook](http://www.baeldung.com/mockito-behavior)
|
||||
- [Mockito – Using Spies](http://www.baeldung.com/mockito-spy)
|
||||
- [Getting Started with Mockito @Mock, @Spy, @Captor and @InjectMocks](http://www.baeldung.com/mockito-annotations)
|
||||
- [Mockito’s Mock Methods](http://www.baeldung.com/mockito-mock-methods)
|
||||
- [Introduction to PowerMock](http://www.baeldung.com/intro-to-powermock)
|
||||
- [Mocking Exception Throwing using Mockito](http://www.baeldung.com/mockito-exceptions)
|
||||
- [Mocking Void Methods with Mockito](http://www.baeldung.com/mockito-void-methods)
|
||||
- [Mocking of Private Methods Using PowerMock](http://www.baeldung.com/powermock-private-method)
|
||||
- [Mock Final Classes and Methods with Mockito](http://www.baeldung.com/mockito-final)
|
||||
- [Hamcrest Custom Matchers](http://www.baeldung.com/hamcrest-custom-matchers)
|
||||
- [Hamcrest Common Core Matchers](http://www.baeldung.com/hamcrest-core-matchers)
|
||||
- [Testing Callbacks with Mockito](http://www.baeldung.com/mockito-callbacks)
|
||||
- [Using Hamcrest Number Matchers](https://www.baeldung.com/hamcrest-number-matchers)
|
||||
- [Quick Guide to BDDMockito](http://www.baeldung.com/bdd-mockito)
|
||||
- [Hamcrest Bean Matchers](http://www.baeldung.com/hamcrest-bean-matchers)
|
||||
- [Hamcrest Object Matchers](http://www.baeldung.com/hamcrest-object-matchers)
|
||||
- [Hamcrest File Matchers](https://www.baeldung.com/hamcrest-file-matchers)
|
||||
- [Hamcrest Text Matchers](http://www.baeldung.com/hamcrest-text-matchers)
|
||||
- [Testing Callbacks with Mockito](http://www.baeldung.com/mockito-callbacks)
|
||||
- [Mockito Verify Cookbook](https://www.baeldung.com/mockito-verify)
|
||||
- [Mockito When/Then Cookbook](https://www.baeldung.com/mockito-behavior)
|
||||
- [Getting Started with Mockito @Mock, @Spy, @Captor and @InjectMocks](https://www.baeldung.com/mockito-annotations)
|
||||
- [Mockito’s Mock Methods](https://www.baeldung.com/mockito-mock-methods)
|
||||
- [Introduction to PowerMock](https://www.baeldung.com/intro-to-powermock)
|
||||
- [Mocking of Private Methods Using PowerMock](https://www.baeldung.com/powermock-private-method)
|
||||
- [Mocking Exception Throwing using Mockito](https://www.baeldung.com/mockito-exceptions)
|
||||
- [Mocking Void Methods with Mockito](https://www.baeldung.com/mockito-void-methods)
|
||||
- [Mock Final Classes and Methods with Mockito](https://www.baeldung.com/mockito-final)
|
||||
- [Testing Callbacks with Mockito](https://www.baeldung.com/mockito-callbacks)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.baeldung</groupId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>mockito</artifactId>
|
||||
<version>0.1-SNAPSHOT</version>
|
||||
<name>mockito</name>
|
||||
@@ -58,12 +58,6 @@
|
||||
<version>${powermock.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>java-hamcrest</artifactId>
|
||||
<version>${hamcrest.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.mockito.service;
|
||||
package com.baeldung.mockito.callbacks;
|
||||
|
||||
public class ActionHandler {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.mockito.service;
|
||||
package com.baeldung.mockito.callbacks;
|
||||
|
||||
public interface Callback<T> {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.mockito.service;
|
||||
package com.baeldung.mockito.callbacks;
|
||||
|
||||
public class Data {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.mockito.service;
|
||||
package com.baeldung.mockito.callbacks;
|
||||
|
||||
public class Response {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.mockito.service;
|
||||
package com.baeldung.mockito.callbacks;
|
||||
|
||||
public interface Service {
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
package org.baeldung.hamcrest;
|
||||
|
||||
public class Location {
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user