1 package com.xtremelabs.robolectric.shadows; 2 3 import com.xtremelabs.robolectric.WithTestDefaultsRunner; 4 5 import android.view.ViewGroup; 6 7 import org.junit.Test; 8 import org.junit.runner.RunWith; 9 10 import static org.hamcrest.CoreMatchers.equalTo; 11 import static org.junit.Assert.assertThat; 12 13 /** 14 * {@link ShadowMarginLayoutParams} test suite. 15 */ 16 @RunWith(WithTestDefaultsRunner.class) 17 public class MarginLayoutParamsTest { 18 19 @Test 20 public void testSetMargins() { 21 ViewGroup.MarginLayoutParams marginLayoutParams = new ViewGroup.MarginLayoutParams(0, 0); 22 marginLayoutParams.setMargins(1, 2, 3, 4); 23 assertThat(marginLayoutParams.leftMargin, equalTo(1)); 24 assertThat(marginLayoutParams.topMargin, equalTo(2)); 25 assertThat(marginLayoutParams.rightMargin, equalTo(3)); 26 assertThat(marginLayoutParams.bottomMargin, equalTo(4)); 27 } 28 } 29