List of usage examples for java.util Objects hashCode
public static int hashCode(Object o)
From source file:org.jboss.forge.roaster.model.impl.AnnotationImpl.java
@Override public int hashCode() { return Objects.hashCode(annotation); }
From source file:fr.landel.utils.assertor.OperatorTest.java
/** * Test method for {@link Operator#xor()}. *///www . jav a 2 s .c o m @Test public void testXor() { final String text = "text"; assertTrue(Assertor.that(text).isEmpty().xor().isNotBlank().isOK()); assertTrue(Assertor.that(text).isEmpty().xor(true).isTrue().isOK()); assertFalse(Assertor.that(text).isEmpty().xor(true).isFalse().isOK()); assertTrue(Assertor.that(text).isEmpty().xor(text.getClass()).isAssignableFrom(CharSequence.class).isOK()); assertFalse( Assertor.that(text).isEmpty().xor(text.getClass()).isAssignableFrom(StringBuilder.class).isOK()); assertTrue(Assertor.that(text).isEmpty().xor(Calendar.getInstance()) .isAfter(DateUtils.getCalendar(new Date(0))).isOK()); assertFalse(Assertor.that(text).isEmpty().xor(Calendar.getInstance()) .isBefore(DateUtils.getCalendar(new Date(0))).isOK()); assertTrue(Assertor.that(text).isEmpty().xor(new Date()).isAfter(new Date(0)).isOK()); assertFalse(Assertor.that(text).isEmpty().xor(new Date()).isBefore(new Date(0)).isOK()); assertTrue(Assertor.that(text).isNotEmpty().xor(LocalDateTime.now()).isAfter(LocalDateTime.MAX).isOK()); assertFalse(Assertor.that(text).isNotEmpty().xor(LocalDateTime.now()).isAfter(LocalDateTime.MIN).isOK()); assertTrue(Assertor.that(text).isEmpty().xor(2).isGT(1).isOK()); assertFalse(Assertor.that(text).isEmpty().xor(2).isLT(1).isOK()); assertTrue(Assertor.that(text).isEmpty().xor("tt").isNotEmpty().isOK()); assertFalse(Assertor.that(text).isEmpty().xor("tt").isEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().xor(new String[] {}).isEmpty().isOK()); assertFalse(Assertor.that(text).isEmpty().xor(new String[] {}).isNotEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().xor(new String[] {}, EnumAnalysisMode.STREAM).isEmpty().isOK()); assertFalse( Assertor.that(text).isEmpty().xor(new String[] {}, EnumAnalysisMode.STREAM).isNotEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().xor(new String[] {}, EnumAnalysisMode.PARALLEL).isEmpty().isOK()); assertFalse( Assertor.that(text).isEmpty().xor(new String[] {}, EnumAnalysisMode.PARALLEL).isNotEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().xor(Collections.emptyList()).isEmpty().isOK()); assertFalse(Assertor.that(text).isEmpty().xor(Collections.emptyList()).isNotEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().xor(Collections.emptyList(), EnumAnalysisMode.STREAM).isEmpty() .isOK()); assertFalse(Assertor.that(text).isEmpty().xor(Collections.emptyList(), EnumAnalysisMode.STREAM).isNotEmpty() .isOK()); assertTrue(Assertor.that(text).isEmpty().xor(Collections.emptyList(), EnumAnalysisMode.PARALLEL).isEmpty() .isOK()); assertFalse(Assertor.that(text).isEmpty().xor(Collections.emptyList(), EnumAnalysisMode.PARALLEL) .isNotEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().xor(Collections.emptyMap()).isEmpty().isOK()); assertFalse(Assertor.that(text).isEmpty().xor(Collections.emptyMap()).isNotEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().xor(Collections.emptyMap(), EnumAnalysisMode.STREAM).isEmpty() .isOK()); assertFalse(Assertor.that(text).isEmpty().xor(Collections.emptyMap(), EnumAnalysisMode.STREAM).isNotEmpty() .isOK()); assertTrue(Assertor.that(text).isEmpty().xor(Collections.emptyMap(), EnumAnalysisMode.PARALLEL).isEmpty() .isOK()); assertFalse(Assertor.that(text).isEmpty().xor(Collections.emptyMap(), EnumAnalysisMode.PARALLEL) .isNotEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().xor((Object) 0).isNotNull().isOK()); assertFalse(Assertor.that(text).isEmpty().xor((Object) 0).isNull().isOK()); assertTrue(Assertor.that(text).isEmpty().xor(new Exception()).isNotNull().isOK()); assertFalse(Assertor.that(text).isEmpty().xor(new Exception()).isNull().isOK()); assertTrue(Assertor.that(Color.BLACK).isNull().xor().isEqual(Color.black).isOK()); assertTrue(Assertor.that(Color.BLACK).isNull().xor((Object) 0).isNotNull().isOK()); assertTrue(Assertor.that(Color.BLACK).isNotNull().xor(Assertor.that(text).isEmpty()).isOK()); // SUB ASSERTOR assertTrue(Assertor.that(text).isNotEmpty().xorAssertor(t -> Assertor.that(t.length()).isGT(4)).isOK()); assertEquals( "the char sequence 'text' should be null or empty XOR (the number '4' should be greater than '4')", Assertor.that(text).isEmpty().xorAssertor(t -> Assertor.that(t.length()).isGT(4)).getErrors() .get()); assertException( () -> Assertor.that(text).isNotEmpty() .xorAssertor((Function<String, StepCharSequence<String>>) null).isOK(), IllegalStateException.class, "sub assertor cannot be null"); // MAPPER assertTrue(Assertor.that(false).isTrue().xorObject(b -> b.toString()).hasHashCode(Objects.hashCode("false")) .isOK()); assertTrue(Assertor.that(false).isTrue().xorCharSequence(b -> b.toString()).contains("se").isOK()); assertTrue(Assertor.that("test").isNotEmpty() .xorArray(s -> ArrayUtils.toObject(s.getBytes(StandardCharsets.UTF_8))).contains((byte) 'x') .isOK()); assertTrue(Assertor.that(false).isTrue().xorBoolean(b -> b).isFalse().isOK()); assertTrue(Assertor.that(false).isTrue().xorClass(b -> b.getClass()).hasSimpleName("Boolean").isOK()); assertTrue(Assertor.that(false).isTrue().xorDate(b -> new Date(1464475553641L)) .isAfter(new Date(1464475553640L)).isOK()); assertTrue(Assertor.that(false).isTrue().xorCalendar(b -> DateUtils.getCalendar(new Date(1464475553641L))) .isBefore(Calendar.getInstance()).isOK()); assertTrue( Assertor.that(false).isTrue().xorTemporal(b -> DateUtils.getLocalDateTime(new Date(1464475553641L))) .isBefore(LocalDateTime.now()).isOK()); assertTrue(Assertor.that(false).isTrue().xorEnum(b -> EnumOperator.AND).hasName("AND").isOK()); assertTrue(Assertor.that(false).isTrue().xorIterable(b -> Arrays.asList('t', 'r')).contains('t').isOK()); assertTrue(Assertor.that(false).isTrue().xorMap(b -> MapUtils2.newHashMap("key", b)).contains("key", false) .isOK()); assertTrue(Assertor.that(false).isTrue().xorNumber(b -> b.hashCode()).isGT(0).isOK()); // 1231 assertTrue(Assertor.that(false).isTrue().xorThrowable(b -> new IOException(b.toString())) .validates(e -> e.getMessage().contains("false")).isOK()); }
From source file:io.github.jeddict.jpa.spec.extend.Attribute.java
@Override public int hashCode() { int hash = 3; hash = 79 * hash + Objects.hashCode(this.id); return hash; }
From source file:com.erudika.para.core.App.java
@Override public int hashCode() { int hash = 7; hash = 67 * hash + Objects.hashCode(this.id) + Objects.hashCode(this.name); return hash;/*from w ww. ja v a 2 s . c o m*/ }
From source file:com.buffalokiwi.aerodrome.jet.orders.OrderRec.java
@Override public int hashCode() { int hash = 3; hash = 67 * hash + Objects.hashCode(this.merchantOrderId); return hash;// w w w. j a v a2 s . co m }
From source file:fr.landel.utils.assertor.OperatorTest.java
/** * Test method for {@link Operator#nor()}. *//*from w ww . j a v a 2 s .co m*/ @Test public void testNor() { final String text = "text"; assertTrue(Assertor.that(text).isEmpty().nor().isNotBlank().isOK()); assertTrue(Assertor.that(text).isNotEmpty().nor().isBlank().isOK()); assertTrue(Assertor.that(text).isEmpty().nor().isBlank().isOK()); assertTrue(Assertor.that(text).isEmpty().nor(true).isTrue().isOK()); assertTrue(Assertor.that(text).isEmpty().nor(true).isFalse().isOK()); assertTrue(Assertor.that(text).isEmpty().nor(text.getClass()).isAssignableFrom(CharSequence.class).isOK()); assertTrue(Assertor.that(text).isEmpty().nor(text.getClass()).isAssignableFrom(StringBuilder.class).isOK()); assertTrue(Assertor.that(text).isEmpty().nor(Calendar.getInstance()) .isAfter(DateUtils.getCalendar(new Date(0))).isOK()); assertTrue(Assertor.that(text).isEmpty().nor(Calendar.getInstance()) .isBefore(DateUtils.getCalendar(new Date(0))).isOK()); assertTrue(Assertor.that(text).isEmpty().nor(new Date()).isAfter(new Date(0)).isOK()); assertTrue(Assertor.that(text).isEmpty().nor(new Date()).isBefore(new Date(0)).isOK()); assertTrue(Assertor.that(text).isNotEmpty().nor(LocalDateTime.now()).isAfter(LocalDateTime.MAX).isOK()); assertFalse(Assertor.that(text).isNotEmpty().nor(LocalDateTime.now()).isAfter(LocalDateTime.MIN).isOK()); assertTrue(Assertor.that(text).isEmpty().nor(2).isGT(1).isOK()); assertTrue(Assertor.that(text).isEmpty().nor(2).isLT(1).isOK()); assertTrue(Assertor.that(text).isEmpty().nor("tt").isNotEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().nor("tt").isEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().nor(new String[] {}).isEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().nor(new String[] {}).isNotEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().nor(new String[] {}, EnumAnalysisMode.STREAM).isEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().nor(new String[] {}, EnumAnalysisMode.STREAM).isNotEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().nor(new String[] {}, EnumAnalysisMode.PARALLEL).isEmpty().isOK()); assertTrue( Assertor.that(text).isEmpty().nor(new String[] {}, EnumAnalysisMode.PARALLEL).isNotEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().nor(Collections.emptyList()).isEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().nor(Collections.emptyList()).isNotEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().nor(Collections.emptyList(), EnumAnalysisMode.STREAM).isEmpty() .isOK()); assertTrue(Assertor.that(text).isEmpty().nor(Collections.emptyList(), EnumAnalysisMode.STREAM).isNotEmpty() .isOK()); assertTrue(Assertor.that(text).isEmpty().nor(Collections.emptyList(), EnumAnalysisMode.PARALLEL).isEmpty() .isOK()); assertTrue(Assertor.that(text).isEmpty().nor(Collections.emptyList(), EnumAnalysisMode.PARALLEL) .isNotEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().nor(Collections.emptyMap()).isEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().nor(Collections.emptyMap()).isNotEmpty().isOK()); assertTrue(Assertor.that(text).isEmpty().nor(Collections.emptyMap(), EnumAnalysisMode.STREAM).isEmpty() .isOK()); assertTrue(Assertor.that(text).isEmpty().nor(Collections.emptyMap(), EnumAnalysisMode.STREAM).isNotEmpty() .isOK()); assertTrue(Assertor.that(text).isEmpty().nor(Collections.emptyMap(), EnumAnalysisMode.PARALLEL).isEmpty() .isOK()); assertTrue(Assertor.that(text).isEmpty().nor(Collections.emptyMap(), EnumAnalysisMode.PARALLEL).isNotEmpty() .isOK()); assertTrue(Assertor.that(text).isEmpty().nor((Object) 0).isNotNull().isOK()); assertTrue(Assertor.that(text).isEmpty().nor((Object) 0).isNull().isOK()); assertTrue(Assertor.that(text).isEmpty().nor(new Exception()).isNotNull().isOK()); assertTrue(Assertor.that(text).isEmpty().nor(new Exception()).isNull().isOK()); assertTrue(Assertor.that(Color.BLACK).isNull().nor().isEqual(Color.black).isOK()); assertTrue(Assertor.that(Color.BLACK).isNull().nor((Object) 0).isNotNull().isOK()); assertTrue(Assertor.that(Color.BLACK).isNotNull().nor(Assertor.that(text).isEmpty()).isOK()); // SUB ASSERTOR assertTrue(Assertor.that(text).isNotEmpty().norAssertor(t -> Assertor.that(t.length()).isGT(4)).isOK()); assertEquals("the char sequence 'text' should be null or empty", Assertor.that(text).isEmpty() .norAssertor(t -> Assertor.that(t.length()).isGT(4)).getErrors().get()); assertException( () -> Assertor.that(text).isNotEmpty() .norAssertor((Function<String, StepCharSequence<String>>) null).isOK(), IllegalStateException.class, "sub assertor cannot be null"); // MAPPER assertTrue(Assertor.that(false).isTrue().norObject(b -> b.toString()).hasHashCode(Objects.hashCode("true")) .isOK()); assertTrue(Assertor.that(false).isTrue().norCharSequence(b -> b.toString()).contains("ue").isOK()); assertTrue(Assertor.that("test").isNotEmpty() .norArray(s -> ArrayUtils.toObject(s.getBytes(StandardCharsets.UTF_8))).contains((byte) 'x') .isOK()); assertTrue(Assertor.that(false).isTrue().norBoolean(b -> !b).isFalse().isOK()); assertTrue(Assertor.that(false).isTrue().norClass(b -> b.getClass()).hasSimpleName("Boolean").isOK()); assertTrue(Assertor.that(false).isTrue().norDate(b -> new Date(1464475553641L)) .isAfter(new Date(1464475553640L)).isOK()); assertTrue(Assertor.that(false).isTrue().norCalendar(b -> DateUtils.getCalendar(new Date(1464475553641L))) .isBefore(Calendar.getInstance()).isOK()); assertTrue( Assertor.that(false).isTrue().norTemporal(b -> DateUtils.getLocalDateTime(new Date(1464475553641L))) .isBefore(LocalDateTime.now()).isOK()); assertTrue(Assertor.that(false).isTrue().norEnum(b -> EnumOperator.AND).hasName("AND").isOK()); assertTrue(Assertor.that(false).isTrue().norIterable(b -> Arrays.asList('t', 'r')).contains('t').isOK()); assertTrue(Assertor.that(false).isTrue().norMap(b -> MapUtils2.newHashMap("key", b)).contains("key", true) .isOK()); assertTrue(Assertor.that(false).isTrue().norNumber(b -> b.hashCode()).isGT(0).isOK()); // 1231 assertTrue(Assertor.that(false).isTrue().norThrowable(b -> new IOException(b.toString())) .validates(e -> e.getMessage().contains("true")).isOK()); }