Hello everybody,
I have a custom templating function (MyProjectTemplatingFunction), built using
a constructor like this:
[code]
@Inject
public MyProjectTemplatingFunction(TemplatingFunctions cmsfn,
STKTemplatingFunctions stkfn, DamTemplatingFunctions damfn,
NectarTemplatingFunctions nectarfn) {
this.cmsfn = cmsfn;
this.stkfn = stkfn;
this.damfn = damfn;
}
[/code]
I need to test one method of my class. How can I build a JUnit test case using
Components and IoC?
This is the test method, I need something to replace the <???>:
[code]
private Map<String, String> sectionColorMap = new TreeMap<String, String>(new
ReverseLengthComparator());
@Before
public void setup() {
sectionColorMap.put("/section2/section3", "blue");
sectionColorMap.put("/", "red");
sectionColorMap.put("/section1/section3", "black");
sectionColorMap.put("/section3", "green");
sectionColorMap.put("/section1/section4", "yellow");
}
@Test
public void treeMapTest() {
for (String key : sectionColorMap.keySet()) {
log.info("- {}: {}", key, sectionColorMap.get(key));
}
MyProjectTemplatingFunction fn = <???>
assertEquals(fn.getContentColor("/section2/section3/content1"), "blue");
assertEquals(fn.getContentColor("/section2/content1"), "red");
assertEquals(fn.getContentColor("/section5/content1"), "red");
assertEquals(fn.getContentColor("/section3/content1"), "green");
}
[/code]
Thanks!!
--
Context is everything:
http://forum.magnolia-cms.com/forum/thread.html?threadId=c6ce2120-434e-4267-99d0-611b20bb20c8
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------