List of usage examples for java.util List equals
boolean equals(Object o);
From source file:org.onosproject.yang.compiler.utils.io.impl.YangFileScannerTest.java
/** * This test case checks with the sub directories in the given path for java files. * * @throws IOException when fails to do IO operations *//*from w w w .ja v a 2 s.c om*/ @Test public void emptySubDirScannerTest() throws IOException { String dir = baseDir + separator + "scanner3"; File path = createDirectory(dir); String subDir = path.toString() + separator + "subDir1"; createDirectory(subDir); createFile(path, "invalidFile.txt"); List<String> emptySubDirContents = getJavaFiles(path.toString()); List<String> expectedContents = new LinkedList<>(); assertThat(true, is(emptySubDirContents.equals(expectedContents))); deleteDirectory(path); }
From source file:$.LogEventParsingIterator.java
/** * Ensures that either {@link ${symbol_pound}parsedEvent} is not null, or the end is reached. */*from ww w . jav a 2 s . com*/ * @throws IOException if there's a problem opening a new file, while advancing to the next event */ private void nextEvent() throws IOException { if (totalCount >= config.getLimit()) { Log.debug("Reached {} events limit - stopping", config.getLimit()); close(); return; } if (parsedEvent != null) { return; } boolean haveMore = !reachedEnd(); while (parsedEvent == null && haveMore) { haveMore = seekToNextEvent(); if (preParsedEvent != null && config.getGroupBy() != null && config.getGroupLimit() != null) { // grouping enabled - check group: List<String> nextGroupKey = getGroupKey(preParsedEvent, config); if (!nextGroupKey.equals(groupKey)) { groupKey = nextGroupKey; // this event starts a new group groupCount = 1; // reset group counter } else if (groupCount >= config.getGroupLimit()) { preParsedEvent = null; // discard the pre-parsed event, as its group is full } else { groupCount++; } } } if (parsedEvent != null) { fileEventsFound++; totalCount++; } }
From source file:com.ntsync.android.sync.activities.AccountStatisticListLoader.java
/** * Called when there is new data to deliver to the client. The super class * will take care of delivering it; the implementation here just adds a * little more logic./*from ww w. j a va2 s. c o m*/ */ @Override public void deliverResult(List<AccountStatistic> newData) { List<AccountStatistic> oldList = accountList; accountList = newData; if (isStarted() && (oldList == null || !newData.equals(oldList))) { super.deliverResult(newData); } }
From source file:org.eclipse.wb.internal.rcp.databinding.xwt.model.ValidationInfo.java
public void setClassNames(List<String> classNames) { m_update = true;//from w ww .j av a 2 s. c om if (!classNames.equals(m_classNames)) { m_classNames = classNames; } }
From source file:guru.qas.martini.DefaultMixologistTest.java
@Test public void testGetById() { String id = "Parameterized_Method_Calls:A_Non-Parameterized_Case:19"; ImmutableList<Martini> martinis = mixologist.getMartinis(); List<Martini> expected = martinis.stream().filter(m -> m.getId().equals(id)).collect(Collectors.toList()); String filter = String.format("isId('%s')", id); List<Martini> actual = new ArrayList<>(mixologist.getMartinis(filter)); checkState(actual.equals(expected), "wrong Martinis returned, expected %s but found %s", Joiner.on(", ").join(expected), Joiner.on(", ").join(actual)); }
From source file:guru.qas.martini.DefaultMixologistTest.java
@Test public void testGetByFeature() { String feature = "Parameterized Method Calls"; ImmutableList<Martini> martinis = mixologist.getMartinis(); List<Martini> expected = martinis.stream().filter(m -> m.getFeatureName().equals(feature)) .collect(Collectors.toList()); String filter = String.format("isFeature('%s ')", feature); // Note the errant space. List<Martini> actual = new ArrayList<>(mixologist.getMartinis(filter)); checkState(actual.equals(expected), "wrong Martinis returned, expected %s but found %s", Joiner.on(", ").join(expected), Joiner.on(", ").join(actual)); }
From source file:guru.qas.martini.DefaultMixologistTest.java
@Test public void testGetByScenario() { String scenario = "A Non-Parameterized Case"; ImmutableList<Martini> martinis = mixologist.getMartinis(); List<Martini> expected = martinis.stream().filter(m -> m.getScenarioName().equals(scenario)) .collect(Collectors.toList()); String filter = String.format("isScenario('%s')", scenario); List<Martini> actual = new ArrayList<>(mixologist.getMartinis(filter)); checkState(actual.equals(expected), "wrong Martinis returned, expected %s but found %s", Joiner.on(", ").join(expected), Joiner.on(", ").join(actual)); }
From source file:com.research.net.Utility.java
/** * Implement a weibo http request and return results . * //from www .ja va 2s . c o m * @param context * : context of activity * @param url * : request url of open api * @param method * : HTTP METHOD.GET, POST, DELETE * @param params * : Http params , query or postparameters * @param Token * : oauth token or accesstoken *@param loginType 1-?? 0-?? * @return UrlEncodedFormEntity: encoed entity * @throws ConnectTimeoutException * @throws UnresolvedAddressException * @throws SocketTimeoutException * @throws UnknownHostException * */ public static String openUrl(String url, String method, ResearchParameters params, int loginType) throws ResearchException { /*params.add("userType", "2");*/ if (loginType == 1) { if (TextUtils.isEmpty(ResearchCommon.getUserId(BMapApiApp.getInstance()))) { Intent toastIntent = new Intent(GlobalParam.ACTION_SHOW_TOAST); toastIntent.putExtra("toast_msg", BMapApiApp.getInstance().getResources().getString(R.string.account_repeat)); BMapApiApp.getInstance().sendBroadcast(toastIntent); ResearchCommon.saveLoginResult(BMapApiApp.getInstance(), null); ResearchCommon.setUid(""); BMapApiApp.getInstance().sendBroadcast(new Intent(GlobalParam.ACTION_DESTROY_CURRENT_ACTIVITY)); Intent serviceIntent = new Intent(BMapApiApp.getInstance(), SnsService.class); BMapApiApp.getInstance().stopService(serviceIntent); BMapApiApp.getInstance().sendBroadcast(new Intent(GlobalParam.ACTION_LOGIN_OUT)); return ""; } } /*if(loginType == 1){ params.add("uid", Common.getUid(StringsApp.getInstance())); }else if(loginType == 2){ if(!TextUtils.isEmpty(Common.getUid(StringsApp.getInstance()))){ params.add("uid", Common.getUid(StringsApp.getInstance())); } }*/ String rlt = ""; List<MorePicture> filePath = new ArrayList<MorePicture>(); if (params != null && !params.equals("")) { for (int loc = 0; loc < params.size(); loc++) { String key = params.getKey(loc); if (key.equals("pic")) { //HashMap<String,List<MorePicture>> picMap =params.getPicList("pic"); filePath = params.getPicList("pic"); params.remove(key); } } } if (filePath == null || filePath.equals("")) { rlt = openUrl(url, method, params, null); } else { rlt = openUrl(url, method, params, filePath); } return rlt; }
From source file:org.commonjava.maven.galley.transport.htcli.internal.HttpListTest.java
@Test public void simpleCentralListing_WriteListingFile() throws Exception { final String dir = "central-btm/"; final String fname = dir + "index.html"; final String listingFname = dir + ".listing.txt"; final String url = fixture.formatUrl(fname); final String body = getBody(fname); fixture.getServer().expect(url, 200, body); final SimpleHttpLocation location = new SimpleHttpLocation("test", url, true, true, true, true, null); final Transfer transfer = fixture.getTransfer(new ConcreteResource(location, listingFname)); final HttpListing listing = new HttpListing(url, new ConcreteResource(location, fname), fixture.getHttp()); final ListingResult result = listing.call(); assertThat(listing.getError(), nullValue()); assertThat(result, notNullValue());//from w w w. j a v a 2 s . c o m assertThat(result.getListing(), notNullValue()); assertTrue(Arrays.equals(centralbtm, result.getListing())); final List<String> lines = IOUtils.readLines(transfer.openInputStream()); assertTrue("Listing file written incorrectly!", lines.equals(Arrays.asList(centralbtm))); }
From source file:com.collective.celos.ci.testing.fixtures.compare.FixTableComparer.java
@Override public FixObjectCompareResult check(TestRun testRun) throws Exception { FixTable expected = expectedDataCreator.create(testRun); FixTable actual = actualDataCreator.create(testRun); List<String> expectedColumns = expected.getColumnNames(); List<String> actualColumns = actual.getColumnNames(); boolean wrongColNames = columnNamesOrdered && !expectedColumns.equals(actualColumns); wrongColNames |= !columnNamesOrdered && !equalsIgnoreOrder(expectedColumns, actualColumns); if (wrongColNames) { String expectedColDesc = StringUtils.join(expectedColumns, ", "); String actualColDesc = StringUtils.join(actualColumns, ", "); return FixObjectCompareResult .failed("Column Names for expected and actual data set differed: expected [" + expectedColDesc + "] but was [" + actualColDesc + "]"); }/*from w w w . java 2 s.c om*/ if (expected.getRows().size() != actual.getRows().size()) { return FixObjectCompareResult .failed("Data set size for expected and actual data set differed: expected has " + expected.getRows().size() + " while actual data has " + actual.getRows().size() + " rows"); } if (respectRowOrder) { Map<String, FixObjectCompareResult> fails = compareRespectOrder(expected, actual); if (!fails.isEmpty()) { return FixObjectCompareResult.wrapFailed(fails, ""); } return FixObjectCompareResult.SUCCESS; } else { Map<FixTable.FixRow, Integer> expectedRes = countEntries(expected); Map<FixTable.FixRow, Integer> actualRes = countEntries(actual); return CompareHelper.compareEntityNumber(testRun, actualDataCreator, expectedDataCreator, expectedRes, actualRes); } }