### Question:
PrintPreview { public Bitmap getScaledBitmap(Context context) { cursor = VERTICAL_MARGIN; DisplayMetrics metrics = context.getResources().getDisplayMetrics(); Bitmap bitmap = getBitmap(); float pxPerMm = metrics.xdpi / 25.4f; int width = bitmap.getWidth(); float scale = (printerSettings.getPrintableWidth() * pxPerMm) / (float) width; return Bitmap.createScaledBitmap(bitmap, (int) (bitmap.getWidth() * scale), (int) (bitmap.getHeight() * scale), true); } PrintPreview(PrintPayload printPayload, PrinterSettings printerSettings); Bitmap getBitmap(); Bitmap getScaledBitmap(Context context); byte[] getCompressedBitmap(); int determineHeight();  }### Answer:
@Test public void canGetScaledBitmap() { PrintPreview printPreview = setupValidPrintPreview(true); ShadowBitmap bitmap = Shadows.shadowOf(printPreview.getScaledBitmap(RuntimeEnvironment.application)); assertThat(bitmap).isNotNull(); assertThat(bitmap.getDescription()).isEqualTo("Bitmap (576 x 48)\n" + "Bitmap (9 x 32) scaled to 708 x 59 with filter true"); }
@Test public void handlesNoFonts() { PrintPreview printPreview = setupValidPrintPreview(false); Bitmap bitmap = printPreview.getScaledBitmap(RuntimeEnvironment.application); assertThat(bitmap).isNotNull(); }