Esempio n. 1
0
        public virtual void TestUncaughtExceptionHandlerWithError()
        {
            ExitUtil.DisableSystemExit();
            YarnUncaughtExceptionHandler spyErrorHandler = Org.Mockito.Mockito.Spy(exHandler);
            Error error = new Error("test-error");

            Sharpen.Thread errorThread = new Sharpen.Thread(new _Runnable_75(error));
            errorThread.SetUncaughtExceptionHandler(spyErrorHandler);
            NUnit.Framework.Assert.AreSame(spyErrorHandler, errorThread.GetUncaughtExceptionHandler
                                               ());
            errorThread.Start();
            errorThread.Join();
            Org.Mockito.Mockito.Verify(spyErrorHandler).UncaughtException(errorThread, error);
        }
Esempio n. 2
0
        public virtual void TestUncaughtExceptionHandlerWithOutOfMemoryError()
        {
            ExitUtil.DisableSystemHalt();
            YarnUncaughtExceptionHandler spyOomHandler = Org.Mockito.Mockito.Spy(exHandler);
            OutOfMemoryException         oomError      = new OutOfMemoryException("out-of-memory-error");

            Sharpen.Thread oomThread = new Sharpen.Thread(new _Runnable_104(oomError));
            oomThread.SetUncaughtExceptionHandler(spyOomHandler);
            NUnit.Framework.Assert.AreSame(spyOomHandler, oomThread.GetUncaughtExceptionHandler
                                               ());
            oomThread.Start();
            oomThread.Join();
            Org.Mockito.Mockito.Verify(spyOomHandler).UncaughtException(oomThread, oomError);
        }
Esempio n. 3
0
        public virtual void TestUncaughtExceptionHandlerWithRuntimeException()
        {
            YarnUncaughtExceptionHandler spyYarnHandler = Org.Mockito.Mockito.Spy(exHandler);
            YarnRuntimeException         yarnException  = new YarnRuntimeException("test-yarn-runtime-exception"
                                                                                   );

            Sharpen.Thread yarnThread = new Sharpen.Thread(new _Runnable_45(yarnException));
            yarnThread.SetUncaughtExceptionHandler(spyYarnHandler);
            NUnit.Framework.Assert.AreSame(spyYarnHandler, yarnThread.GetUncaughtExceptionHandler
                                               ());
            yarnThread.Start();
            yarnThread.Join();
            Org.Mockito.Mockito.Verify(spyYarnHandler).UncaughtException(yarnThread, yarnException
                                                                         );
        }