### Question:
MeliTag extends RelativeLayout { final public void setCloseButtonShown(boolean closeButtonShown) { this.closeButtonShown = closeButtonShown; final ConstraintSet constraintSet = new ConstraintSet(); if (closeButtonShown) { closeButton.setVisibility(VISIBLE); constraintSet.clone(container); constraintSet.clear(textView.getId(), ConstraintSet.RIGHT); constraintSet.connect(textView.getId(), ConstraintSet.END, closeButton.getId(), ConstraintSet.START); setStartConstraint(constraintSet); } else { closeButton.setVisibility(GONE); constraintSet.clone(container); constraintSet.connect(textView.getId(), ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END, marginBig); setStartConstraint(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 testSetCloseButtonShown() { assertEquals(closeButton.getVisibility(), View.VISIBLE); meliTag.setCloseButtonShown(false); assertEquals(closeButton.getVisibility(), View.GONE); meliTag.setCloseButtonShown(true); assertEquals(closeButton.getVisibility(), View.VISIBLE); }
@Test public void testSetCloseButtonShown_withThumbnailVisible_textViewMarginsAreCorrect() { float density = context.getResources().getDisplayMetrics().density; int marginStart = (int) (context.getResources().getDimension(R.dimen.ui_tag_background_margin) / density); final int marginEndForCloseButtonShown = 0; final int marginEndForCloseButtonNotShown = (int) (context.getResources().getDimension(R.dimen.ui_tag_background_radius) / density); assertEquals(marginStart, ((ConstraintLayout.LayoutParams) textView.getLayoutParams()).getMarginStart()); assertEquals(marginEndForCloseButtonShown, ((ConstraintLayout.LayoutParams) textView.getLayoutParams()).getMarginEnd()); meliTag.setCloseButtonShown(false); assertEquals(marginStart, ((ConstraintLayout.LayoutParams) textView.getLayoutParams()).getMarginStart()); assertEquals(marginEndForCloseButtonNotShown, ((ConstraintLayout.LayoutParams) textView.getLayoutParams()).getMarginEnd()); }