Removed unused mocks.
package greencity.service.impl;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.Mockito.*;
+
+
import greencity.dto.econews.AddEcoNewsDtoRequest;
import greencity.dto.econews.AddEcoNewsDtoResponse;
import greencity.dto.econews.EcoNewsDto;
@@ -14,13 +18,10 @@ import java.util.*;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.mockito.ArgumentMatchers.anyLong;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import static org.mockito.Mockito.*;
import org.mockito.junit.MockitoJUnitRunner;
import org.modelmapper.ModelMapper;
-import org.modelmapper.TypeToken;
@RunWith(MockitoJUnitRunner.class)
public class EcoNewsServiceImplTest {
@@ -59,12 +60,8 @@ public class EcoNewsServiceImplTest {
public void save() {
when(modelMapper.map(addEcoNewsDtoRequest, EcoNews.class)).thenReturn(entity);
when(modelMapper.map(entity, AddEcoNewsDtoResponse.class)).thenReturn(addEcoNewsDtoResponse);
-
- when(newsSubscriberRepo.findAll()).thenReturn(subscribersEntity);
- when(modelMapper.map(subscribersEntity, new TypeToken<List<NewsSubscriberResponseDto>>() {
- }.getType())).thenReturn(subscribers);
-
when(ecoNewsRepo.save(entity)).thenReturn(entity);
+
Assert.assertEquals(addEcoNewsDtoResponse, ecoNewsService.save(addEcoNewsDtoRequest));
}
