Example usage for org.apache.commons.collections TransformerUtils constantTransformer

List of usage examples for org.apache.commons.collections TransformerUtils constantTransformer

Introduction

In this page you can find the example usage for org.apache.commons.collections TransformerUtils constantTransformer.

Prototype

public static Transformer constantTransformer(Object constantToReturn) 

Source Link

Document

Creates a Transformer that will return the same object each time the transformer is used.

Usage

From source file:CookieBagV2.java

private void prepareCookieBag() {
    cookieBag = TransformedBag.decorate(new HashBag(Arrays.asList(cookieJar)),
            TransformerUtils.constantTransformer(cookieJar[2]));
    // cookieBag.addAll(Arrays.asList(cookieJar));
}

From source file:com.redhat.rhn.frontend.servlets.test.PxtSessionDelegateImplTest.java

public final void testLoadPxtSessionWhenPxtSessionIdIsNull() {
    setUpLoadPxtSession();/*from w  ww.ja v  a2s. c  om*/

    mockRequest.stubs().method("getCookies").will(returnValue(null));

    pxtSessionDelegate.setCreatePxtSessionCallback(TransformerUtils.constantTransformer(getPxtSession()));

    pxtSessionDelegate.loadPxtSession(getRequest());
}

From source file:com.redhat.rhn.frontend.servlets.test.PxtSessionDelegateImplTest.java

public final void testLoadPxtSessionWhenPxtSessionIdIsInvalid() {
    setUpLoadPxtSession();/*from   w ww .  jav  a  2  s.c o m*/

    mockRequest.stubs().method("getCookies").will(returnValue(new Cookie[] { getPxtCookie() }));

    pxtSessionDelegate.setCreatePxtSessionCallback(TransformerUtils.constantTransformer(getPxtSession()));

    pxtSessionDelegate.loadPxtSession(getRequest());
}