本文整理匯總了Java中org.assertj.core.data.MapEntry類的典型用法代碼示例。如果您正苦於以下問題:Java MapEntry類的具體用法?Java MapEntry怎麽用?Java MapEntry使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MapEntry類屬於org.assertj.core.data包,在下文中一共展示了MapEntry類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: define_classloader
import org.assertj.core.data.MapEntry; //導入依賴的package包/類
@Test
public void define_classloader() throws Exception {
File jarFile = temp.newFile();
PluginInfo info = new PluginInfo("foo")
.setJarFile(jarFile)
.setMainClass("org.foo.FooPlugin")
.setMinimalSqVersion(Version.create("5.2"));
Collection<PluginClassLoaderDef> defs = loader.defineClassloaders(ImmutableMap.of("foo", info));
assertThat(defs).hasSize(1);
PluginClassLoaderDef def = defs.iterator().next();
assertThat(def.getBasePluginKey()).isEqualTo("foo");
assertThat(def.isSelfFirstStrategy()).isFalse();
assertThat(def.getFiles()).containsOnly(jarFile);
assertThat(def.getMainClassesByPluginKey()).containsOnly(MapEntry.entry("foo", "org.foo.FooPlugin"));
// TODO test mask - require change in sonar-classloader
}
示例2: metadatagetthenadd
import org.assertj.core.data.MapEntry; //導入依賴的package包/類
@Test
public void metadatagetthenadd()
throws Exception
{
scanRepo( TEST_REPO_ID );
waitForScanToComplete( TEST_REPO_ID );
BrowseService browseService = getBrowseService( authorizationHeader, false );
Map<String, String> metadatas =
toMap( browseService.getMetadatas( "commons-cli", "commons-cli", "1.0", TEST_REPO_ID ) );
assertThat( metadatas ).isNotNull().isEmpty();
browseService.addMetadata( "commons-cli", "commons-cli", "1.0", "wine", "bordeaux", TEST_REPO_ID );
metadatas = toMap( browseService.getMetadatas( "commons-cli", "commons-cli", "1.0", TEST_REPO_ID ) );
assertThat( metadatas ).isNotNull().isNotEmpty().contains( MapEntry.entry( "wine", "bordeaux" ) );
}
示例3: sample_git_project_commit_date
import org.assertj.core.data.MapEntry; //導入依賴的package包/類
/**
* SONARSCGIT-7 Use Git commit date instead of author date"
*/
@Test
public void sample_git_project_commit_date() throws Exception {
unzip("dummy-git.zip");
runSonar("dummy-git");
assertThat(getScmData("dummy-git:dummy:src/main/java/org/dummy/Dummy.java"))
.contains(
MapEntry.entry(1, new LineData("6b3aab35a3ea32c1636fee56f996e677653c48ea", "2012-07-17T16:12:48+0200", "[email protected]")),
MapEntry.entry(2, new LineData("6b3aab35a3ea32c1636fee56f996e677653c48ea", "2012-07-17T16:12:48+0200", "[email protected]")),
MapEntry.entry(3, new LineData("6b3aab35a3ea32c1636fee56f996e677653c48ea", "2012-07-17T16:12:48+0200", "[email protected]")),
MapEntry.entry(26, new LineData("0d269c1acfb8e6d4d33f3c43041eb87e0df0f5e7", "2015-05-19T13:31:09+0200", "[email protected]")),
MapEntry.entry(27, new LineData("0d269c1acfb8e6d4d33f3c43041eb87e0df0f5e7", "2015-05-19T13:31:09+0200", "[email protected]")),
MapEntry.entry(28, new LineData("0d269c1acfb8e6d4d33f3c43041eb87e0df0f5e7", "2015-05-19T13:31:09+0200", "[email protected]")));
}
示例4: sample_svn_project_with_merge
import org.assertj.core.data.MapEntry; //導入依賴的package包/類
@Test
public void sample_svn_project_with_merge() throws Exception {
File repo = unzip("repo-svn-with-merge.zip");
// The "repo-svn-with-merge" repository has a "trunk" subPath => suffix should be added
String tmpWkSubPath = wkSubPath;
if (StringUtils.isNotBlank(tmpWkSubPath)) {
tmpWkSubPath = tmpWkSubPath + "/trunk";
}
String tmpBaseDirSubPath = baseDirSubPath;
if (StringUtils.isNotBlank(tmpBaseDirSubPath)) {
tmpBaseDirSubPath = tmpBaseDirSubPath + "/trunk";
}
String scmUrl = "file:///" + unixPath(new File(repo, "repo-svn/" + tmpWkSubPath));
runSonar(new File(checkout(scmUrl), tmpBaseDirSubPath));
assertThat(getScmData("dummy:dummy:src/main/java/org/dummy/Dummy.java"))
.contains(
MapEntry.entry(1, new LineData("2", "2012-07-19T11:44:57+0200", "dgageot")),
MapEntry.entry(2, new LineData("6", "2014-11-06T09:23:04+0100", "henryju")),
MapEntry.entry(3, new LineData("2", "2012-07-19T11:44:57+0200", "dgageot")),
MapEntry.entry(24, new LineData("6", "2014-11-06T09:23:04+0100", "henryju")));
}
示例5: testMapKeyValue_10args
import org.assertj.core.data.MapEntry; //導入依賴的package包/類
@Test
public void testMapKeyValue_10args() {
final Map<String, Object> result = map(
KEY1, VALUE1,
KEY2, VALUE2,
KEY3, VALUE3,
KEY4, VALUE4,
KEY5, VALUE5);
assertThat(result).containsExactly(
MapEntry.entry(KEY1, VALUE1),
MapEntry.entry(KEY2, VALUE2),
MapEntry.entry(KEY3, VALUE3),
MapEntry.entry(KEY4, VALUE4),
MapEntry.entry(KEY5, VALUE5)
);
}
示例6: testEntityManagerFactoriesPopulated
import org.assertj.core.data.MapEntry; //導入依賴的package包/類
@Test
public void testEntityManagerFactoriesPopulated() {
EntityManagerFactory adminFactory = mock(EntityManagerFactory.class);
EntityManagerBundle adminBundle = mock(EntityManagerBundle.class);
when(adminBundle.getEntityManagerFactory()).thenReturn(adminFactory);
when(adminBundle.name()).thenReturn("admin");
EntityManagerFactory appFactory = mock(EntityManagerFactory.class);
EntityManagerBundle appBundle = mock(EntityManagerBundle.class);
when(appBundle.getEntityManagerFactory()).thenReturn(appFactory);
when(appBundle.name()).thenReturn("application");
final UnitOfWorkAwareProxyFactory unitOfWorkAwareProxyFactory =
new UnitOfWorkAwareProxyFactory(adminBundle, appBundle);
assertThat(unitOfWorkAwareProxyFactory.getEntityManagerFactories()).containsExactly(
MapEntry.entry("admin", adminFactory),
MapEntry.entry("application", appFactory));
}
示例7: testWithDocument
import org.assertj.core.data.MapEntry; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void testWithDocument() {
MongoDatabase db = connect();
StringPojo pojo = insert(db);
MongoCollection<Document> coll = db.getCollection(COLL_NAME);
Document doc = coll.find().first();
assertThat(doc).hasSize(7);
assertThat(doc.get("_id")).isEqualTo(pojo.getId());
assertThat(doc.get("scalar")).isEqualTo("a");
assertThat((List<String>) doc.get("array")).containsExactly("b", "cc", "ddd");
assertThat((List<List<String>>) doc.get("array2")).containsExactly(
Arrays.asList("111", "112"), Arrays.asList("221", "222"));
assertThat((List<String>) doc.get("list")).containsExactly("zxy", "yxz");
assertThat((List<String>) doc.get("set")).containsOnly("eee", "fff");
assertThat((Map<String, String>) doc.get("map")).containsOnly(
MapEntry.entry("1", "one"), MapEntry.entry("2", "two"),
MapEntry.entry("3", "three"), MapEntry.entry("4", null));
}
示例8: testWithDocument
import org.assertj.core.data.MapEntry; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void testWithDocument() {
MongoDatabase db = connect();
ShortPojo pojo = insert(db);
MongoCollection<Document> coll = db.getCollection(COLL_NAME);
Document doc = coll.find().first();
assertThat(doc).hasSize(10);
assertThat(doc.get("_id")).isEqualTo(pojo.getId());
assertThat(doc.get("scalarPrimitive")).isEqualTo((int) pojo.getScalarPrimitive());
assertThat(doc.get("scalar")).isEqualTo(pojo.getScalar().intValue());
assertThat((List<Integer>) doc.get("arrayPrimitive")).containsExactly(3, 4, 5);
assertThat((List<Integer>) doc.get("array")).containsExactly(6, 7, 8);
assertThat((List<List<Integer>>) doc.get("array2Primitive"))
.containsExactly(Arrays.asList(11, 12), Arrays.asList(21, 22));
assertThat((List<List<Integer>>) doc.get("array2"))
.containsExactly(Arrays.asList(111, 112), Arrays.asList(221, 222));
assertThat((List<Integer>) doc.get("list")).containsExactly(10, 11);
assertThat((List<Integer>) doc.get("set")).containsOnly(12, 13);
assertThat((Map<String, Integer>) doc.get("map")).containsOnly(
MapEntry.entry("one", 1), MapEntry.entry("two", 2),
MapEntry.entry("three", 3), MapEntry.entry("null", null));
}
示例9: testWithDocument
import org.assertj.core.data.MapEntry; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void testWithDocument() {
MongoDatabase db = connect();
LongPojo pojo = insert(db);
MongoCollection<Document> coll = db.getCollection(COLL_NAME);
Document doc = coll.find().first();
assertThat(doc).hasSize(10);
assertThat(doc.get("_id")).isEqualTo(pojo.getId());
assertThat(doc.get("scalarPrimitive")).isEqualTo(pojo.getScalarPrimitive());
assertThat(doc.get("scalar")).isEqualTo(pojo.getScalar().longValue());
assertThat((List<Long>) doc.get("arrayPrimitive")).containsExactly(3L, 4L, 5L);
assertThat((List<Long>) doc.get("array")).containsExactly(6L, 7L, 8L);
assertThat((List<List<Long>>) doc.get("array2Primitive"))
.containsExactly(Arrays.asList(11L, 12L), Arrays.asList(21L, 22L));
assertThat((List<List<Long>>) doc.get("array2"))
.containsExactly(Arrays.asList(111L, 112L), Arrays.asList(221L, 222L));
assertThat((List<Long>) doc.get("list")).containsExactly(10L, 11L);
assertThat((List<Long>) doc.get("set")).containsOnly(12L, 13L);
assertThat((Map<String, Long>) doc.get("map")).containsOnly(
MapEntry.entry("one", 1L), MapEntry.entry("two", 2L),
MapEntry.entry("three", 3L), MapEntry.entry("null", null));
}
示例10: testWithDocument
import org.assertj.core.data.MapEntry; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void testWithDocument() {
MongoDatabase db = connect();
MonthPojo pojo = insert(db);
MongoCollection<Document> coll = db.getCollection(COLL_NAME);
Document doc = coll.find().first();
assertThat(doc).hasSize(7);
assertThat(doc.get("_id")).isEqualTo(pojo.getId());
assertThat(doc.get("scalar")).isEqualTo(1);
assertThat((List<Integer>) doc.get("array")).containsExactly(2, 3, 4);
assertThat((List<List<Integer>>) doc.get("array2"))
.containsExactly(Arrays.asList(5), Arrays.asList(6, 7));
assertThat((List<Integer>) doc.get("list")).containsExactly(8, 9);
assertThat((List<Integer>) doc.get("set")).containsExactly(12);
assertThat((Map<String, Integer>) doc.get("map")).containsOnly(
MapEntry.entry("one", 1), MapEntry.entry("two", 2),
MapEntry.entry("three", 3), MapEntry.entry("null", null));
}
示例11: testWithDocument
import org.assertj.core.data.MapEntry; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void testWithDocument() {
MongoDatabase db = connect();
AtomicBooleanPojo pojo = insert(db);
MongoCollection<Document> coll = db.getCollection(COLL_NAME);
Document doc = coll.find().first();
assertThat(doc).hasSize(7);
assertThat(doc.get("_id")).isEqualTo(pojo.getId());
assertThat(doc.get("scalar")).isEqualTo(pojo.getScalar().get());
assertThat((List<Boolean>) doc.get("array")).containsExactly(true, false);
assertThat((List<List<Boolean>>) doc.get("array2"))
.containsExactly(Arrays.asList(false), Arrays.asList(true));
assertThat((List<Boolean>) doc.get("list")).containsExactly(Boolean.TRUE);
assertThat((List<Boolean>) doc.get("set")).containsExactly(false);
assertThat((Map<String, Boolean>) doc.get("map")).containsOnly(
MapEntry.entry("one", true), MapEntry.entry("two", false),
MapEntry.entry("three", true), MapEntry.entry("null", null));
}
示例12: testWithDocument
import org.assertj.core.data.MapEntry; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void testWithDocument() {
MongoDatabase db = connect();
DatePojo pojo = insert(db);
MongoCollection<Document> coll = db.getCollection(COLL_NAME);
Document doc = coll.find().first();
assertThat(doc).hasSize(7);
assertThat(doc.get("_id")).isEqualTo(pojo.getId());
assertThat(doc.get("scalar")).isEqualTo(createDate(2015, 1, 1));
assertThat((List<Date>) doc.get("array")).containsExactly(createDate(2015, 2, 1),
createDate(2015, 2, 2), createDate(2015, 2, 3));
assertThat((List<List<Date>>) doc.get("array2")).containsExactly(
Arrays.asList(createDate(2015, 3, 1), createDate(2015, 3, 2)),
Arrays.asList(createDate(2015, 4, 1), createDate(2015, 4, 2)));
assertThat((List<Date>) doc.get("list"))
.containsExactly(createDate(2015, 12, 20));
assertThat((List<Date>) doc.get("set")).containsOnly(createDate(2015, 8, 8),
createDate(2015, 9, 9));
assertThat((Map<String, Date>) doc.get("map")).containsOnly(
MapEntry.entry("1", createDate(2017, 1, 1)),
MapEntry.entry("2", createDate(2017, 1, 2)),
MapEntry.entry("3", createDate(2017, 1, 3)), MapEntry.entry("4", null));
}
示例13: testWithDocument
import org.assertj.core.data.MapEntry; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void testWithDocument() {
MongoDatabase db = connect();
AtomicIntegerPojo pojo = insert(db);
MongoCollection<Document> coll = db.getCollection(COLL_NAME);
Document doc = coll.find().first();
assertThat(doc).hasSize(7);
assertThat(doc.get("_id")).isEqualTo(pojo.getId());
assertThat(doc.get("scalar")).isEqualTo(pojo.getScalar().get());
assertThat((List<Integer>) doc.get("array")).containsExactly(2, 3);
assertThat((List<List<Integer>>) doc.get("array2"))
.containsExactly(Arrays.asList(4), Arrays.asList(5));
assertThat((List<Integer>) doc.get("list")).containsExactly(6);
assertThat((List<Integer>) doc.get("set")).containsExactly(7);
assertThat((Map<String, Integer>) doc.get("map")).containsOnly(
MapEntry.entry("one", 1), MapEntry.entry("two", 2),
MapEntry.entry("three", 3), MapEntry.entry("null", null));
}
示例14: testWithDocument
import org.assertj.core.data.MapEntry; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void testWithDocument() {
MongoDatabase db = connect();
BooleanPojo pojo = insert(db);
MongoCollection<Document> coll = db.getCollection(COLL_NAME);
Document doc = coll.find().first();
assertThat(doc).hasSize(10);
assertThat(doc.get("_id")).isEqualTo(pojo.getId());
assertThat(doc.get("scalarPrimitive")).isEqualTo(true);
assertThat(doc.get("scalar")).isEqualTo(false);
assertThat((List<Boolean>) doc.get("arrayPrimitive")).containsExactly(true);
assertThat((List<Boolean>) doc.get("array")).containsExactly(false);
assertThat((List<List<Boolean>>) doc.get("array2Primitive"))
.containsExactly(Arrays.asList(true), Arrays.asList(false));
assertThat((List<List<Boolean>>) doc.get("array2"))
.containsExactly(Arrays.asList(false), Arrays.asList(true));
assertThat((List<Boolean>) doc.get("list")).containsExactly(true, false);
assertThat((List<Boolean>) doc.get("set")).containsExactly(true);
assertThat((Map<String, Boolean>) doc.get("map")).containsOnly(
MapEntry.entry("one", true), MapEntry.entry("two", false),
MapEntry.entry("three", true), MapEntry.entry("null", null));
}
示例15: testWithDocument
import org.assertj.core.data.MapEntry; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void testWithDocument() {
MongoDatabase db = connect();
Decimal128Pojo pojo = insert(db);
MongoCollection<Document> coll = db.getCollection(COLL_NAME);
Document doc = coll.find().first();
assertThat(doc).hasSize(7);
assertThat(doc.get("_id")).isEqualTo(pojo.getId());
assertThat(doc.get("scalar")).isEqualTo(new Decimal128(2001));
assertThat((List<Decimal128>) doc.get("array")).containsExactly(
new Decimal128(2002), new Decimal128(2003), new Decimal128(2004));
assertThat((List<List<Decimal128>>) doc.get("array2")).containsExactly(
Arrays.asList(new Decimal128(2005)),
Arrays.asList(new Decimal128(2006), new Decimal128(2007)));
assertThat((List<Decimal128>) doc.get("list"))
.containsExactly(new Decimal128(2008), new Decimal128(2009));
assertThat((List<Decimal128>) doc.get("set"))
.containsExactly(new Decimal128(2012));
assertThat((Map<String, Decimal128>) doc.get("map")).containsOnly(
MapEntry.entry("one", new Decimal128(2011)),
MapEntry.entry("two", new Decimal128(2012)),
MapEntry.entry("three", new Decimal128(2013)),
MapEntry.entry("null", null));
}