author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Sat, 28 Sep 2013 01:32:59 +0200 | |
branch | javac |
changeset 1312 | bf0b56f2dca2 |
parent 1034 | 28dc692f3b11 |
child 1513 | ba912ef24b27 |
permissions | -rw-r--r-- |
jaroslav@425 | 1 |
/** |
jaroslav@425 | 2 |
* Back 2 Browser Bytecode Translator |
jaroslav@425 | 3 |
* Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
jaroslav@425 | 4 |
* |
jaroslav@425 | 5 |
* This program is free software: you can redistribute it and/or modify |
jaroslav@425 | 6 |
* it under the terms of the GNU General Public License as published by |
jaroslav@425 | 7 |
* the Free Software Foundation, version 2 of the License. |
jaroslav@425 | 8 |
* |
jaroslav@425 | 9 |
* This program is distributed in the hope that it will be useful, |
jaroslav@425 | 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
jaroslav@425 | 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
jaroslav@425 | 12 |
* GNU General Public License for more details. |
jaroslav@425 | 13 |
* |
jaroslav@425 | 14 |
* You should have received a copy of the GNU General Public License |
jaroslav@425 | 15 |
* along with this program. Look for COPYING file in the top folder. |
jaroslav@425 | 16 |
* If not, see http://opensource.org/licenses/GPL-2.0. |
jaroslav@424 | 17 |
*/ |
jaroslav@424 | 18 |
package org.apidesign.bck2brwsr.tck; |
jaroslav@424 | 19 |
|
jaroslav@1285 | 20 |
import org.apidesign.bck2brwsr.vmtest.BrwsrTest; |
jaroslav@424 | 21 |
import org.apidesign.bck2brwsr.vmtest.Compare; |
jaroslav@424 | 22 |
import org.apidesign.bck2brwsr.vmtest.VMTest; |
jaroslav@424 | 23 |
import org.testng.annotations.Factory; |
jaroslav@424 | 24 |
|
jaroslav@424 | 25 |
/** |
jaroslav@424 | 26 |
* |
jaroslav@424 | 27 |
* @author Jaroslav Tulach <jtulach@netbeans.org> |
jaroslav@424 | 28 |
*/ |
jaroslav@1285 | 29 |
public class NotifyWaitTest { |
jaroslav@424 | 30 |
|
jaroslav@1285 | 31 |
@Compare public synchronized String canCallNotify() throws Exception { |
jaroslav@1285 | 32 |
notify(); |
jaroslav@1285 | 33 |
return "OK"; |
jaroslav@1285 | 34 |
} |
jaroslav@1285 | 35 |
|
jaroslav@1285 | 36 |
@Compare public synchronized String canCallNotifyAll() throws Exception { |
jaroslav@1285 | 37 |
notifyAll(); |
jaroslav@1285 | 38 |
return "OK"; |
jaroslav@1285 | 39 |
} |
jaroslav@1285 | 40 |
|
jaroslav@1285 | 41 |
@BrwsrTest public synchronized String throwsInterruptedException() { |
jaroslav@1285 | 42 |
try { |
jaroslav@1285 | 43 |
wait(); |
jaroslav@1285 | 44 |
throw new IllegalStateException(); |
jaroslav@1285 | 45 |
} catch (InterruptedException ex) { |
jaroslav@1285 | 46 |
return "OK"; |
jaroslav@424 | 47 |
} |
jaroslav@1285 | 48 |
} |
jaroslav@1285 | 49 |
|
jaroslav@1285 | 50 |
@BrwsrTest public synchronized String waitMsThrowsInterruptedException() { |
jaroslav@1285 | 51 |
try { |
jaroslav@1285 | 52 |
wait(32); |
jaroslav@1285 | 53 |
throw new IllegalStateException(); |
jaroslav@1285 | 54 |
} catch (InterruptedException ex) { |
jaroslav@1285 | 55 |
return "OK"; |
jaroslav@1285 | 56 |
} |
jaroslav@424 | 57 |
} |
jaroslav@424 | 58 |
|
jaroslav@424 | 59 |
@Factory public static Object[] create() { |
jaroslav@1285 | 60 |
return VMTest.create(NotifyWaitTest.class); |
jaroslav@424 | 61 |
} |
jaroslav@424 | 62 |
} |