Home | History | Annotate | Download | only in testutil
      1 package com.bumptech.glide.testutil;
      2 
      3 import java.io.InputStream;
      4 
      5 /**
      6  * Test only utility for opening resources in androidTest/resources.
      7  */
      8 public final class TestResourceUtil {
      9     private TestResourceUtil() {
     10         // Utility class
     11     }
     12 
     13     /**
     14      * Returns an InputStream for the given test class and sub-path.
     15      *
     16      * @param testClass A Junit test class.
     17      * @param subPath The sub-path under androidTest/resources where the desired resource is located.
     18      *                Should not be prefixed with a '/'
     19      */
     20     public static InputStream openResource(Class testClass, String subPath) {
     21         return testClass.getResourceAsStream("/" + subPath);
     22     }
     23 }
     24