当前位置: 首页>>代码示例>>Java>>正文


Java Objects类代码示例

本文整理汇总了Java中org.assertj.core.internal.Objects的典型用法代码示例。如果您正苦于以下问题:Java Objects类的具体用法?Java Objects怎么用?Java Objects使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Objects类属于org.assertj.core.internal包,在下文中一共展示了Objects类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doesNotContain

import org.assertj.core.internal.Objects; //导入依赖的package包/类
/**
 * Verifies that the actual {@link com.google.common.collect.Range} does not contain the given values.<br>
 * <p>
 * Example :
 *
 * <pre><code class='java'> Range&lt;Integer&gt; range = Range.closed(10, 12);
 *
 * assertThat(range).doesNotContain(13);</code></pre>
 *
 * @param values the values to look for in actual {@link com.google.common.collect.Range}.
 * @return this {@link OptionalAssert} for assertions chaining.
 * @throws AssertionError if the actual {@link com.google.common.collect.Range} is {@code null}.
 * @throws AssertionError if the actual {@link com.google.common.collect.Range} contains the given values.
 */
public RangeAssert<T> doesNotContain(@SuppressWarnings("unchecked") final T... values) {
  Objects.instance().assertNotNull(info, actual);

  final List<T> valuesFound = newArrayList();
  for (final T value : values) {
    if (actual.contains(value)) {
      valuesFound.add(value);
    }
  }
  if (!valuesFound.isEmpty()) {
    throw failures.failure(info, shouldNotContain(actual, values, valuesFound));
  }

  return this;
}
 
开发者ID:joel-costigliola,项目名称:assertj-guava,代码行数:30,代码来源:RangeAssert.java

示例2: isEqualTo

import org.assertj.core.internal.Objects; //导入依赖的package包/类
@Override
public SparseArrayAssert<E> isEqualTo(Object expected) {
    Objects.instance().assertHasSameClassAs(info, actual, expected);
    final SparseArray<E> expectedSparseArray = (SparseArray<E>) expected;
    assertThat(actual).is(new Condition<SparseArray<E>>() {
        @Override
        public boolean matches(SparseArray<E> eSparseArray) {
            return isEqualTo(eSparseArray, expectedSparseArray);
        }
    });
    return this;
}
 
开发者ID:evant,项目名称:typedbundle,代码行数:13,代码来源:SparseArrayAssert.java

示例3: usingComparator

