Package org.candlepin.common.exceptions

Examples of org.candlepin.common.exceptions.CandlepinException


        verifyMessage(r, rtmsg("null accept header"));
    }

    @Test
    public void candlepinException() {
        CandlepinException ce = mock(CandlepinException.class);
        when(ce.httpReturnCode()).thenReturn(Status.CONFLICT);
        ExceptionMessage em = new ExceptionMessage().setDisplayMessage("you screwed up");
        when(ce.message()).thenReturn(em);
        when(req.getHeader(HttpHeaderNames.ACCEPT)).thenReturn("application/json");

        assertEquals("you screwed up", em.toString());
        Response r = rem.toResponse(ce);
        assertNotNull(r);
View Full Code Here


        verifyMessage(r, "you screwed up");
    }

    @Test
    public void candlepinExceptionWithChildNotCandleping() {
        CandlepinException ce = mock(CandlepinException.class);
        when(ce.httpReturnCode()).thenReturn(Status.CONFLICT);
        when(ce.message()).thenReturn(
            new ExceptionMessage().setDisplayMessage("you screwed up"));
        when(req.getHeader(HttpHeaderNames.ACCEPT)).thenReturn("application/json");
        when(ce.getCause()).thenReturn(new ConflictException("you screwed up"));
        Response r = rem.toResponse(ce);
        assertNotNull(r);
        assertEquals(Status.CONFLICT.getStatusCode(), r.getStatus());
        verifyMessage(r, "you screwed up");
    }
View Full Code Here

            }
            Response.Status returnCode = Response.Status.fromStatusCode(e
                .getHttpStatusCode());
            String message = i18n.tr("OAuth problem encountered. Internal message is: {0}",
                e.getMessage());
            throw new CandlepinException(returnCode, message);
        }
        catch (OAuthException e) {
            log.debug("OAuth Error", e);
            String message = i18n.tr("OAuth error encountered. Internal message is: {0}",
                e.getMessage());
View Full Code Here

TOP

Related Classes of org.candlepin.common.exceptions.CandlepinException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.