JUnit - How to assert exception is thrown?

If I use JUnit how do I assert an exception is thrown when I pass invalid parameters to a method I am testing? For example if I pass a username to a method that I know will cause the method to throw an InvalidUsernameException how do I assert this?

public void testBadParameter() {
  try {
    objectUnderTest.myMethod(badParameter);
    fail("Foo!");
  } catch (ExcpectedException e) {
    //ok
}

Similar Messages

  • Check if an exception is thrown during my JUnit test

    Hi all,
    I've been writing unit tests for the application I'm writing.
    I'm trying to write one very generic test which will simply open up the application, press some buttons, and close it back down, and confirm that no exceptions were thrown at any time during the test.
    Unfortunately, while I figured I could just wrap the whole thing in a try/catch block, it seems that I have an exception that is being thown in the AWT-EventQueue which isn't being caught. The test passes fine, but I want it to fail.
    What is the best way to go about checking for this? Should I be running the test in the event queue? Or should I have my own error handler to catch the exceptions?
    Thanks!
    Tim

    jschell wrote:
    TimQuinn wrote:
    I'm not trying to fix the bug. I'm trying to make my JUnit tests catch the exception. I think we're going around in circles here.Yep. Because the problem was stated incorrectly.
    Exceptions are returned up the call stack within the thread of execution.
    You have two threads. The one that the test runs in A, and another B.
    You can't catch or even see an exception in A that originated in B as an exception (you can't catch it.)
    So you need to find some other way, some other place, to put a catch, in thread B and then create data which indicates whether it worked or not. Or find some other existing data that changes state because of that.Well, the question that I asked in my original post was exactly that: how do I find out about an exception that is thrown in another thread? If something got stated incorrectly, maybe it was in the later posts?
    It can't be impossible: I can think of one very simple solution to my question, but it isn't very good. I can simply replace the Standard Error writer with one that sets a"fail" flag every time it is called. Then my test can fail every time Standard Error is written to, no matter which thread it's in. Obviously, this isn't a great solution, because, while it would fail the test every time an exception was printed, it would fail other times as well.
    So with a bit more work I could parse what's written to stderr myself, to check if it's a real exception. But this really seems like re-inventing the wheel. Is there no standard pattern for creating a test that confirms that you can run something without generating exceptions?

  • How to catch exception thrown by ActionBinding "Commit"

    I need a programmatic branch after the following line if an exception is thrown:
    ((JUCtrlActionBinding) panelBinding.findCtrlBinding("Commit")).invoke();
    I am building an ADFSwing application using JDev 10.1.3.
    I have a ViewObject derived from an EntityObject that I am trying to use for an insert.
    I have placed the line above in a try block with a "catch (JboException je)" block which includes the code I need to execute upon exception. A default error dialog appears when an exception is thrown "(oracle.jbo.AttrValException) JBO-27014: ...", but the catch block I have created is not executed.
    The effect is that a commit is not fulfilled, the default error dialog appears, but the program continues undaunted.
    I have included "setBundledExceptionMode(false)" just before the try block, but that doesn't make any difference.
    The commit statement above, and the try/catch block I've described are in a JUPanel.
    Any help on how and where I can catch an exception from the action binding is really appreciated!!

    You can use code like this:
         JUCtrlActionBinding commit = (JUCtrlActionBinding)panelBinding.findCtrlBinding("Commit");
         commit.invoke();
         if (!commit.getErrors().isEmpty()) {
           /* Error list not empty. Something went wrong. */
         }

  • How to catch exception thrown from a function module?

    Hi all,
             When we are calling a function module from JSPDynpage setting some import parameters, If in some case an exception is thrown in the function module.  How can we catch the same exception in the JSPDynpage program?
    Thanks & Regards,
    Ravi

    Hi Ravi
                                    Try this
                                                try
                    Object retMsgs = output.get(bapiretrunmsgobject);
                      if(result != null )
    IrecordSet rmsg = (IrecordSet) result
                   catch(Exception ex)
                        printException(ex, "Error getting function result");
    Lemme know for any further questions.
    Regards
    Praveen

  • How to fail messsages when timeout exception is thrown in BPM?

    Hi
    In my BPM, if the time out exception is thrown in BPM, in SXMB_MONI, all the inbound messages' staus is 'processed sucessfully' ? How can I make the message fail?  With a red flag  or anything indicating exception?
    In my design I used deadline branch to throw time out exception.And in the exception branch I used control step to cancel the process.

    Hi,
    In my design I used deadline branch to throw time out exception.And in the exception branch I used control step to cancel the process
    If this is what you have designed then increasing the timeout using the above mentioned blogs doesn't seem to be logical:) (BPM will throw the error when the deadline is meet....can't understand how by increasing timeout will help you)....instead of increasing the timeout you can increase the time limit mentioned in the deadline branch itself to ensure that your message will be processed in that particular time limit.
    Since you have reached the timeout it means that desired message processing has failed so better you raise an alert instead of going for a increase in timeout....increasing timeout decreases performance...
    Regards,
    Abhishek.

  • How to handle exception thrown in standard bo method in the workflow design

    Hi Experts
        how to handle exception thrown from standard bo method in the workflow design. For example, bo BUS2032, METHOD confirm. If the user cancel it, it will throw exception. In the workflow, how to catch this exception and add corresponding steps in the workflow.

    @jrockman li
    Try to implement the logic that what ever you are performing in the BO mehtod in a FM and in the FM you have tab with name EXECPTIONS define the execption in that tab.Now in the BO method you call this FM  and if the exception occurs by using RAISE you can raise the exception in the FM and based on the number of exceptions your sy-subrc value will be set
    so when sys-subrc is not eq 0 then pass a value back t the workflow container., I think this will work.
    a sample Snippet for understanding purpose
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename         = <path>
        filetype         = 'ASC'
      IMPORTING
        filelength       = lv_len
      TABLES
        data_tab         = l_txt_tab
      EXCEPTIONS
        file_write_error = 1          " If this Exception occurs
        invalid_type     = 2
        no_authority     = 3
        unknown_error    = 4
        OTHERS           = 10.
    CASE sy-subrc.
      WHEN 1. " SY-SUBRC value will be 1 then,
          " Pass or set the value back to the workflow conatiner element
    ENDCASE.

  • How can i solve this Exception that "How can i solve this exception that "End of stack trace from previous location where exception was thrown" in Windows phone 8.

    Hi Sir/Mam,
    Please give me solution for this problem.I tried this in all ways for solve this problem like i checked my all class objects cleared or not when leaving current page to come to before page.
    This Exception came at After saved data in the wp8 device database,then it is coming to back page(when i navigate to another page) then that navigated page running and go to "Public Asyn Void Listmenu()" method ,in this method again retrieve the
    data from database after getting this data,it shows this Exception.
    Note :-This Exception came in WP8 Device only,not in Emulator.In the Emulator it is working fine.
    My Exception:-
    Exception:- System.Exception.Exception.HRESULT:0*80040015
    at
    System.Runtime.CompliterServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at
    System.Runtime.ComplierServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at
    System.Runtime.ComplierServices.TaskAwaiter'1.GetResult()
    at
    _10Min._10MinUserPages.<checkStatusAndSavedDataExistinFormTable>d_e3.MoveNext()
    End of stack trace from previous location where exception was thrown
    at
    system.runtime.Compilerservices.TaskAwater.throwForNonSuccess(Task task)
    at
    System.Runtime.compilerservices.TaskAwaiter.HandlerNonSuccessAndDebuggerNotification(Task task)
    at
    System.Runtime.ComplierServices.TaskAwaiter'1.GetResult()
    at
    _10Min._10MinUserPages.<listmenu>d_8.MoveNext().
    How can i solve this problem please help me. I am suffering from 1 week days with this problem.
    Please help me.any one.
    Thanks & Regards,
    SrinivaaS.

    Is the flow of code to the point where exception occurs:
    1) Data saved in Db
    2) Navigated back
    3)Navigated to another page
    4) Method ListMenu() is called(as soon as navigated to page in step 3) to retrieve the saved data from db & exception occurs.
    Can you paste here the definition of ListMenu(), also does the exception occurs as soon as db is accessed inside this method or else.
    http://developer.nokia.com/community/wiki/Using_Crypto%2B%2B_library_with_Windows_Phone_8

  • How can the eclipse debugger break in the code when an exception is thrown

    Is there a way in eclipse to break into the bebugger when an exception is thrown in debug mode like Visual Studio 2003 or 2005?
    Thanks

    For 3.x, select "Add Java Exception Breakpoint" from the "Run" menu.
    Check "Caught" to break even if your code handles the exception, "Uncaught" to break when your code doesn't handle the exception.

  • How to catch Exception in a JSP

    Hi there,
    I'm building my first JSP application. I still don't know what happens to an exception thrown inside a scrptlet in a JSP page.
    My JSP page is resultados.jsp (it processes a DB query):
    <%@ page contentType="text/html; charset=iso-8859-1" language="java"
    import="java.lang.*,java.sql.*,pcliente.*" errorPage="error.jsp" session="true" %>
    <html>
    <head>
    <title>PCliente - Hist?rico de Mainframe</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body background="imagens/sm_bg.gif">
    <TABLE border=0 cellPadding=0 cellSpacing=0>
    <TR>
    <TD width=5><IMG alt="" height=1 src="imagens/pixel.gif" width=5></TD>
    <TD vAlign=top width=125><jsp:include page="menu.jsp" flush="true" /> </TD>
    <TD width=25><IMG alt="" height=1 src="imagens/pixel.gif" width=25></TD>
    <TD vAlign=top width=365>
    <%
    try
    PCliente pcliente = new PCliente(request.getParameter("maquina"),
                        request.getParameter("acessorio"),
                        request.getParameter("contrato"),
                        request.getParameter("estabelecimento"),
                        request.getParameter("ifiscal"));
    ResultSet rs = pcliente.executarQuery();
    while (rs.next())
    out.println("<BR>" + rs.getString("nome_estab_instalacao"));
    out.print(" -----" + rs.getString("num_serie_equipamento"));
    out.print(" -----" + rs.getString("num_contrato"));
    /*** SQL exception is thrown by pcliente.executarQuery() ***/
    catch (SQLException sqlEx)
    out.println("<P>" + "There was an error doing the query:");
    out.println ("<PRE>" + sqlEx + "</PRE> \n <P>");
    application.log("Exception lan?ada", sqlEx);
    throw new Exception(sqlEx.toString());
    finally
    out.println("<P>" + "FINALLY !!!");
    %>
    </TD>
    </TR>
    </TABLE>
    </body>
    </html>
    The error.jsp is
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*,pcliente.*" isErrorPage="true" session="true" %>
    <html>
    <head>
    <title>PCliente - Hist?rico de Mainframe - Erro</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <strong>Pagina de Erro</strong>
    </body>
    </html>
    The java class I'm using in this JSP is pcliente/PCliente with the source code:
    package pcliente;
    import java.sql.*;
    public class PCliente
    private String numSerieMaquina, numSerieAcessorio, numContrato, numEstabelecimento, ifiscal;
    private String strQuery;
    private Connection conn;
    private ResultSet rs;
    private Statement stmt;
    public PCliente(String numSerieMaquina, String numSerieAcessorio,
                        String numContrato, String numEstabelecimento,
                        String ifiscal)
    conn = null;
    rs = null;
    stmt = null;
    this.numSerieMaquina = numSerieMaquina;
    this.numSerieAcessorio = numSerieAcessorio;
    this.numContrato = numContrato;
    this.numEstabelecimento = numEstabelecimento;
    this.ifiscal = ifiscal;
    construirQuery();
    public ResultSet executarQuery() throws SQLException
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    /* This causes SQLException as a 'c' was taken from oracle in
    "jdbc:orale:oci8:@PROD" */
    conn = DriverManager.getConnection("jdbc:orale:oci8:@PROD","histmain", "histmain");
    stmt = conn.createStatement();
    rs = stmt.executeQuery(strQuery);
    return rs;
    private void construirQuery()
    strQuery = "SELECT num_serie_equipamento, num_contrato,
    nome_estab_instalacao" +
         " FROM anmpf04" +
         " WHERE 1 = 1";
    if (numSerieMaquina != null)
    if (numSerieMaquina.indexOf('%') == -1)
    strQuery += " AND num_serie_facturacao = " + numSerieMaquina;
    else     
    strQuery += " AND num_serie_facturacao LIKE '" + numSerieMaquina + "'";
    When I execute the JSP I see a page with the text FINALLY !!!
    But an exception was thrown and I can't,
    see
    out.println("<P>" + "There was an error doing the query:");
    out.println ("<PRE>" + sqlEx + "</PRE> \n <P>");
    in the jsp page
    application.log("Exception lan?ada", sqlEx);
    don't know where to find the log file
    throw new Exception(sqlEx.toString());
    isn't caught by the error page error.jsp
    What am I missing here ? a lot of stuff no doubt !
    Can anyone give me suggestion(s) on how to detect an Exception ?
    I would also apreciate a site with documentation regarding Exception processing inside JSP.
    Many thanks,
    MGoncalv

    Hi there,
    I'm building my first JSP application. I still don't
    know what happens to an exception thrown inside a
    scrptlet in a JSP page.I believe that any scriptlet exceptions get wrapped into a ServletException. At that time, if you have an errorPage defined for you JSP page, then it will go there. If you don't then the server will try to find the particular exception type in an <error-page> stanza in the web.xml. If it finds a mapping, it will go to that mapping, otherwise it will go to a default error page (container specific).
    A quick glance at your design shows some big problems though that you may or may not hit (depending on how often you hit the page in your testing). The primary one is that in your PCliente class, you are opening up database connections/statements/results sets w/o closing them. You will run out of connections/cursors at some point b/c of this. You need to do your reads from the database and then close those resources (in a finally block to make sure they get closed). Read the data in a lightweight java object that the JSP can use to actually get the data.
    Also, you only need to register the driver manager once. You can do this in static initialization block.
    ncuka

  • How to throw exception in run() method of Runnable?

    Hi, everyone:
    I want to know how to throw exception in run() method of interface Runnable. Since there is no throwable exception declared in run() method of interface Runnable in Java API specification.
    Thanks in advance,
    George

    Thanks, jfbriere.
    I must add though that if your run() methodis
    executed after a call to Thread.start(), then
    it is not a good choice to throw anyRuntimeException
    from the run() method.
    The reason is that the thrown exception won't be
    handled appropriately by a try-catch block.Why do you say that "the thrown exception won't be
    handled appropriately by a try-catch block"? Can you
    explain it in more detail?
    regards,
    George
    Because the other thread runs concurrently with and independently of the parent thread, there's no way you can write a try/catch that will handle the new thread's exception: try {
        myThread.start();
    catch (TheExceptionYouWantToThrowFromRun exc) {
        handle it
    do the next thing This won't work because the parent thread just continues on after myThread.start(). Start() doesn't throw the exception--run() does. And our parent thread here has lost touch with the child thread--it just moves on to "do the next thing."
    Now, you can do some exception handling with ThreadGroup and uncaughtException(), but make sure you understand why the above won't work, in case that was what you were planning to do.

  • How to send exception in SXMB_MONI from proxy ?

    Hi @,
    I am working on a scenarion file to proxy where i need to throw exception in xi monitor which can be viewed thru sxmb_moni ,how to do this thru abap cod ein proxy I dont know .
    Please suggest any possible solution to do tht .
    thx in advance
    Regards

    They won't be returned to the sender, since it is an async scenario.
    But it will appear as an application error in the SXMB_MONI log.
    Make sure you define a fault message type and insert it in the inbound interface you use to create inbound proxy.
    Then in proxy generation, an exception will be automatically created.
    You have to create the code to explicitely thrown this exception by some defined criteria (for example, if the input data fails some validation).
    When the exception is thrown, the fault message is sent back to XI and the application error is logged in moni.
    Regards,
    Henrique.

  • Why is exception not thrown in AseCommand when "Truncation error occurred"?

    In the below SQL, data is written to SOURCE and from there to TARGET.
    The DECIMAL columns in TARGET are deliberately smaller than those in SOURCE (eg a DECIMAL (12, 2) column populated from a DECIMAL (19,11) source).
    When I run this in an Query tool (eg, SqlDbx) I get the messages:
    "Truncation error occurred
    Command has been aborted"
    But when I run this using the .net Client (supplied with the Developer Edition of ASE 16.0) no exception is thrown (the INSERT fails though).  The method is AseCommand.ExecuteNonQuery().
    Is this deliberate? 
    Is this believed to be correct?
    How can I tell that a truncation error has been raised?
    Thanks
    IF OBJECT_ID ('dbo.TARGET') IS NOT NULL
      DROP TABLE dbo.TARGET
    GO
    CREATE TABLE dbo.TARGET
      S_Name_NVARCHAR NVARCHAR (50) null,
        S_RedComponent_DEC_15_6 decimal(15, 6) NULL,
        S_BlueComponent_DEC_12_2 decimal(12, 2) NULL, 
        S_GreenComponent_DEC_18_10 decimal(18, 10) NULL
    GO
    IF OBJECT_ID ('dbo.SOURCE') IS NOT NULL
      DROP TABLE dbo.SOURCE
    GO
    CREATE TABLE dbo.SOURCE
      Name_NVARCHAR      NVARCHAR (2000) NULL,
      RedComponent_DEC   DECIMAL (19,11) NULL,
      GreenComponent_DEC DECIMAL (19,11) NULL,
      BlueComponent_DEC  DECIMAL (19,11) NULL
    GO
    INSERT INTO dbo.SOURCE (Name_NVARCHAR, RedComponent_DEC, GreenComponent_DEC, BlueComponent_DEC)
    VALUES ('Beige', 272.195, 272.195, 244.42)
    GO
    INSERT INTO dbo.SOURCE (Name_NVARCHAR, RedComponent_DEC, GreenComponent_DEC, BlueComponent_DEC)
    VALUES ('Bisque', 283.305, 253.308, 217.756)
    GO
    INSERT INTO dbo.SOURCE (Name_NVARCHAR, RedComponent_DEC, GreenComponent_DEC, BlueComponent_DEC)
    VALUES ('Black', 0, 0, 0)
    GO
    INSERT INTO dbo.SOURCE (Name_NVARCHAR, RedComponent_DEC, GreenComponent_DEC, BlueComponent_DEC)
    VALUES ('BlanchedAlmond', 283.305, 261.085, 227.755)
    GO
    --Is there data to migrate?
    SELECT LEFT( S.Name_NVARCHAR,8000),S.GreenComponent_DEC,S.GreenComponent_DEC,S.GreenComponent_DEC
    FROM (
    SELECT * FROM SOURCE
    ) S
    --Yes.migrate away!
    --Next line gives a truncation error occurred in Sybase (gives a truncation error occurred in a query tool
    --but fails silently in AseCommand.ExecuteNonQuery).
    INSERT dbo.TARGET (S_Name_NVARCHAR,S_RedComponent_DEC_15_6,S_BlueComponent_DEC_12_2,S_GreenComponent_DEC_18_10)
    SELECT LEFT( S.Name_NVARCHAR,8000),S.GreenComponent_DEC,S.GreenComponent_DEC,S.GreenComponent_DEC
    FROM (
    SELECT * FROM SOURCE
    ) S
    select * from dbo.TARGET

    Hi Dave,
    I am consulting internally on this. To my understanding, this behavior is based on the ASE severity level, as returned in the TDS_EED token. AseExceptions are thrown when severity level is 11 or higher.
    Our docs are not explanatory in this regard.  Once I get clarification we will provide something in the form of wiki or KBA or doc bug to further explain the detail.  Apologize for the delay and problems this caused. I guess since the command is aborted by ASE, therefore no insertion occurs, even though ASE indicates truncation occurs prior - makes this confusing.
    The message severity, etc is controlled by ASE and the client is just following suit according to the TDS spec. Its just lacking in the client docs. This can be remedied.
    ASE does provide the option to allow truncation and not abort.  It's a set command:
    Enter a query:
    1 > set arithabort numeric_truncation off
    Enter a query:
    1 > INSERT dbo.TARGET (S_Name_NVARCHAR,S_RedComponent_DEC_15_6,S_BlueComponent_DEC_12_2,S_GreenComponent_DEC_18_10) SELECT LEFT( S.Name_NVARCHAR,8000),S.GreenComponent_DEC,S.GreenComponent_DEC,S.GreenComponent_DEC FROM (SELECT * FROM SOURCE
    ) S
    4 rows Affected.
    Notice though ASE does NOT send truncation message. This is when it is well known and accepted to insert and truncate the numeric data.
    Cheers,
    -Paul

  • Exception not thrown on Key Exists

    using c# api:
    I have a Btree DB configured with two secondary DB's and a custom comparer, I have initialized the DB with 'DuplicatesPolicy.NONE'. To my understanding this should cause an exception to be raised if I try to enter a duplicate. On Put(), I get no such exception.
    Why? Am I supposed to throw this from comparer? (Actually tried this but it looks like it leaves cursor in undefined state). How Do I get the KeyExists Exception to be raised when a key exists???
    To my understadning I cannot use PutNoDuplicate() as a primary with secondaries cannot have duplicates configured, and you can only use PutNoDuplicate if there is a sorted duplicate policy...
    Any suggestions?

    Hi,
    The documentation could be a little misleading here. If you specify DuplicatesPolicy.NONE for a database, then duplicates will not be allowed in the database, and when trying to put a key/data pair in the database when the key already exist will fail:
    "Insertion when the key of the key/data pair being inserted already exists in the database will fail. "
    Failing here means that there will be no duplicate created, without any exception being thrown as the default behavior is to "Store the key/data pair in the database, replacing any previously existing key if duplicates are disallowed"; see the Database.Put() methods (BTreeDatabase extends from / is a sub-class of Database).
    You should use the PutNoOverwrite method. When the key that your are trying to insert already exists in the database, you will get a KeyExistException exception.
    Regards,
    Andrei

  • No exception is thrown when my server socket dies

    I have a server application running on sunOS 5.7.
    To this I have both Windows and SunOS clients connected via TCP/IP. (Server built with jdk 1.2.2 and client with 1.3.0)
    If the Server socket dies an exception is thrown in the windows clients but not in the sunOS client.
    I need the exception to be thrown in the sunOS as well.
    Is there anybody who knows how to get this done?
    Thanks in advance.
    /Henrik

    You could poll the connection to see if its there.
    If you want the client to register the event then have your client create a sort of listener of your own when it connects. By 'sort of listener' I mean extend the thread class and have it check the connection is not null every n seconds. If it is null then raise the exception yourself.
    Would this do it?
    Rob.

  • How to handle exceptions in web dyn pro

    Hi Frndz....
                     Can any one kindly xplain how to handle exceptions in web dyn pro..like we hav exceptionhandling in java ....so is there any for NWDS
    THANKS & REGARDS
    Rajesh

    Hi,
    Web Dynpro Java is basically java only.i.e You program in java. Hence exceptions are supported in the same way as in java i.e. via try,catch and finally block.
    Additionally,
    In 04/04s if you create a method in any controller in web dynpro you cann't specify exception that can be thrown in the method. This is now possible in new programming web dynpro model in CE.
    Hence when creating a method you can also specify custom or core java (lib)excetions.
    Regards,
    Ashwani Kr Sharma

Maybe you are looking for

  • Panther to Leopard or Tiger for G5 Imac

    Hello, I am in the process of trying to back up my computer. I bought an external drive that has software that is compatible with OS X10.4.8+. I have panther which is X10.3.x and cannot use the software to back up my data. If I do not upgrade my oper

  • Handling WebService with more than one operation

    Hi Everybody, I have a hassle! First of All, I'm Newbie, using Oracle Service Bus I have to Implement a WS with aproximately 6 operations, in Service Bus. I create my WSD and my XSD Artifacts, with no problem, the issue comes when I try to create My

  • Messages doesn't open on iPh4s OS6.1

    I'm getting the alerts that i have text msg. But when i go there i get a blank screen. I have done the following: 1- I checked all setting under setting>messages 2- I reset the phone using first "Reset all settings" 3- then i reset the phone using "

  • FrameMaker 12 - Crash on Open

    I am having an issue getting FrameMaker installed and working. When I install it, it says it failed to install, but the application is still on my computer. When I try to open it, it crashes as soon as the text FMPopUpMenu is on the launcher. Are the

  • Mac book pro won't turn on after after accidentally shutting it down during updating

    Please help, I was updating my Mac book pro and accidentally shut it off.  Now it wont turn on, it shows the apple logo and the continuous cycle circle.