Package org.bladerunnerjs.model.exception.request

Examples of org.bladerunnerjs.model.exception.request.MalformedRequestException


public class MalformedBundlerRequestExceptionTest {

  @Test
  public void testCreatingExceptionWithAllArgsProvided() throws Exception {
    try {
      MalformedRequestException ex = new MalformedRequestException("foo.bundle", "oops, there was a problem");
      ex.setCharacterNumber(4);
      throw ex;
    } catch (MalformedRequestException ex) {
      String[] exceptionLines = ex.toString().split("\n");
      assertEquals( "MalformedBundlerRequestException when processing the request 'foo.bundle'.", exceptionLines[0] );
      assertEquals( "Invalid character at position 4: foo.bundle", exceptionLines[1] );
      assertEquals( "                                    ^", exceptionLines[2] );
      assertEquals( "oops, there was a problem", exceptionLines[3] );
      assertEquals( "The stack trace for the exception is below.", exceptionLines[4] );
View Full Code Here


  }
 
  @Test
  public void testCreatingExceptionWithoutMessage() throws Exception {
    try {
      MalformedRequestException ex = new MalformedRequestException("foo.bundle", null);
      ex.setCharacterNumber(4);
      throw ex;
    } catch (MalformedRequestException ex) {
      String[] exceptionLines = ex.toString().split("\n");
      assertEquals( "MalformedBundlerRequestException when processing the request 'foo.bundle'.", exceptionLines[0] );
      assertEquals( "Invalid character at position 4: foo.bundle", exceptionLines[1] );
      assertEquals( "                                    ^", exceptionLines[2] );
      assertEquals( "The stack trace for the exception is below.", exceptionLines[3] );
      assertTrue( exceptionLines[4].contains(getCurrentClassAndMethod()) );
View Full Code Here

  }
 
  @Test
  public void testCreatingExceptionWithoutCharNumber() throws Exception {
    try {
      throw new MalformedRequestException("foo.bundle", "oops, there was a problem");
    } catch (MalformedRequestException ex) {
      String[] exceptionLines = ex.toString().split("\n");
      assertEquals( "MalformedBundlerRequestException when processing the request 'foo.bundle'.", exceptionLines[0] );
      assertEquals( "oops, there was a problem", exceptionLines[1] );
      assertEquals( "The stack trace for the exception is below.", exceptionLines[2] );
View Full Code Here

  }
 
  @Test
  public void testCreatingExceptionWithoutUrl() throws Exception {
    try {
      MalformedRequestException ex = new MalformedRequestException(null, "oops, there was a problem");
      ex.setCharacterNumber(4);
      throw ex;
    } catch (MalformedRequestException ex) {
      String[] exceptionLines = ex.toString().split("\n");
      assertEquals( "MalformedBundlerRequestException.", exceptionLines[0] );
      assertEquals( "oops, there was a problem", exceptionLines[1] );
      assertEquals( "The stack trace for the exception is below.", exceptionLines[2] );
      assertTrue( exceptionLines[3].contains(getCurrentClassAndMethod()) );
    }
View Full Code Here

  }
 
  @Test
  public void testCreatingExceptionWithOnlyAMessage() throws Exception {
    try {
      throw new MalformedRequestException(null, "oops, there was a problem");
    } catch (MalformedRequestException ex) {
      String[] exceptionLines = ex.toString().split("\n");
      assertEquals( "MalformedBundlerRequestException.", exceptionLines[0] );
      assertEquals( "oops, there was a problem", exceptionLines[1] );
      assertEquals( "The stack trace for the exception is below.", exceptionLines[2] );
View Full Code Here

  }
 
  @Test
  public void testCreatingExceptionWithoutUrlCharNumberOrMessage() throws Exception {
    try {
      throw new MalformedRequestException(null, null);
    } catch (MalformedRequestException ex) {
      String[] exceptionLines = ex.toString().split("\n");
      assertEquals( "MalformedBundlerRequestException.", exceptionLines[0] );
      assertEquals( "The stack trace for the exception is below.", exceptionLines[1] );
    }   
View Full Code Here

          lastMatchPos = requestLastMatchPos;
        }
      }
    }

    MalformedRequestException ex = new MalformedRequestException(request, "Request did not match " + requestFormPatterns);
    ex.setCharacterNumber(lastMatchPos + 1);
    throw ex;
  }
View Full Code Here

  {
    String aspectName = contentPathProperties.get("aspect");

    if (aspectName.equals("default/"))
    {
      throw new MalformedRequestException(requestPath, "The '/default' prefix should be omitted for the default aspect.");
    }
    else if (aspectName.isEmpty())
    {
      aspectName = "default";
    }
View Full Code Here

TOP

Related Classes of org.bladerunnerjs.model.exception.request.MalformedRequestException

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.