import org.assertj.core.internal.Objects; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
@CheckReturnValue
public SELF usingComparator(Comparator<? super ACTUAL> customComparator) {
  // using a specific strategy to compare actual with other objects.
  this.objects = new Objects(new ComparatorBasedComparisonStrategy(customComparator));
  return myself;
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:9,代码来源:AbstractAssert.java

示例4: usingDefaultComparator

import org.assertj.core.internal.Objects; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
@CheckReturnValue
public SELF usingDefaultComparator() {
  // fall back to default strategy to compare actual with other objects.
  this.objects = Objects.instance();
  return myself;
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:9,代码来源:AbstractAssert.java

示例5: setUp

import org.assertj.core.internal.Objects; //导入依赖的package包/类
@Before
public void setUp() {
  dates = mock(Dates.class);
  objects = mock(Objects.class);
  assertions = new DateAssert(new Date());
  assertions.dates = dates;
  assertions.objects = objects;
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:9,代码来源:DateAssertBaseTest.java

示例6: inject_internal_objects

import org.assertj.core.internal.Objects; //导入依赖的package包/类
@Override
protected void inject_internal_objects() {
  super.inject_internal_objects();
  classes = mock(Classes.class);
  objects = mock(Objects.class);
  assertions = new ClassAssert(AnnotatedClass.class);
  assertions.objects = objects;
  assertions.classes = classes;
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:10,代码来源:ClassAssertBaseTest.java

示例7: checkNull

import org.assertj.core.internal.Objects; //导入依赖的package包/类
/**
 * Not a really relevant assertion, the goal is to show how to write a new assertion with a specific error message
 * that honors the description set by the assertion user.
 */
public ConcreteAssert checkNull() {
  // set a specific error message
  WritableAssertionInfo info = getWritableAssertionInfo();
  info.overridingErrorMessage("specific error message");
  Objects.instance().assertNull(info, actual);
  // return the current assertion for method chaining
  return this;
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:13,代码来源:ConcreteAssert.java

示例8: doesNotEndWithNode

import org.assertj.core.internal.Objects; //导入依赖的package包/类
public RelationshipAssert doesNotEndWithNode(Node node) {
  Objects.instance().assertNotNull(info, actual);

  Node actualEndNode = actual.getEndNode();

  checkActualRelationshipNode(actualEndNode, "The actual end node should not be null");
  checkArgumentNode(node, "The end node to look for should not be null");

  if (actualEndNode.equals(node)) {
    throw Failures.instance().failure(info, shouldNotEndWithNode(actual, node));
  }
  return this;
}
 
开发者ID:joel-costigliola,项目名称:assertj-neo4j,代码行数:14,代码来源:RelationshipAssert.java

示例9: asMap

import org.assertj.core.internal.Objects; //导入依赖的package包/类
/**
 * Verifies that the actual value is a map, and returns a map assertion, to allow
 * chaining of map-specific assertions from this call.
 * @return a map assertion object
 */
@SuppressWarnings("unchecked")
public AbstractMapAssert<?, ?, Object, Object> asMap() {
	Objects.instance().assertIsInstanceOf(this.info, this.actual, Map.class);
	return Assertions.assertThat((Map<Object, Object>) this.actual);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:ObjectContentAssert.java

示例10: isEqualTo

import org.assertj.core.internal.Objects; //导入依赖的package包/类
public JsAssert isEqualTo(String js) {
    Objects.instance().assertEqual(info, trimEachLines(actual), trimEachLines(js));
    return this;
}
 
开发者ID:bonitasoft,项目名称:bonita-ui-designer,代码行数:5,代码来源:JsAssert.java

示例11: assertNotNull

import org.assertj.core.internal.Objects; //导入依赖的package包/类
private void assertNotNull(final AssertionInfo info, final FDate actual) {
    Objects.instance().assertNotNull(info, actual);
}
 
开发者ID:subes,项目名称:invesdwin-util,代码行数:4,代码来源:FDatesAssertions.java

示例12: asInstanceOf

import org.assertj.core.internal.Objects; //导入依赖的package包/类
protected <T> T asInstanceOf(final Class<T> clazz) {
    Objects.instance().assertIsInstanceOf(this.info, this.actual, clazz);
    return clazz.cast(actual);
}
 
开发者ID:rpau,项目名称:javalang-compiler,代码行数:5,代码来源:AbstractNodeAssert.java

示例13: hasType

import org.assertj.core.internal.Objects; //导入依赖的package包/类
/**
 * Verifies that the actual {@link org.neo4j.graphdb.Relationship} has the given type name<br/>
 * <p>
 * Example:
 * 
 * <pre>
 * GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase();
 * // [...] creation of homerNode, doughnutNode
 * RelationshipType loveType = DynamicRelationshipType.withName(&quot;LOVES&quot;);
 * Relationship love = homerNode.createRelationshipTo(doughnutNode, loveType);
 * 
 * assertThat(love).hasType(&quot;LOVES&quot;);
 * </pre>
 * 
 * If the <code>relationshipTypeName</code> is {@code null}, an {@link IllegalArgumentException} is thrown.
 * <p>
 * 
 * @param relationshipTypeName a {@link org.neo4j.graphdb.Relationship} type name
 * @return this {@link RelationshipAssert} for assertions chaining
 * 
 * @throws IllegalArgumentException if <code>relationshipTypeName</code> is {@code null}.
 * @throws AssertionError if the actual {@link org.neo4j.graphdb.Relationship} does not have the given type name
 */
public RelationshipAssert hasType(String relationshipTypeName) {
  Objects.instance().assertNotNull(info, actual);

  RelationshipType actualType = actual.getType();
  checkTypeNameIsNotNull(actualType);

  if (relationshipTypeName == null) {
    throw new IllegalArgumentException("The relationship type to look for should not be null");
  }

  if (!actualType.name().equals(relationshipTypeName)) {
    throw Failures.instance().failure(info, shouldHaveRelationshipType(actual, relationshipTypeName));
  }
  return this;
}
 
开发者ID:joel-costigliola,项目名称:assertj-neo4j,代码行数:39,代码来源:RelationshipAssert.java

示例14: assertNotNull

import org.assertj.core.internal.Objects; //导入依赖的package包/类
private static void assertNotNull(AssertionInfo info, Instant actual) {
  Objects.instance().assertNotNull(info, actual);
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:4,代码来源:AbstractInstantAssert.java

示例15: containsColumns

import org.assertj.core.internal.Objects; //导入依赖的package包/类
/**
 * Verifies that the actual {@link Table} contains the given columns.
 *
 * <p>
 * Example :
 *
 * <pre><code class='java'> Table<Integer, Integer, String> actual = HashBasedTable.create();
 *
 * actual.put(1, 3, "Millard Fillmore");
 * actual.put(1, 4, "Franklin Pierce");
 * actual.put(2, 5, "Grover Cleveland");
 *
 * assertThat(actual).containsColumns(3, 4);</code></pre>
 *
 * @param columns The columns to look for in the actual {@link Table}
 * @return this {@link TableAssert} for assertion chaining.
 * @throws IllegalArgumentException if no param columns have been set.
 * @throws AssertionError           if the actual {@link Table} is {@code null}.
 * @throws AssertionError           if the actual {@link Table} does not contain the given columns.
 */
public TableAssert<R, C, V> containsColumns(@SuppressWarnings("unchecked") C... columns) {
  Objects.instance().assertNotNull(info, actual);
  checkArgument(columns != null, "The columns to look for should not be null.");
  checkArgument(columns.length > 0, "The columns to look for should not be empty.");

  Set<C> columnsNotFound = Sets.newHashSet();
  for (C column : columns) {
    if (!actual.containsColumn(column)) {
      columnsNotFound.add(column);
    }
  }

  if (!columnsNotFound.isEmpty()) {
    throw failures.failure(info, tableShouldContainColumns(actual, columns, columnsNotFound));
  }

  return myself;
}
 
开发者ID:joel-costigliola,项目名称:assertj-guava,代码行数:39,代码来源:TableAssert.java


注:本文中的org.assertj.core.internal.Objects类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。