// Path: src/main/java/pl/mjedynak/idea/plugins/builder/renderer/ActionCellRenderer.java
// public class ActionCellRenderer extends DefaultListCellRenderer {
// 
//     @Override
//     public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
//         Component result = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
//         if (value != null) {
//             GotoTargetHandler.AdditionalAction action = (GotoTargetHandler.AdditionalAction) value;
//             setText(action.getText());
//             setIcon(action.getIcon());
//         }
//         return result;
//     }
// 
// }


import com.intellij.ui.ExpandedItemListCellRendererWrapper;
import com.intellij.ui.components.JBList;
import org.junit.Test;
import pl.mjedynak.idea.plugins.builder.renderer.ActionCellRenderer;
import javax.swing.JList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.util.ReflectionTestUtils.getField;

package pl.mjedynak.idea.plugins.builder.factory;




public class GoToBuilderPopupListFactoryTest {

    private AbstractPopupListFactory popupListFactory = new GoToBuilderPopupListFactory();

    @Test
    public void shouldCreateJBListWithActionCellRenderer() {
        // when
        JList popupList = popupListFactory.getPopupList();

        // then
        assertThat(popupList).isInstanceOf(JBList.class);
        assertThat(popupList.getCellRenderer()).isInstanceOf(ExpandedItemListCellRendererWrapper.class);

// Path: src/main/java/pl/mjedynak/idea/plugins/builder/renderer/ActionCellRenderer.java
// public class ActionCellRenderer extends DefaultListCellRenderer {
// 
//     @Override
//     public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
//         Component result = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
//         if (value != null) {
//             GotoTargetHandler.AdditionalAction action = (GotoTargetHandler.AdditionalAction) value;
//             setText(action.getText());
//             setIcon(action.getIcon());
//         }
//         return result;
//     }
// 
// }


// Path: src/test/java/pl/mjedynak/idea/plugins/builder/factory/GoToBuilderPopupListFactoryTest.java
import com.intellij.ui.ExpandedItemListCellRendererWrapper;
import com.intellij.ui.components.JBList;
import org.junit.Test;
import pl.mjedynak.idea.plugins.builder.renderer.ActionCellRenderer;
import javax.swing.JList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.util.ReflectionTestUtils.getField;

package pl.mjedynak.idea.plugins.builder.factory;




public class GoToBuilderPopupListFactoryTest {

    private AbstractPopupListFactory popupListFactory = new GoToBuilderPopupListFactory();

    @Test
    public void shouldCreateJBListWithActionCellRenderer() {
        // when
        JList popupList = popupListFactory.getPopupList();

        // then
        assertThat(popupList).isInstanceOf(JBList.class);
        assertThat(popupList.getCellRenderer()).isInstanceOf(ExpandedItemListCellRendererWrapper.class);

        assertThat(((ExpandedItemListCellRendererWrapper) popupList.getCellRenderer()).getWrappee()).isInstanceOf(ActionCellRenderer.class);
