HierarchyTypeService { @Transactional public HierarchyType createHierarchyType(HierarchyType hierarchyType) { return hierarchyTypeRepository.save(hierarchyType); } @Autowired  HierarchyTypeService(HierarchyTypeRepository hierarchyTypeRepository); @Transactional HierarchyType createHierarchyType(HierarchyType hierarchyType); @Transactional HierarchyType updateHierarchyType(HierarchyType hierarchyType); HierarchyType getHierarchyTypeByName(String name); List<HierarchyType> getAllHierarchyTypes();  }
@Test public void testCreateHierarchyType() { HierarchyType hierarchyType = new HierarchyType(); hierarchyType.setName("Test One"); hierarchyType.setCode("TEST_ONE"); hierarchyTypeService.createHierarchyType(hierarchyType); verify(hierarchyTypeRepository).save(hierarchyType); }