### Question:
MeliTag extends RelativeLayout { final public void setThumbnailShown(boolean thumbnailShown) { this.thumbnailShown = thumbnailShown; final ConstraintSet constraintSet = new ConstraintSet(); if (thumbnailShown) { thumbnail.setVisibility(VISIBLE); constraintSet.clone(container); constraintSet.clear(textView.getId(), ConstraintSet.LEFT); constraintSet.connect(textView.getId(), ConstraintSet.START, thumbnail.getId(), ConstraintSet.END, marginSmall); setEndConstraint(constraintSet); } else { thumbnail.setVisibility(GONE); constraintSet.clone(container); constraintSet.connect(textView.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START, marginBig); setEndConstraint(constraintSet); } constraintSet.applyTo(container); } MeliTag(Context context);  MeliTag(Context context, @Nullable AttributeSet attrs);  MeliTag(Context context, @Nullable AttributeSet attrs, int defStyleAttr); @Nullable String getText(); final void setText(@Nullable String text); boolean isThumbnailShown(); final void setThumbnailShown(boolean thumbnailShown); boolean isCloseButtonShown(); final void setCloseButtonShown(boolean closeButtonShown); final void setThumbnailDrawable(int resourceId); final void setThumbnailDrawable(@NonNull String url); final void setCloseButtonDrawable(int resourceId); final void setTextColor(@NonNull ColorStateList textColor); final void setTextColor(int color); @Override final void setBackgroundColor(int color); final void setOnCloseListener(@Nullable OnClickListener l); TextView getTextView(); @NonNull ConstraintLayout getContainer(); @NonNull SimpleDraweeView getThumbnail(); @NonNull ImageView getCloseButton();  }### Answer:
@Test public void testSetThumbnailShown() { assertEquals(thumbnail.getVisibility(), View.VISIBLE); meliTag.setThumbnailShown(false); assertEquals(thumbnail.getVisibility(), View.GONE); meliTag.setThumbnailShown(true); assertEquals(thumbnail.getVisibility(), View.VISIBLE); }
@Test public void testSetThumbnailShown_withCloseButtonVisible_textViewMarginsAreCorrect() { float density = context.getResources().getDisplayMetrics().density; int marginEnd = 0; final int marginStartForThumbnailShown = 8; final int marginStartForThumbnailNotShown = (int) (context.getResources().getDimension(R.dimen.ui_tag_background_radius) / density); assertEquals(marginEnd, ((ConstraintLayout.LayoutParams) textView.getLayoutParams()).getMarginEnd()); assertEquals(marginStartForThumbnailShown, ((ConstraintLayout.LayoutParams) textView.getLayoutParams()).getMarginStart()); meliTag.setThumbnailShown(false); assertEquals(marginEnd, ((ConstraintLayout.LayoutParams) textView.getLayoutParams()).getMarginEnd()); assertEquals(marginStartForThumbnailNotShown, ((ConstraintLayout.LayoutParams) textView.getLayoutParams()).getMarginStart()); }