Package org.moresbycoffee.mbyhave8.result

Examples of org.moresbycoffee.mbyhave8.result.StepResult$Error


    Error handleGenericException(Exception ex, HttpServletRequest request, HttpServletResponse response) {
        String errorId = LoggingUtil.generateErrorId();
        String errorMessage = generateLogErrorMessage(errorId) + " - Processing error";
        log.error(errorMessage, ex);

        Error error = new Error();
        error.setHttpStatusCode("500");
        error.setDeveloperMessage(messageSource.getMessage("api.genericException.developerMessage", null, request.getLocale()));
        error.setUserMessage(messageSource.getMessage("api.genericException.userMessage", null, request.getLocale()));
        error.setMoreInfo("support@knappsack.com");
        error.setErrorId(errorId);

        response.setStatus(500);

        return error;
    }
View Full Code Here


    Error handleEntityNotFoundException(Exception ex, HttpServletRequest request, HttpServletResponse response) {
        String errorId = LoggingUtil.generateErrorId();
        String errorMessage = generateLogErrorMessage(errorId) + " - No entity found";
        log.error(errorMessage, ex);

        Error error = new Error();
        error.setHttpStatusCode("400");
        error.setDeveloperMessage(messageSource.getMessage("api.entityNotFoundException.developerMessage=", null, request.getLocale()));
        error.setUserMessage(messageSource.getMessage("api.entityNotFoundException.userMessage", null, request.getLocale()));
        error.setMoreInfo("support@knappsack.com");
        error.setErrorId(errorId);

        response.setStatus(400);

        return error;
    }
View Full Code Here

    Error handleAccessDeniedException(AccessDeniedException ex, HttpServletRequest request, HttpServletResponse response) {
        String errorId = LoggingUtil.generateErrorId();
        String errorMessage = generateLogErrorMessage(errorId) + " - Access Denied";
        log.error(errorMessage, ex);

        Error error = new Error();
        error.setHttpStatusCode("403");
        error.setDeveloperMessage(messageSource.getMessage("api.accessDenied.developerMessage", null, request.getLocale()));
        error.setUserMessage(messageSource.getMessage("api.accessDenied.userMessage", null, request.getLocale()));
        error.setMoreInfo("support@knappsack.com");
        error.setErrorId(errorId);

        response.setStatus(403);

        return error;
    }
View Full Code Here

                errorId = (String) entry.getValue();
                errorCode = (String) entry.getValue();
              }
            }

                                                Error err = this._errors.get(errorCode);
                                                if (err == null){
                                                    err = Bpmn2Factory.eINSTANCE.createError();
                                                    err.setId(errorId);
                                                    err.setErrorCode(errorCode);
                                                    this._errors.put(errorCode, err);
                                                }
                                               
            toAddErrors.add(err);
            ((ErrorEventDefinition) ed).setErrorRef(err);
View Full Code Here

                                errorId = (String) entry.getValue();
                                errorCode = (String) entry.getValue();
                            }
                        }

                        Error err = this._errors.get(errorCode);
                        if (err == null){
                            err = Bpmn2Factory.eINSTANCE.createError();
                            err.setId(errorId);
                            err.setErrorCode(errorCode);
                            this._errors.put(errorCode, err);
                        }

                        toAddErrors.add(err);
                        ((ErrorEventDefinition) ed).setErrorRef(err);
View Full Code Here

                                                errorId = (String) entry.getValue();
                                                errorCode = (String) entry.getValue();
                                        }
                                }

                                Error err = this._errors.get(errorCode);
                                if (err == null){
                                    err = Bpmn2Factory.eINSTANCE.createError();
                                    err.setId(errorId);
                                    err.setErrorCode(errorCode);
                                    this._errors.put(errorCode, err);
                                }

                                toAddErrors.add(err);
                                ((ErrorEventDefinition) ed).setErrorRef(err);
View Full Code Here

                                errorId = (String) entry.getValue();
                                errorCode = (String) entry.getValue();
                            }
                        }

                        Error err = this._errors.get(errorCode);
                        if (err == null){
                            err = Bpmn2Factory.eINSTANCE.createError();
                            err.setId(errorId);
                            err.setErrorCode(errorCode);
                            this._errors.put(errorCode, err);
                        }

                        toAddErrors.add(err);
                        ((ErrorEventDefinition) ed).setErrorRef(err);
View Full Code Here

*/
public class ImplementationLessStepTest {

    @Test
    public void implementationless_step_should_make_test_pending() {
        val spec = new MByHaveSpec() {{
            Feature("Implementationless step",
                Scenario("testing implementationless step",
                    given("a step without implementation")));
        }};

        val output = spec.execute();

        assertEquals(SpecResult.Pending, output.getResult());
    }
View Full Code Here

public class SimpleFeatureWithoutRunnerTest {

    @Test
    public void feature_with_one_scenario_and_one_SUCCESS_step_should_be_SUCCESS_format1() {
        val flag = new AtomicBoolean(false);
        val spec = new MByHaveSpec() {
            {
                Feature("this is a feature in the runner",
                    Scenario("this is a scenario",
                        given("something", this::givenStepImplementation)));
            }

            void givenStepImplementation() {
                flag.set(true);
            }
        };

        assertFalse(flag.get());
        val output = spec.execute();
        assertTrue(flag.get());

        assertEquals(SpecResult.Success, output.getResult());
    }
View Full Code Here

    }

    @Test
    public void feature_with_one_scenario_and_one_SUCCESS_step_should_be_SUCCESS_format2() {
        val hasGivenBeenVisited = new AtomicBoolean(false);
        val spec = new MByHaveSpec() {{
            Feature("this is a feature in the runner",
                Scenario("this is a scenario",
                    given("something", () -> { hasGivenBeenVisited.set(true); })));
        }};

        assertFalse(hasGivenBeenVisited.get());
        val output = spec.execute();
        assertTrue(hasGivenBeenVisited.get());
        assertEquals(SpecResult.Success, output.getResult());
    }
View Full Code Here

TOP

Related Classes of org.moresbycoffee.mbyhave8.result.StepResult$Error

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.