Tuesday, September 11, 2012

Mockito return the value from the response

An example:
private HttpServletRequest request = mock(HttpServletRequest.class);
    private HttpServletResponse response = mock(HttpServletResponse.class);

    public void testAuthz() throws Exception {
        AuthorizationEndpoint endpoint = new AuthorizationEndpoint();

        final ArrayList values = new ArrayList();
        doAnswer(new Answer() {
            public Object answer(InvocationOnMock invocation) throws Throwable {
                String temp = (String) invocation.getArguments()[0];
                return null;

        httpRequest("GET", "/authorization");

        endpoint.service(request, response);

        String redirectURL = values.get(0);

        URL url = new URL(redirectURL);
        String fragment = url.toURI().getQuery();
        Map map = OAuthUtils.decodeForm(fragment);


    private void httpRequest(String method, String pathInfo) {

Monday, September 10, 2012

Fedora: Skype Issue: libXv.so.1: cannot open

If you try to run skype and get the following error
skype: error while loading shared libraries: libXv.so.1: cannot open

$>sudo yum install alsa-lib.i686 libXv.i686 libXScrnSaver.i686 qt.i686 qt-x11.i686

Wednesday, September 05, 2012

Eclipse Heap Settings on Mac

Locating the eclipse.ini is tricky on a mac.

To locate it, right-click on the Eclipse Application icon and select "Show Package Contents", then double-click on the "Contents" folder and then double-click on the "MacOS" folder, the home of eclipse.ini

You can use Applications->Text Edit to change the eclipse.ini file. :)

Usually you want to adjust the heap settings.