ViewRoleSelection implements Transferable { @Override public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { if (isDataFlavorSupported(flavor)) { return transferredViewRoles; } return null; } ViewRoleSelection(View[] transferredViewRoles); @Override Object getTransferData(DataFlavor flavor); @Override DataFlavor[] getTransferDataFlavors(); @Override boolean isDataFlavorSupported(DataFlavor flavor);  }
@Test public void testGetTransferData() throws Exception { DataFlavor flavor = View.DATA_FLAVOR; Object returnee = subjectClass.getTransferData(flavor); assertNotNull(returnee); Object nullReturnee = subjectClass.getTransferData(null); assertNull(nullReturnee); }