org.assertj.core.util.Objects类的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(170)

本文整理了Java中org.assertj.core.util.Objects类的一些代码示例,展示了Objects类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Objects类的具体详情如下:
包路径:org.assertj.core.util.Objects
类名称:Objects

Objects介绍

[英]Utility methods related to objects.
[中]与对象相关的实用方法。

代码示例

代码示例来源:origin: org.assertj/assertj-core

  1. /**
  2. * Returns <code>true</code> if given item is in given array, <code>false</code> otherwise.
  3. *
  4. * @param item the object to look for in arrayOfValues
  5. * @param arrayOfValues the array of values
  6. * @return <code>true</code> if given item is in given array, <code>false</code> otherwise.
  7. */
  8. private static boolean isItemInArray(Object item, Object[] arrayOfValues) {
  9. for (Object value : arrayOfValues)
  10. if (areEqual(value, item)) return true;
  11. return false;
  12. }

代码示例来源:origin: org.assertj/assertj-core

  1. @Override
  2. public int hashCode() {
  3. int result = 1;
  4. result = HASH_CODE_PRIME * result + hashCodeFor(actual);
  5. result = HASH_CODE_PRIME * result + hashCodeFor(expected);
  6. return result;
  7. }

代码示例来源:origin: org.assertj/assertj-core

  1. /**
  2. * Returns {@code true} if the given objects are equal or if both objects are {@code null}.
  3. *
  4. * @param o1 one of the objects to compare.
  5. * @param o2 one of the objects to compare.
  6. * @return {@code true} if the given objects are equal or if both objects are {@code null}.
  7. */
  8. public static boolean areEqual(Object o1, Object o2) {
  9. if (o1 == null) {
  10. return o2 == null;
  11. }
  12. if (o1.equals(o2)) {
  13. return true;
  14. }
  15. return areEqualArrays(o1, o2);
  16. }

代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils

  1. private String typeNames(Class<?>... types) {
  2. return Arrays.toString(namesOf(types));
  3. }

代码示例来源:origin: org.assertj/assertj-core

  1. /**
  2. * Returns true if actual and other are equal based on {@link Objects#areEqual(Object, Object)}, false otherwise.
  3. *
  4. * @param actual the object to compare to other
  5. * @param other the object to compare to actual
  6. * @return true if actual and other are equal based on {@link Objects#areEqual(Object, Object)}, false otherwise.
  7. */
  8. @Override
  9. public boolean areEqual(Object actual, Object other) {
  10. return Objects.areEqual(actual, other);
  11. }

代码示例来源:origin: org.assertj/assertj-core

  1. @Override
  2. public int hashCode() {
  3. return HASH_CODE_PRIME * hashCodeFor(description);
  4. }
  5. }

代码示例来源:origin: joel-costigliola/assertj-core

  1. /**
  2. * Returns {@code true} if the given objects are equal or if both objects are {@code null}.
  3. *
  4. * @param o1 one of the objects to compare.
  5. * @param o2 one of the objects to compare.
  6. * @return {@code true} if the given objects are equal or if both objects are {@code null}.
  7. */
  8. public static boolean areEqual(Object o1, Object o2) {
  9. if (o1 == null) {
  10. return o2 == null;
  11. }
  12. if (o1.equals(o2)) {
  13. return true;
  14. }
  15. return areEqualArrays(o1, o2);
  16. }

代码示例来源:origin: org.assertj/assertj-core

  1. protected boolean areEqual(final NUMBER value, final NUMBER other) {
  2. return Objects.areEqual(value, other);
  3. }

代码示例来源:origin: org.assertj/assertj-core

  1. @Override
  2. public int hashCode() {
  3. int result = 1;
  4. result = HASH_CODE_PRIME * result + hashCodeFor(value);
  5. return result;
  6. }

代码示例来源:origin: org.assertj/assertj-core

  1. @Override
  2. public int compare(Object actual, Object other) {
  3. return areEqual(actual, other) ? 0 : NOT_EQUAL;
  4. }

代码示例来源:origin: org.assertj/assertj-core

  1. @Override
  2. public int hashCode() {
  3. return HASH_CODE_PRIME + hashCodeFor(value) + hashCodeFor(args);
  4. }

代码示例来源:origin: org.assertj/assertj-core

  1. boolean filter(Object propertyValueOfCurrentElement) {
  2. return !areEqual(propertyValueOfCurrentElement, filterParameter);
  3. }

代码示例来源:origin: joel-costigliola/assertj-core

  1. @Override
  2. public int hashCode() {
  3. return HASH_CODE_PRIME * hashCodeFor(description);
  4. }
  5. }

代码示例来源:origin: joel-costigliola/assertj-core

  1. /**
  2. * Returns true if actual and other are equal based on {@link Objects#areEqual(Object, Object)}, false otherwise.
  3. *
  4. * @param actual the object to compare to other
  5. * @param other the object to compare to actual
  6. * @return true if actual and other are equal based on {@link Objects#areEqual(Object, Object)}, false otherwise.
  7. */
  8. @Override
  9. public boolean areEqual(Object actual, Object other) {
  10. return Objects.areEqual(actual, other);
  11. }

代码示例来源:origin: joel-costigliola/assertj-core

  1. @Override
  2. public int hashCode() {
  3. int result = 1;
  4. result = HASH_CODE_PRIME * result + hashCodeFor(actual);
  5. result = HASH_CODE_PRIME * result + hashCodeFor(expected);
  6. return result;
  7. }

代码示例来源:origin: joel-costigliola/assertj-core

  1. /**
  2. * Returns <code>true</code> if given item is in given array, <code>false</code> otherwise.
  3. *
  4. * @param item the object to look for in arrayOfValues
  5. * @param arrayOfValues the array of values
  6. * @return <code>true</code> if given item is in given array, <code>false</code> otherwise.
  7. */
  8. private static boolean isItemInArray(Object item, Object[] arrayOfValues) {
  9. for (Object value : arrayOfValues)
  10. if (areEqual(value, item)) return true;
  11. return false;
  12. }

代码示例来源:origin: joel-costigliola/assertj-core

  1. @Override
  2. public int hashCode() {
  3. int result = 1;
  4. result = HASH_CODE_PRIME * result + hashCodeFor(value);
  5. return result;
  6. }

代码示例来源:origin: joel-costigliola/assertj-core

  1. @Override
  2. public int compare(Object actual, Object other) {
  3. return areEqual(actual, other) ? 0 : NOT_EQUAL;
  4. }

代码示例来源:origin: joel-costigliola/assertj-core

  1. @Override
  2. public int hashCode() {
  3. return HASH_CODE_PRIME + hashCodeFor(value) + hashCodeFor(args);
  4. }

代码示例来源:origin: org.assertj/assertj-core

  1. @Override
  2. public boolean equals(Object obj) {
  3. if (this == obj) return true;
  4. if (obj == null) return false;
  5. if (getClass() != obj.getClass()) return false;
  6. TextDescription other = (TextDescription) obj;
  7. return areEqual(value, other.value) && areEqual(args, other.args);
  8. }
  9. }

相关文章