1 package org.robolectric.shadows; 2 3 import static com.google.common.truth.Truth.assertThat; 4 5 import android.view.ViewGroup; 6 import androidx.test.ext.junit.runners.AndroidJUnit4; 7 import org.junit.Test; 8 import org.junit.runner.RunWith; 9 10 @RunWith(AndroidJUnit4.class) 11 public class ShadowMarginLayoutParamsTest { 12 13 @Test testSetMargins()14 public void testSetMargins() { 15 ViewGroup.MarginLayoutParams marginLayoutParams = new ViewGroup.MarginLayoutParams(0, 0); 16 marginLayoutParams.setMargins(1, 2, 3, 4); 17 assertThat(marginLayoutParams.leftMargin).isEqualTo(1); 18 assertThat(marginLayoutParams.topMargin).isEqualTo(2); 19 assertThat(marginLayoutParams.rightMargin).isEqualTo(3); 20 assertThat(marginLayoutParams.bottomMargin).isEqualTo(4); 21 } 22 } 23