added IngredientControllerTest + fix comments

This commit is contained in:
Aysegul Aydinlik 2026-01-22 14:44:27 +01:00
commit 9603742220
2 changed files with 3 additions and 3 deletions

View file

@ -23,7 +23,7 @@ public class IngredientController {
private final RestTemplate restTemplate = new RestTemplate(); // Simplified REST client private final RestTemplate restTemplate = new RestTemplate(); // Simplified REST client
@FXML @FXML
void handleDeleteIngredient(ActionEvent event) { public void handleDeleteIngredient(ActionEvent event) {
// Get selected ingredient // Get selected ingredient
Ingredient selectedIngredient = ingredientListView.getSelectionModel().getSelectedItem(); Ingredient selectedIngredient = ingredientListView.getSelectionModel().getSelectedItem();
if (selectedIngredient == null) { if (selectedIngredient == null) {

View file

@ -68,7 +68,7 @@ class IngredientControllerMockTest {
// pick ingredient -> backend says not in use -> fake delete ingredient // pick ingredient -> backend says not in use -> fake delete ingredient
@Test @Test
void deleteingredientwhennotusedcallsusagethendeleteandclearslist() throws Exception { void DeleteIngredientWhenNotUsedCallsUsageThenDeleteAndClearsList() throws Exception {
Ingredient selected = ingredientListView.getItems().get(0); Ingredient selected = ingredientListView.getItems().get(0);
ingredientListView.getSelectionModel().select(selected); ingredientListView.getSelectionModel().select(selected);
@ -91,7 +91,7 @@ class IngredientControllerMockTest {
//select ingredient -> if used backend says it and show warning -> safety delete but shouldn't happen //select ingredient -> if used backend says it and show warning -> safety delete but shouldn't happen
@Test @Test
void deleteIngredientwhenUsedshowsWarningandDoesNotDeleteifDialogClosed() throws Exception { void DeleteIngredientWhenUsedShowsWarningAndDoesNotDeleteIfDialogClosed() throws Exception {
Ingredient selected = ingredientListView.getItems().get(1); Ingredient selected = ingredientListView.getItems().get(1);
ingredientListView.getSelectionModel().select(selected); ingredientListView.getSelectionModel().select(selected);