@Test public void shouldSaveNewType() throws Exception { EquipmentType type = new EquipmentType(); type.setName("Test"); type.setCode("Test"); service.save(type); verify(repository).insert(type); verify(repository, never()).update(type); }
public void save(EquipmentType type){ if(type.getId() == null){ repository.insert(type); } else { repository.update(type); } }
EquipmentTypeService { public void save(EquipmentType type){ if(type.getId() == null){ repository.insert(type); } else { repository.update(type); } } }
EquipmentTypeService { public void save(EquipmentType type){ if(type.getId() == null){ repository.insert(type); } else { repository.update(type); } }  }
EquipmentTypeService { public void save(EquipmentType type){ if(type.getId() == null){ repository.insert(type); } else { repository.update(type); } }  List<EquipmentType> getAll(); EquipmentType getTypeById(Long id); void save(EquipmentType type); }
EquipmentTypeService { public void save(EquipmentType type){ if(type.getId() == null){ repository.insert(type); } else { repository.update(type); } }  List<EquipmentType> getAll(); EquipmentType getTypeById(Long id); void save(EquipmentType type);  }