|
|
@@ -0,0 +1,39 @@
|
|
|
+package org.leumasjaffe.recipe.view;
|
|
|
+
|
|
|
+import static org.mockito.Mockito.*;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+
|
|
|
+import javax.swing.JPanel;
|
|
|
+
|
|
|
+import org.junit.jupiter.api.Test;
|
|
|
+import org.junit.jupiter.api.extension.ExtendWith;
|
|
|
+import org.junit.platform.runner.JUnitPlatform;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
+import org.leumasjaffe.recipe.model.Element;
|
|
|
+import org.leumasjaffe.recipe.model.RecipeCard;
|
|
|
+import org.leumasjaffe.recipe.view.summary.SummaryPanel;
|
|
|
+import org.mockito.InjectMocks;
|
|
|
+import org.mockito.Mock;
|
|
|
+import org.mockito.junit.jupiter.MockitoExtension;
|
|
|
+
|
|
|
+@ExtendWith(MockitoExtension.class)
|
|
|
+@RunWith(JUnitPlatform.class)
|
|
|
+class RecipeCardPanelTest extends SwingTestCase {
|
|
|
+
|
|
|
+ @Mock SummaryPanel summaryPanel;
|
|
|
+ @Mock JPanel rightPanel;
|
|
|
+ @InjectMocks RecipeCardPanel panel;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ void testAddsEachElementToEachMember() {
|
|
|
+ RecipeCard card = new RecipeCard();
|
|
|
+ card.setElements(Arrays.asList(new Element(), new Element()));
|
|
|
+
|
|
|
+ panel.setModel(card);
|
|
|
+
|
|
|
+ verify(summaryPanel, times(2)).addElement(any());
|
|
|
+ verify(rightPanel, times(2)).add(any(ElementPanel.class));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|