Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b9f59ff

Browse files
[improve] Fixed a few imports, cleaned a few stubs
1 parent dc1e4f2 commit b9f59ff

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

‎d03/d03s03-unit-and-integration-testing/src/test/java/net/safedata/spring/training/d03s03/ProductServiceTest.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import org.junit.runner.RunWith;
88
import org.mockito.InjectMocks;
99
import org.mockito.Mock;
10-
import org.mockito.runners.MockitoJUnitRunner;
10+
import org.mockito.junit.MockitoJUnitRunner;
1111

1212
import java.util.ArrayList;
1313
import java.util.Arrays;
@@ -17,7 +17,6 @@
1717
import static org.hamcrest.core.Is.is;
1818
import static org.hamcrest.core.IsNot.not;
1919
import static org.junit.Assert.*;
20-
import static org.mockito.Matchers.anyInt;
2120
import static org.mockito.Mockito.*;
2221

2322
@RunWith(MockitoJUnitRunner.class)
@@ -76,16 +75,12 @@ public void givenThereAreAvailableProducts_whenRetrievingAProductById_thenThePro
7675

7776
@Test(expected = IllegalArgumentException.class)
7877
public void givenThereAreNoAvailableProducts_whenGettingAProductById_thenAnIllegalArgumentExceptionIsThrown() {
79-
when(productRepository.findById(anyInt())).thenReturn(Optional.empty());
80-
8178
productService.getProduct(13);
8279
}
8380

8481
@Test
8582
public void givenAProductIsSaved_whenSavingTheProduct_thenSaveIsCalledOneTimesAndTheResponseShouldNotBeEmptyOrNull () {
8683
final Product product = mock(Product.class);
87-
final String mockedName = "mocked name";
88-
when(product.getName()).thenReturn(mockedName);
8984

9085
final String response = productService.saveProduct(product);
9186

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /