private void verifyRTMRetryCount(int retryCount) throws Throwable { CompilableTest busyLock = new BusyLock(); long expectedAborts = retryCount + 1L; OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest( busyLock, "-XX:-UseRTMXendForLockBusy", "-XX:RTMTotalCountIncrRate=1", CommandLineOptionTest.prepareNumericFlag("RTMRetryCount", retryCount), "-XX:RTMTotalCountIncrRate=1", "-XX:+PrintPreciseRTMLockingStatistics", BusyLock.class.getName(), Boolean.toString(TestRTMRetryCount.INFLATE_MONITOR), Integer.toString(TestRTMRetryCount.LOCKING_TIME)); outputAnalyzer.shouldHaveExitValue(0); List<RTMLockingStatistics> statistics = RTMLockingStatistics.fromString( busyLock.getMethodWithLockName(), outputAnalyzer.getStdout()); Asserts.assertEQ( statistics.size(), 1, "VM output should contain " + "exactly one rtm locking statistics entry for method " + busyLock.getMethodWithLockName()); Asserts.assertEQ( statistics.get(0).getTotalAborts(), expectedAborts, String.format("It is expected to get %d aborts", expectedAborts)); }
@Test(dataProvider = "C49189", dataProviderClass = TestDataProvider.class) public void changeUserPassword(String currency) { homePage = new HomePage(); popUpPage = new PopUpPage(); homePage.clickAuthBtn(); popUpPage.authorization(email, password); asserts = new Asserts(); asserts.checkLoginIsSuccessful(currency); userPage = new UserPage(); userPage.clickUserProfile(); userProfile = new UserProfile(); userProfile.changePassword("globotest", "globotest1", "globotest1"); asserts.checkChangePasswordMsg("Ваш пароль был успешно изменен"); userProfile.clickPopupClose(); userPage.logOut(); popUpPage = homePage.clickAuthBtn(); popUpPage.authorization(email, newPassword); asserts.checkLoginIsSuccessful(currency); userPage.clickUserProfile(); userProfile.changePassword("globotest1", "globotest", "globotest"); asserts.checkChangePasswordMsg("Ваш пароль был успешно изменен"); userProfile.clickPopupClose(); userPage.logOut(); }
public void shouldCompleteFutureOnCancel() throws Throwable { Waiter waiter = new Waiter(); FailsafeFuture<String> future = Failsafe.with(new RetryPolicy()) .with(executor) .onComplete( (r, f) -> { waiter.assertNull(r); waiter.assertTrue(f instanceof CancellationException); waiter.resume(); }) .get( () -> { Thread.sleep(5000); return "test"; }); Testing.sleep(300); future.cancel(true); waiter.await(1000); assertTrue(future.isCancelled()); assertTrue(future.isDone()); Asserts.assertThrows(() -> future.get(), CancellationException.class); }
public void testNoImplicitBindingIsCreatedForAnnotatedKeys() { try { Guice.createInjector().getInstance(Key.get(I.class, Names.named("i"))); fail(); } catch (ConfigurationException expected) { Asserts.assertContains( expected.getMessage(), "1) No implementation for " + I.class.getName(), "annotated with @" + Named.class.getName() + "(value=i) was bound.", "while locating " + I.class.getName(), " annotated with @" + Named.class.getName() + "(value=i)"); } }
@SuppressWarnings("unchecked") private void assertFailure(Injector injector, Class clazz) { try { injector.getBinding(clazz); fail("Shouldn't have been able to get binding of: " + clazz); } catch (ConfigurationException expected) { List<Object> sources = Iterables.getOnlyElement(expected.getErrorMessages()).getSources(); // Assert that the first item in the sources if the key for the class we're looking up, // ensuring that each lookup is "new". assertEquals(Key.get(clazz).toString(), sources.get(0).toString()); // Assert that the last item in each lookup contains the InvalidInterface class Asserts.assertContains( sources.get(sources.size() - 1).toString(), Key.get(InvalidInterface.class).toString()); } }
protected final void assertTypeNotEquals(String msg, JSType a, JSType b) { Asserts.assertTypeNotEquals(msg, a, b); }
protected final void assertTypeNotEquals(JSType a, JSType b) { Asserts.assertTypeNotEquals(a, b); }