MasterSlaveNodeServiceImpl extends AbstractService implements MasterSlaveNodeService { @Override public List<MasterNodeView> getAllNodes() { List<MasterSlaveNodeData> masterSlaveNodeDataList; List<MasterNodeView> masterNodeViewList = new ArrayList<>(); try { masterSlaveNodeDataList = masterSlaveApiFactory.nodeApi().getAllNodes(); } catch (Exception e) { LoggerHelper.warn("select all standby nodes failed, has been ignored [" + e.getClass().getName() + ", " + e.getMessage() + "]"); return masterNodeViewList; } if (masterSlaveNodeDataList == null) { return new ArrayList<>(); } for (MasterSlaveNodeData masterSlaveNodeData : masterSlaveNodeDataList) { MasterNodeView masterNodeView = new MasterNodeView(); masterNodeView.setId(masterSlaveNodeData.getId()); if (masterSlaveNodeData.getData() != null) { ReflectHelper.copyFieldValues(masterSlaveNodeData.getData(), masterNodeView); } masterNodeViewList.add(masterNodeView); } return masterNodeViewList; }  @Override List<MasterNodeView> getAllNodes();  }
@Test public void getAllJobs() { List<MasterNodeView> nodeViews = masterSlaveNodeService.getAllNodes(); Assert.assertNotNull(nodeViews); Assert.assertTrue(nodeViews.size() == 0); }