@Suppress
public void testLockFairness() {
startDatabaseFairnessThread();
int previous = 0;
for (int i = 0; i < NUM_ITERATIONS; i++) {
mDatabase.beginTransaction();
int val = mCounter.get();
if (i == 0) {
previous = val - i;
}
assertTrue(previous == (val - i));
try {
Thread.currentThread().sleep(SLEEP_TIME);
} catch (InterruptedException e) {
// ignore
}
mDatabase.endTransaction();
}
}
java类android.test.suitebuilder.annotation.Suppress的实例源码
DatabaseLockTest.java 文件源码
项目:core-doppl
阅读 22
收藏 0
点赞 0
评论 0
DatabaseLockTest.java 文件源码
项目:core-doppl
阅读 22
收藏 0
点赞 0
评论 0
@Suppress
public void testLockLatency() {
startDatabaseLatencyThread();
long sumTime = 0;
long maxTime = 0;
for (int i = 0; i < NUM_ITERATIONS; i++) {
long startTime = System.currentTimeMillis();
mDatabase.beginTransaction();
long endTime = System.currentTimeMillis();
long elapsedTime = endTime - startTime;
if (maxTime < elapsedTime) {
maxTime = elapsedTime;
}
sumTime += elapsedTime;
try {
Thread.sleep(SLEEP_TIME);
} catch (InterruptedException e) {
// ignore
}
mDatabase.endTransaction();
}
long averageTime = sumTime/NUM_ITERATIONS;
Log.i("DatabaseLockLatency", "AverageTime: " + averageTime);
Log.i("DatabaseLockLatency", "MaxTime: " + maxTime);
assertTrue( (averageTime - SLEEP_TIME) <= MAX_ALLOWED_LATENCY_TIME);
}
DatabaseLocaleTest.java 文件源码
项目:sqlite-android
阅读 22
收藏 0
点赞 0
评论 0
@Suppress // not supporting localized collators
@MediumTest
public void testLocaleenUS() throws Exception {
insertStrings();
Log.i("LocaleTest", "about to call setLocale en_US");
mDatabase.setLocale(new Locale("en", "US"));
String[] results;
results = query("SELECT data FROM test ORDER BY data COLLATE LOCALIZED ASC");
// The database code currently uses PRIMARY collation strength,
// meaning that all versions of a character compare equal (regardless
// of case or accents), leaving the "cote" flavors in database order.
MoreAsserts.assertEquals(results, new String[] {
STRINGS[4], // "boy"
STRINGS[0], // sundry forms of "cote"
STRINGS[1],
STRINGS[2],
STRINGS[3],
STRINGS[6], // "COTE"
STRINGS[5], // "dog"
});
}
TestBeanAdvanced.java 文件源码
项目:bean-sdk-android
阅读 25
收藏 0
点赞 0
评论 0
@Suppress
public void testFastSerialMessages() throws Exception {
int times = 100;
final CountDownLatch testCompletionLatch = new CountDownLatch(times);
Bean bean = discoverBean();
synchronousConnect(bean);
for (int i = 0; i < times; i ++) {
bean.readLed(new Callback<LedColor>() {
@Override
public void onResult(LedColor result) {
testCompletionLatch.countDown();
}
});
}
testCompletionLatch.await(120, TimeUnit.SECONDS);
synchronousDisconnect(bean);
}
PublicApiFunctionalTest.java 文件源码
项目:android-downloadprovider
阅读 22
收藏 0
点赞 0
评论 0
@Suppress
public void testExtremelyLarge() throws Exception {
// NOTE: suppressed since this takes several minutes to run
final long length = 3 * GB_IN_BYTES;
final InputStream body = new FakeInputStream(length);
enqueueResponse(new MockResponse().setResponseCode(HTTP_OK).setBody(body, length)
.setHeader("Content-type", "text/plain")
.setSocketPolicy(SocketPolicy.DISCONNECT_AT_END));
final Download download = enqueueRequest(getRequest()
.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "extreme.bin"));
download.runUntilStatus(DownloadManager.STATUS_SUCCESSFUL, 10 * DateUtils.MINUTE_IN_MILLIS);
assertEquals(length, download.getLongField(DownloadManager.COLUMN_TOTAL_SIZE_BYTES));
assertEquals(length, download.getLongField(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR));
}
ManualConfigUtil_IT.java 文件源码
项目:mobile-connector-sdk-android
阅读 24
收藏 0
点赞 0
评论 0
@Suppress
public void testGetDatabaseMeta() throws Exception {
final CountDownLatch signal = new CountDownLatch(1);
XMLAPI getListMetaDataXml = XMLAPI.builder().operation(XMLAPIOperation.GET_LIST_META_DATA)
.listId(getEngageConfigManager().engageListId())
// .listId("29392")
.build();
getXMLAPIManager().postXMLAPI(getListMetaDataXml, new XMLAPIResponseHandler() {
@Override
public void onSuccess(EngageResponseXML response) {
// test only exists so you can manually check this xml value
String xml = response.getXml();
Log.i(TAG, xml);
signal.countDown();
}
@Override
public void onFailure(XMLAPIResponseFailure exception) {
fail();
}
});
signal.await(5, TimeUnit.SECONDS);
}
BasicPodioFilterTest.java 文件源码
项目:podio-android
阅读 19
收藏 0
点赞 0
评论 0
@Suppress()
public void testAddPathSegments() {
Uri reference = Uri.parse("scheme://authority/path1/path2");
Filter filter = new EmptyProvider.Path();
try {
filter.addPathSegment(null);
fail("should have thrown IllegalArgumentException");
} catch (IllegalArgumentException e) {
}
filter.addPathSegment("path1");
filter.addPathSegment("path2");
Uri target = filter.buildUri("scheme", "authority");
assertNotNull(target);
assertEquals(reference, target);
}
ImportTest.java 文件源码
项目:Anki-Android
阅读 30
收藏 0
点赞 0
评论 0
@Suppress
public void testCsv2() throws IOException, ConfirmModSchemaException {
Collection deck = Shared.getEmptyCol(getContext());
Models mm = deck.getModels();
JSONObject m = mm.current();
JSONObject f = mm.newField("Three");
mm.addField(m, f);
mm.save(m);
Note n = deck.newNote();
n.setItem("Front", "1");
n.setItem("Back", "2");
n.setItem("Three", "3");
deck.addNote(n);
// an update with unmapped fields should not clobber those fields
String file = Shared.getTestFilePath(getContext(), "text-update.txt");
TextImporter i = new TextImporter(deck, file);
i.initMapping();
i.run();
n.load();
assertTrue(n.getItem("Front").equals("1"));
assertTrue(n.getItem("Back").equals("x"));
assertTrue(n.getItem("Three").equals("3"));
deck.close();
}
MediaPlayerPresenterTest.java 文件源码
项目:RoviRunner
阅读 21
收藏 0
点赞 0
评论 0
@Suppress // TODO [2013-09-29 KW] just trying some stuff out, there must be an easier way to do this...
public void testPlayRandomSong() throws IllegalArgumentException, IllegalStateException, IOException
{
AssetFileDescriptor afd = Mockito.mock( AssetFileDescriptor.class );
Mockito.doReturn( afd ).when( m_presenter ).getRandomSong();
Mockito.doNothing().when( m_player ).prepareAsync();
m_presenter.playSong( null );
Mockito.verify( m_player )
.setDataSource( (FileDescriptor)Mockito.any(),
Mockito.anyLong(),
Mockito.anyLong() );
Mockito.verify( m_player )
.prepareAsync();
Mockito.verify( m_view )
.setArtistText( Mockito.anyString() );
Mockito.verify( m_view )
.setSongText( Mockito.anyString() );
}
EventDetailsTest.java 文件源码
项目:NickleAndDimed
阅读 22
收藏 0
点赞 0
评论 0
@SmallTest
@Suppress
public void testMenuShare() {
// When
getActivity();
onView(withId(R.id.action_share)).perform(click());
// Then
// TODO: execute is called on mock but test still fails
verify(shareAction, times(1)).execute(any(EventDetails.class));
}
KonvertorTests.java 文件源码
项目:Tabdilak
阅读 24
收藏 0
点赞 0
评论 0
@Suppress
public void testIfScreenRotationHandledCorrectly() throws Exception {
requestFocus(mTeNumber);
sendKeys("1 0 0");
requestFocus(mBtnConvert);
sendKeys(KeyEvent.KEYCODE_ENTER);
String expectedTvValue = mTvResult.getText().toString();
String expectedTeValue = mTeNumber.getText().toString();
for(int i=0; i<=10; i++) {
if(i % 2 == 0) {
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else {
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
//FIXME :: Fix this problem.
/*
* The problem here is that after screen rotation mActivity and all of our fields still refer to the old activity that we had and so assertEquals
* methods wrongly return true. So first we must renew our mActivity and all other references. The following solution does not solve our problem
* But currently I do not have enough time to solve this issue so I @Suppress it for now. For more information refer to:
* http://stackoverflow.com/questions/10982370/instrumentation-test-for-android-how-to-receive-new-activity-after-orientation
* For now I use Instrumentation.callActivityOnSaveInstanceState.
*/
mActivity.finish();
setActivity(null);
setUp();
getInstrumentation().waitForIdleSync();
assertEquals("TeNumber value is not valid after rotation", expectedTeValue, mTeNumber.getText().toString());
assertEquals("TvResult value is not valid after rotation",expectedTvValue, mTvResult.getText().toString());
}
}
SensitiveDataUtilsTest.java 文件源码
项目:planyourexchange
阅读 19
收藏 0
点赞 0
评论 0
/**
* This method is used to generated encrypted keys and hashes
* with the secret password and salt above
* @throws UnsupportedEncodingException
* @throws GeneralSecurityException
*/
@Suppress
public void testEncryptGenerate() throws UnsupportedEncodingException, GeneralSecurityException {
Map<String,String> map = new HashMap<>();
map.put("AdUnitId","?");
map.put("TestDeviceId","?");
map.put("service.url","?");
map.put("service.userName","?");
map.put("service.password","?");
map.put("AnalyticsId", "?");
map.put("test","test");
StringBuilder stringBuilder = new StringBuilder();
for (Map.Entry<String,String> entry : map.entrySet()) {
stringBuilder.append(entry.getKey())
.append(" = ")
.append(sensitiveDataUtils.hashKey(entry.getKey()))
.append("\n")
.append(entry.getValue())
.append(" = ")
.append(sensitiveDataUtils.encrypt(entry.getValue()))
.append("\n");
}
fail(stringBuilder.toString());
}
ElasticSearchHelperTest.java 文件源码
项目:TravelTracker
阅读 19
收藏 0
点赞 0
评论 0
@Suppress
public void testAddClaims() throws Exception{
ArrayList<Claim> claims = new ArrayList<Claim>();
claims.add(claim1);
claims.add(claim2);
es.saveDocuments(claims);
Thread.sleep(1000);
assertEquals(claims.size(), es.getClaims(user1.getUUID()).size());
cleanUp(claims);
assertEquals(0, es.getClaims(user1.getUUID()).size());
}
ElasticSearchHelperTest.java 文件源码
项目:TravelTracker
阅读 22
收藏 0
点赞 0
评论 0
@Suppress
public void testAddExpense() throws Exception{
ArrayList<Item> items = new ArrayList<Item>();
items.add(DataSourceUtils.addEmptyItem(claim1, ds));
items.add(DataSourceUtils.addEmptyItem(claim1, ds));
es.saveDocuments(items);
Thread.sleep(1000);
assertEquals(items.size(), es.getExpenses(claim1.getUUID()).size());
cleanUp(items);
assertEquals(0, es.getExpenses(claim1.getUUID()).size());
}
ElasticSearchHelperTest.java 文件源码
项目:TravelTracker
阅读 24
收藏 0
点赞 0
评论 0
@Suppress
public void testAAddUser() throws Exception {
ArrayList<User> users = new ArrayList<User>();
users.add(user1);
es.saveDocuments(users);
Thread.sleep(1000);
assertTrue(user1.getUUID().equals(es.getUser(user1.getUserName()).getUUID()));
cleanUp(users);
//TODO test cleanup successful
}
ElasticSearchHelperTest.java 文件源码
项目:TravelTracker
阅读 20
收藏 0
点赞 0
评论 0
@Suppress
public void testAddTag() throws Exception {
ArrayList<Tag> tags = new ArrayList<Tag>();
tags.add(DataSourceUtils.addEmptyTag(user1, ds));
es.saveDocuments(tags);
Thread.sleep(1000);
assertEquals(tags.size(), es.getTags(user1.getUUID()).size());
cleanUp(tags);
assertEquals(0, es.getTags(user1.getUUID()).size());
}
ElasticSearchHelperTest.java 文件源码
项目:TravelTracker
阅读 21
收藏 0
点赞 0
评论 0
@Suppress
public void testGetAllExpenses() throws Exception{
ArrayList<Item> items = new ArrayList<Item>();
items.add(DataSourceUtils.addEmptyItem(claim1, ds));
items.add(DataSourceUtils.addEmptyItem(claim1, ds));
es.saveDocuments(items);
Thread.sleep(1000);
assertEquals(items.size(), es.getAllItems().size());
cleanUp(items);
assertEquals(0, es.getAllItems().size());
}
ElasticSearchHelperTest.java 文件源码
项目:TravelTracker
阅读 24
收藏 0
点赞 0
评论 0
@Suppress
public void testGetAllClaims() throws Exception {
ArrayList<Claim> claims = new ArrayList<Claim>();
claims.add(claim1);
claims.add(claim2);
es.saveDocuments(claims);
Thread.sleep(1000);
assertEquals(claims.size(), es.getAllClaims().size());
cleanUp(claims);
assertEquals(0, es.getAllClaims().size());
}
ElasticSearchHelperTest.java 文件源码
项目:TravelTracker
阅读 24
收藏 0
点赞 0
评论 0
@Suppress
public void testGetAllTags() throws Exception {
ArrayList<Tag> tags = new ArrayList<Tag>();
tags.add(DataSourceUtils.addEmptyTag(user1, ds));
es.saveDocuments(tags);
Thread.sleep(1000);
assertEquals(tags.size(), es.getAllTags().size());
cleanUp(tags);
assertEquals(0, es.getAllTags().size());
}
ElasticSearchHelperTest.java 文件源码
项目:TravelTracker
阅读 19
收藏 0
点赞 0
评论 0
@Suppress
public void testGetAllUsers() throws Exception {
ArrayList<User> users = new ArrayList<User>();
users.add(user1);
es.saveDocuments(users);
Thread.sleep(1000);
assertEquals(1, es.getAllUsers().size());
cleanUp(users);
assertEquals(0, es.getAllUsers().size());
}
ElasticSearchHelperTest.java 文件源码
项目:TravelTracker
阅读 22
收藏 0
点赞 0
评论 0
@Suppress
public void testGetUserByID() throws Exception {
ArrayList<User> users = new ArrayList<User>();
users.add(user1);
es.saveDocuments(users);
Thread.sleep(1000);
assertTrue(user1.getUUID().equals(es.getUser(user1.getUUID()).getUUID()));
cleanUp(users);
}
ManualConfigUtil_IT.java 文件源码
项目:mobile-connector-sdk-android
阅读 26
收藏 0
点赞 0
评论 0
@Suppress
public void testGetLists() throws Exception {
final CountDownLatch signal = new CountDownLatch(1);
XMLAPI getLists = XMLAPI.builder()
.operation(XMLAPIOperation.GET_LISTS)
.param(XMLAPIElement.VISIBILITY, 0)
.param(XMLAPIElement.LIST_TYPE, XMLAPIListType.DATABASES.toString())
.build();
getXMLAPIManager().postXMLAPI(getLists, new XMLAPIResponseHandler() {
@Override
public void onSuccess(EngageResponseXML response) {
// test only exists so you can manually check this xml value
String xml = response.getXml();
Log.i(TAG, xml);
if (!response.isSuccess()) {
fail(response.getFaultString());
}
signal.countDown();
}
@Override
public void onFailure(XMLAPIResponseFailure exception) {
fail();
}
});
signal.await(5, TimeUnit.SECONDS);
}
ClientProviderTest.java 文件源码
项目:podio-android
阅读 23
收藏 0
点赞 0
评论 0
@Suppress
public void testAuthenticateWithUserCredentials() {
MockRestClient mockClient = new MockRestClient(getInstrumentation().getTargetContext());
ClientProvider provider = new ClientProvider();
provider.setClient(mockClient);
provider.authenticateWithUserCredentials("USERNAME", "PASSWORD").withResultListener(resultListener);
Mockito.verify(resultListener, Mockito.timeout(1000).times(0)).onRequestPerformed(null);
assertEquals(Uri.parse("/oauth/token?grant_type=password&username=USERNAME&password=PASSWORD"), mockClient.uri);
}
ClientProviderTest.java 文件源码
项目:podio-android
阅读 23
收藏 0
点赞 0
评论 0
@Suppress
public void testAuthenticateWithAppCredentials() {
MockRestClient mockClient = new MockRestClient(getInstrumentation().getTargetContext());
ClientProvider provider = new ClientProvider();
provider.setClient(mockClient);
provider.authenticateWithAppCredentials("APPID", "APPTOKEN").withResultListener(resultListener);
Mockito.verify(resultListener, Mockito.timeout(100).times(0)).onRequestPerformed(null);
assertEquals(Uri.parse("/oauth/token?grant_type=app&app_id=APPID&app_token=APPTOKEN"), mockClient.uri);
}
EventDetailsTest.java 文件源码
项目:BillSplitter
阅读 21
收藏 0
点赞 0
评论 0
@SmallTest
@Suppress
public void testMenuShare() {
// When
getActivity();
onView(withId(R.id.action_share)).perform(click());
// Then
// TODO: execute is called on mock but test still fails
verify(shareAction, times(1)).execute(any(EventDetails.class));
}
TileSystemMathTest.java 文件源码
项目:osmdroid
阅读 26
收藏 0
点赞 0
评论 0
@Suppress // this test is here to test timings for issue 512
public void test_divide() {
long start = System.currentTimeMillis();
double delta = 0.0;
for (int i=0; i<10000000; i++){
delta = i/1E6;
}
long diff = System.currentTimeMillis() - start;
assertEquals("fail", 0, diff);
}
TileSystemMathTest.java 文件源码
项目:osmdroid
阅读 41
收藏 0
点赞 0
评论 0
@Suppress // this test is here to test timings for issue 512
public void test_multiply() {
long start = System.currentTimeMillis();
double delta = 0.0;
for (int i=0; i<10000000; i++){
delta = i*1E-6;
}
long diff = System.currentTimeMillis() - start;
assertEquals("fail", 0, diff);
}
ImportTest.java 文件源码
项目:Anki-Android
阅读 28
收藏 0
点赞 0
评论 0
@Suppress
public void testCsv() throws IOException {
Collection deck = Shared.getEmptyCol(getContext());
String file = Shared.getTestFilePath(getContext(), "text-2fields.txt");
TextImporter i = new TextImporter(deck, file);
i.initMapping();
i.run();
// four problems - too many & too few fields, a missing front, and a
// duplicate entry
assertTrue(i.getLog().size() == 5);
assertTrue(i.getTotal() == 5);
// if we run the import again, it should update instead
i.run();
assertTrue(i.getLog().size() == 10);
assertTrue(i.getTotal() == 5);
// but importing should not clobber tags if they're unmapped
Note n = deck.getNote(deck.getDb().queryLongScalar("select id from notes"));
n.addTag("test");
n.flush();
i.run();
n.load();
assertTrue((n.getTags().size() == 1) && (n.getTags().get(0) == "test"));
// if add-only mode, count will be 0
i.setImportMode(1);
i.run();
assertTrue(i.getTotal() == 0);
// and if dupes mode, will reimport everything
assertTrue(deck.cardCount() == 5);
i.setImportMode(2);
i.run();
// includes repeated field
assertTrue(i.getTotal() == 6);
assertTrue(deck.cardCount() == 11);
deck.close();
}
CordovaResourceApiTest.java 文件源码
项目:crosswalk-cordova-android
阅读 23
收藏 0
点赞 0
评论 0
@Suppress
public void testValidContentUri() throws IOException
{
Uri contentUri = createTestImageContentUri();
File localFile = resourceApi.mapUriToFile(contentUri);
assertNotNull(localFile);
performApiTest(contentUri, "image/jpeg", localFile, true, true);
}
ErrorUrlTest.java 文件源码
项目:crosswalk-cordova-android
阅读 20
收藏 0
点赞 0
评论 0
@Suppress
public void testUrl() throws Throwable
{
sleep();
runTestOnUiThread(new Runnable() {
public void run()
{
String good_url = "file:///android_asset/www/htmlnotfound/error.html";
String url = testView.getUrl();
assertNotNull(url);
assertEquals(good_url, url);
}
});
}