Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RunWith(PowerMockRunner.class)
- @PrepareForTest( {ByteBitmapConverters.class, BitmapFactory.class })
- public class ByteBitmapConvertersTest {
- @Before
- public void setup() {
- //MockitoAnnotations.initMocks(this);
- PowerMockito.mockStatic(BitmapFactory.class);
- }
- public Bitmap LoadBitmapFromTestResources(){
- ClassLoader classLoader = getClass().getClassLoader();
- URL resource = classLoader.getResource("for_tests.png");
- File file = new File(resource.getPath());
- boolean exists = file.exists(); //equals "true", so file exists
- BitmapFactory.Options options = new BitmapFactory.Options();
- options.inPreferredConfig = Bitmap.Config.ARGB_8888;
- return BitmapFactory.decodeFile(resource.getPath(), options);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement