### Question:
ToolsAwt { public static void createBufferStrategy(java.awt.Canvas component, GraphicsConfiguration conf) { try { component.createBufferStrategy(2, conf.getBufferCapabilities()); } catch (final AWTException exception) { Verbose.exception(exception); component.createBufferStrategy(1); } } private  ToolsAwt(); static int getTransparency(Transparency transparency); static BufferedImage createImage(int width, int height, int transparency); static BufferedImage getImage(InputStream input); static ImageBuffer getImageBuffer(BufferedImage image); static void saveImage(BufferedImage image, OutputStream output); static BufferedImage copyImage(BufferedImage image); static int[] getImageData(BufferedImage image); static BufferedImage applyMask(BufferedImage image, int rgba); static BufferedImage rotate(BufferedImage image, int angle); static BufferedImage resize(BufferedImage image, int width, int height); static BufferedImage flipHorizontal(BufferedImage image); static BufferedImage flipVertical(BufferedImage image); static BufferedImage[] splitImage(BufferedImage image, int h, int v); static BufferedImage getRasterBuffer(BufferedImage image, double fr, double fg, double fb); static Cursor createHiddenCursor(); static void createBufferStrategy(java.awt.Canvas component, GraphicsConfiguration conf); static void createBufferStrategy(java.awt.Window component, GraphicsConfiguration conf); static void optimizeGraphicsQuality(Graphics2D g); static void optimizeGraphicsSpeed(Graphics2D g);  }### Answer:
@Test void testCreateBufferStrategyCanvas() { final AtomicReference<Integer> result = new AtomicReference<>(); ToolsAwt.createBufferStrategy(new java.awt.Canvas(null) { @Override public void createBufferStrategy(int numBuffers, BufferCapabilities caps) throws java.awt.AWTException { result.set(Integer.valueOf(numBuffers)); } }, GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration()); assertEquals(2, result.get().intValue()); }
@Test void testCreateBufferStrategyFailCanvas() { final AtomicReference<Integer> result = new AtomicReference<>(); Verbose.info("*********************************** EXPECTED VERBOSE ***********************************"); ToolsAwt.createBufferStrategy(new java.awt.Canvas(null) { @Override public void createBufferStrategy(int numBuffers, BufferCapabilities caps) throws java.awt.AWTException { if (numBuffers != 1) { throw new java.awt.AWTException(Constant.EMPTY_STRING); } result.set(Integer.valueOf(numBuffers)); } }, GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration()); Verbose.info("****************************************************************************************"); assertEquals(1, result.get().intValue()); }
@Test void testCreateBufferStrategyWindow() { final AtomicReference<Integer> result = new AtomicReference<>(); ToolsAwt.createBufferStrategy(new java.awt.Window(null) { @Override public void createBufferStrategy(int numBuffers, BufferCapabilities caps) throws java.awt.AWTException { result.set(Integer.valueOf(numBuffers)); } }, GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration()); assertEquals(2, result.get().intValue()); }
@Test void testCreateBufferStrategyFailWindow() { final AtomicReference<Integer> result = new AtomicReference<>(); Verbose.info("*********************************** EXPECTED VERBOSE ***********************************"); ToolsAwt.createBufferStrategy(new java.awt.Window(null) { @Override public void createBufferStrategy(int numBuffers, BufferCapabilities caps) throws java.awt.AWTException { if (numBuffers != 1) { throw new java.awt.AWTException(Constant.EMPTY_STRING); } result.set(Integer.valueOf(numBuffers)); } }, GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration()); Verbose.info("****************************************************************************************"); assertEquals(1, result.get().intValue()); }