Guest User

Untitled

a guest
Dec 18th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. @InjectMocks
  2. private OfferingController offeringController;
  3.  
  4. private MockMvc mockMvc;
  5.  
  6. @Mock
  7. private TeamBundleRepository teamBundleRepository;
  8.  
  9. @Mock
  10. private ModelMapper modelMapper;
  11.  
  12. public OfferingControllerTest() throws JsonProcessingException {}
  13.  
  14. public TeamBundle teamBundle;
  15. public TeamBundleDTO teamBundleDTO = new TeamBundleDTO(1l, 456l, 567l, "dummy TeamBundle", 1l, 3l , 100d , 20d, 10d, false, false,"INR",new BigDecimal(1.0), null, null, false );
  16.  
  17. @Before
  18. public void setUp() throws Exception {
  19. mockMvc = MockMvcBuilders.standaloneSetup(offeringController).build();
  20. teamBundle = new TeamBundle(1l, "dummy TeamBundle", 1l, 3l, 100d, 20d, 10d, 0, 0, "INR", new BigDecimal(1), null, null, null, null, 0);
  21. }
  22.  
  23. @Test
  24. public void fetch() throws Exception {
  25. Mockito.when(teamBundleService.findByIdAndIsVenture(1l, false)).thenReturn(teamBundle);
  26. TeamBundleDTO teamBundleDTO = modelMapper.map(teamBundle, TeamBundleDTO.class);
  27. mockMvc.perform(get("/1L")
  28. .contentType(MediaType.APPLICATION_JSON))
  29. .andExpect(status().isOk())
  30. .andReturn();
  31. }
Add Comment
Please, Sign In to add comment