// Path: user-intf/src/main/java/br/com/hole19/marvel/ui/commons/adapter/ViewHolderFactory.java
// public class ViewHolderFactory {
// 
//     public RecyclerView.ViewHolder getViewHolder(ViewGroup parent, int viewType) {
//         LayoutInflater inflater = this.getLayoutInflater(parent.getContext());
//         View view;
//         switch (LayoutType.fromInteger(viewType)) {
//             case SMALL_VERTICAL:
//                 view = inflater.inflate(R.layout.rsc_util_item_small, parent, false);
//                 return new ViewHolder.ItemViewHolder(view);
//             case LARGE_VERTICAL:
//                 view = inflater.inflate(R.layout.rsc_util_item_large, parent, false);
//                 return new ViewHolder.ItemViewHolder(view);
//         }
//         return null;
//     }
// 
//     public LayoutInflater getLayoutInflater(Context context) {
//         return LayoutInflater.from(context);
//     }
// 
// }
// 
// Path: user-intf/src/main/java/br/com/hole19/marvel/ui/commons/model/LayoutType.java
// public enum LayoutType {
// 
//     SMALL_VERTICAL(0),
//     LARGE_VERTICAL(1),
//     SMALL_HORIZONTAL(2),
//     LARGE_HORIZONTAL(3);
// 
//     private int mValue;
// 
//     LayoutType(int value) {
//         this.mValue = value;
//     }
// 
//     public static LayoutType fromInteger(int value) {
//         for (LayoutType b : LayoutType.values()) {
//             if (value == b.mValue) {
//                 return b;
//             }
//         }
//         return null;
//     }
// 
//     public int toInteger() {
//         return this.mValue;
//     }
// }


import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import junit.framework.TestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mockito;
import br.com.hole19.marvel.R;
import br.com.hole19.marvel.ui.commons.adapter.ViewHolderFactory;
import br.com.hole19.marvel.ui.commons.model.LayoutType;
package br.com.hole19.marvel.commons.adapter;





/**
 * Created by edgar on 08-May-16.
 */
@RunWith(JUnit4.class)
public class TestViewHolderFactor extends TestCase {

    ViewHolderFactory viewHolderFactor;

    @Test
    public void testGetViewHolderSmallVertical () {
        int layoutType = LayoutType.SMALL_VERTICAL.toInteger();

        this.viewHolderFactor = Mockito.mock(ViewHolderFactory.class);
        ViewGroup viewGroup = Mockito.mock(ViewGroup.class);
        Mockito.when(viewHolderFactor.getViewHolder(viewGroup, layoutType)).thenCallRealMethod();
        Context context = Mockito.mock(Context.class);
        Mockito.when(viewGroup.getContext()).thenReturn(context);
        LayoutInflater layoutInflater = Mockito.mock(LayoutInflater.class);
        Mockito.when(viewHolderFactor.getLayoutInflater(context)).thenReturn(layoutInflater);
        Mockito.when(layoutInflater.inflate(R.layout.rsc_util_item_small, viewGroup, false)).thenReturn(Mockito.mock(View.class));
        RecyclerView.ViewHolder result = viewHolderFactor.getViewHolder(viewGroup, layoutType);
// Path: user-intf/src/main/java/br/com/hole19/marvel/ui/commons/adapter/ViewHolderFactory.java
// public class ViewHolderFactory {
// 
//     public RecyclerView.ViewHolder getViewHolder(ViewGroup parent, int viewType) {
//         LayoutInflater inflater = this.getLayoutInflater(parent.getContext());
//         View view;
//         switch (LayoutType.fromInteger(viewType)) {
//             case SMALL_VERTICAL:
//                 view = inflater.inflate(R.layout.rsc_util_item_small, parent, false);
//                 return new ViewHolder.ItemViewHolder(view);
//             case LARGE_VERTICAL:
//                 view = inflater.inflate(R.layout.rsc_util_item_large, parent, false);
//                 return new ViewHolder.ItemViewHolder(view);
//         }
//         return null;
//     }
// 
//     public LayoutInflater getLayoutInflater(Context context) {
//         return LayoutInflater.from(context);
//     }
// 
// }
// 
// Path: user-intf/src/main/java/br/com/hole19/marvel/ui/commons/model/LayoutType.java
// public enum LayoutType {
// 
//     SMALL_VERTICAL(0),
//     LARGE_VERTICAL(1),
//     SMALL_HORIZONTAL(2),
//     LARGE_HORIZONTAL(3);
// 
//     private int mValue;
// 
//     LayoutType(int value) {
//         this.mValue = value;
//     }
// 
//     public static LayoutType fromInteger(int value) {
//         for (LayoutType b : LayoutType.values()) {
//             if (value == b.mValue) {
//                 return b;
//             }
//         }
//         return null;
//     }
// 
//     public int toInteger() {
//         return this.mValue;
//     }
// }


// Path: user-intf/src/test/java/br/com/hole19/marvel/commons/adapter/TestViewHolderFactor.java
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import junit.framework.TestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mockito;
import br.com.hole19.marvel.R;
import br.com.hole19.marvel.ui.commons.adapter.ViewHolderFactory;
import br.com.hole19.marvel.ui.commons.model.LayoutType;

package br.com.hole19.marvel.commons.adapter;





/**
 * Created by edgar on 08-May-16.
 */
@RunWith(JUnit4.class)
public class TestViewHolderFactor extends TestCase {

    ViewHolderFactory viewHolderFactor;

    @Test
    public void testGetViewHolderSmallVertical () {
        int layoutType = LayoutType.SMALL_VERTICAL.toInteger();

        this.viewHolderFactor = Mockito.mock(ViewHolderFactory.class);
        ViewGroup viewGroup = Mockito.mock(ViewGroup.class);
        Mockito.when(viewHolderFactor.getViewHolder(viewGroup, layoutType)).thenCallRealMethod();
        Context context = Mockito.mock(Context.class);
        Mockito.when(viewGroup.getContext()).thenReturn(context);
        LayoutInflater layoutInflater = Mockito.mock(LayoutInflater.class);
        Mockito.when(viewHolderFactor.getLayoutInflater(context)).thenReturn(layoutInflater);
        Mockito.when(layoutInflater.inflate(R.layout.rsc_util_item_small, viewGroup, false)).thenReturn(Mockito.mock(View.class));
        RecyclerView.ViewHolder result = viewHolderFactor.getViewHolder(viewGroup, layoutType);
        assertNotNull(result);