loosened up thresholds on syncproxytest

This commit is contained in:
Adrian Cole 2011-04-23 11:45:32 -07:00
parent 4e114e9b2b
commit 5752cf5426
1 changed files with 13 additions and 14 deletions

View File

@ -46,15 +46,15 @@ import com.google.inject.Provides;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "unit", sequential = true) @Test(groups = "unit", singleThreaded = true)
public class SyncProxyTest { public class SyncProxyTest {
@Test @Test
void testConvertNanos() { void testConvertNanos() {
assertEquals(SyncProxy.convertToNanos(Sync.class.getAnnotation(Timeout.class)), 30000000); assertEquals(SyncProxy.convertToNanos(Sync.class.getAnnotation(Timeout.class)), 40000000);
} }
@Timeout(duration = 30, timeUnit = TimeUnit.MILLISECONDS) @Timeout(duration = 40, timeUnit = TimeUnit.MILLISECONDS)
private static interface Sync { private static interface Sync {
String getString(); String getString();
@ -69,10 +69,10 @@ public class SyncProxyTest {
String take20Milliseconds(); String take20Milliseconds();
String take100MillisecondsAndTimeout(); String take200MillisecondsAndTimeout();
@Timeout(duration = 300, timeUnit = TimeUnit.MILLISECONDS) @Timeout(duration = 300, timeUnit = TimeUnit.MILLISECONDS)
String take100MillisecondsAndOverride(); String take200MillisecondsAndOverride();
} }
@ -137,12 +137,12 @@ public class SyncProxyTest {
}), executorService); }), executorService);
} }
public ListenableFuture<String> take100MillisecondsAndTimeout() { public ListenableFuture<String> take200MillisecondsAndTimeout() {
return Futures.makeListenable(executorService.submit(new Callable<String>() { return Futures.makeListenable(executorService.submit(new Callable<String>() {
public String call() { public String call() {
try { try {
Thread.sleep(100); Thread.sleep(200);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -152,8 +152,8 @@ public class SyncProxyTest {
}), executorService); }), executorService);
} }
public ListenableFuture<String> take100MillisecondsAndOverride() { public ListenableFuture<String> take200MillisecondsAndOverride() {
return take100MillisecondsAndTimeout(); return take200MillisecondsAndTimeout();
} }
} }
@ -184,14 +184,13 @@ public class SyncProxyTest {
} }
@Test(expectedExceptions = RuntimeException.class) @Test(expectedExceptions = RuntimeException.class)
public void testTake100MillisecondsAndTimeout() { public void testTake200MillisecondsAndTimeout() {
assertEquals(sync.take100MillisecondsAndTimeout(), "foo"); assertEquals(sync.take200MillisecondsAndTimeout(), "foo");
} }
@Test @Test
public void testTake100MillisecondsAndOverride() { public void testTake200MillisecondsAndOverride() {
assertEquals(sync.take100MillisecondsAndOverride(), "foo"); assertEquals(sync.take200MillisecondsAndOverride(), "foo");
} }
@Test @Test