fixed test "getOfferFromPersistence"
This commit is contained in:
@@ -23,8 +23,6 @@ import de.rwu.easydrop.model.Offer;
|
|||||||
import de.rwu.easydrop.util.Config;
|
import de.rwu.easydrop.util.Config;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class OfferRetrieverTest {
|
class OfferRetrieverTest {
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
@@ -56,10 +54,9 @@ class OfferRetrieverTest {
|
|||||||
@Test
|
@Test
|
||||||
void getOfferFromPersistence(){
|
void getOfferFromPersistence(){
|
||||||
|
|
||||||
// a mock ProductDTO object to return from the offerDTO mock
|
//Mock ProductDTO object to return from the offerDTO mock
|
||||||
ProductDTO productDTO = mock(ProductDTO.class);
|
ProductDTO productDTO = mock(ProductDTO.class);
|
||||||
when(productDTO.isAvailable()).thenReturn(false);
|
when(productDTO.isAvailable()).thenReturn(true);
|
||||||
|
|
||||||
|
|
||||||
//Arrange
|
//Arrange
|
||||||
String offerId = "187";
|
String offerId = "187";
|
||||||
@@ -67,6 +64,8 @@ class OfferRetrieverTest {
|
|||||||
when(persistence.getOfferDTOById(offerId)).thenReturn(offerDTO);
|
when(persistence.getOfferDTOById(offerId)).thenReturn(offerDTO);
|
||||||
when(offerDTO.getOfferId()).thenReturn(offerId);
|
when(offerDTO.getOfferId()).thenReturn(offerId);
|
||||||
when(offerDTO.getLastUpdate()).thenReturn(lastUpdate);
|
when(offerDTO.getLastUpdate()).thenReturn(lastUpdate);
|
||||||
|
when(offerDTO.getSourceProduct()).thenReturn(productDTO);
|
||||||
|
when(offerDTO.getTargetProduct()).thenReturn(productDTO);
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
Offer result = offerRetriever.getOfferFromPersistence(offerId);
|
Offer result = offerRetriever.getOfferFromPersistence(offerId);
|
||||||
@@ -80,14 +79,4 @@ class OfferRetrieverTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user