Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @MockBean
- CategoryRepository categoryRepository;
- @Autowired
- CategoryService categoryService;
- @Autowired
- CategoryMapper categoryMapper;
- CategoryDto categoryDto;
- Category category;
- @BeforeEach
- public void init() {
- category = new Category();
- category.setId(5L);
- category.setName("testname");
- category.setParentId(2L);
- categoryDto = categoryMapper.toDto(category);
- }
- @Test
- public void should_return_same_category_when_find_by_id() {
- when(categoryRepository.findById(5L)).thenReturn(Optional.of(category));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement