3
我寫了一個Grails的標籤,這只是圍繞Grails select tag單元測試Grails標記
package com.example
class MyTagLib {
def listTrees = {attrs ->
List<TreeDto> allTrees = getMandatoryAttributeValue(attrs, 'trees')
out << g.select(from: allTrees)
}
}
很薄的包裝,我wrtitten該等級的單元測試,但是當我運行它,我執行最後一行時,出現以下錯誤:
groovy.lang.MissingMethodException:法無 簽名: com.example.MyTagLib.select()是參數類型適用 : (java中。 util.LinkedHashMap)
運行單元測試時,似乎在g
命名空間中對grails標記的引用不可用。我嘗試了創建一個集成測試,但這也不起作用。
有沒有辦法測試一個標籤,調用另一個標籤,而不會剔除/嘲笑其他標籤的輸出?
問題是FormTagLib的某些屬性沒有正確模擬。見http://jira.grails.org/browse/GRAILS-5027 – tuler 2011-07-19 19:13:42