为什么 private Context context;
public ExploreHorizontalAdapter(Context context) {
this.context = context;
}
@Override
public RecommendedHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.custom_explore_hor_item, parent, false);
RecommendedHolder holder = new RecommendedHolder(view);
return holder;
}
@Override
public void onBindViewHolder(RecommendedHolder holder, int position) {
}
@Override
public int getItemCount() {
return 5;
}
class RecommendedHolder extends RecyclerView.ViewHolder {
private TextView tvFeatured;
private TextView tvVenue;
private TextView tvVenueName;
private TextView tvLocation;
private TextView tvRating;
private TextView tvAmount;
private ImageView ivShare;
private ImageView ivBookmark;
public RecommendedHolder(View itemView) {
super(itemView);
tvFeatured = (TextView) itemView.findViewById(R.id.tv_featured);
tvVenue = (TextView) itemView.findViewById(R.id.tv_venue);
tvVenueName = (TextView) itemView.findViewById(R.id.tv_venue_name);
tvLocation = (TextView) itemView.findViewById(R.id.tv_location);
tvRating = (TextView) itemView.findViewById(R.id.tv_rating);
tvAmount = (TextView) itemView.findViewById(R.id.tv_rate);
}
}
在我的代码中返回0而不是201:
responsetest.getStatus()
builder也使用mockito @Mock
进行模拟