您好,登錄后才能下訂單哦!
注入類
@Component
public class ApplyNodesDefines implements ApplicationContextAware{
private static BaseDao baseDao;
private static volatile Map<String, LinkedHashMap<String, ApplyProcessNode>> typeToProcessNodes = new HashMap<>();
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
baseDao = applicationContext.getBean(BaseDao.class);
}
public static List<ApplyProcessNode> getNodeDefinationList() {
Map<String, String> params = new HashMap();
return baseDao.queryForList("APPLY_QUERY.APPLY_PROCESS_NODE_QUERY", params, ApplyProcessNode.class);
}
}
測試類
public class ApplyNodesDefinesTest{@Mock
br/>@Mock
br/>@Mock
br/>@InjectMocks
br/>@Mock
br/>@BeforeClass
MockitoAnnotations.initMocks(this);
ApplicationContext applicationContext = Mockito.mock(ApplicationContext.class);
Mockito.when(applicationContext.getBean(BaseDao.class)).thenReturn(baseDao );
ApplicationContextAware applicationContextAware = new ApplyNodesDefines();
applicationContextAware.setApplicationContext(applicationContext);
}
@Test
public void getNodeDefinationListTest(){
when(baseDao.queryForList(eq("APPLY_QUERY.APPLY_PROCESS_NODE_QUERY"), anyMap(), eq(ApplyProcessNode.class))).thenReturn(new ArrayList());
applyNodeDefines.getNodeDefinationList();
}
}
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。