1 package org.robolectric.shadows;
2 
3 import static com.google.common.truth.Truth.assertThat;
4 import static org.robolectric.Shadows.shadowOf;
5 
6 import android.graphics.SurfaceTexture;
7 import android.view.Surface;
8 import androidx.test.ext.junit.runners.AndroidJUnit4;
9 import org.junit.Test;
10 import org.junit.runner.RunWith;
11 
12 @RunWith(AndroidJUnit4.class)
13 public class ShadowSurfaceTest {
14   private final SurfaceTexture texture = new SurfaceTexture(0);
15   private final Surface surface = new Surface(texture);
16 
17   @Test
getSurfaceTexture_returnsSurfaceTexture()18   public void getSurfaceTexture_returnsSurfaceTexture() throws Exception {
19     assertThat(shadowOf(surface).getSurfaceTexture()).isEqualTo(texture);
20   }
21 
22   @Test
release_doesNotThrow()23   public void release_doesNotThrow() throws Exception {
24     surface.release();
25   }
26 
27   @Test
toString_returnsNotEmptyString()28   public void toString_returnsNotEmptyString() throws Exception {
29     assertThat(surface.toString()).isNotEmpty();
30   }
31 }
32