List of usage examples for java.util Arrays deepEquals
public static boolean deepEquals(Object[] a1, Object[] a2)
From source file:sonicScream.services.SettingsServiceTest.java
/** * Test of getAllProfiles method, of class SettingsService. *///from w w w . ja va 2s. c om @Test public void testGetAllProfiles() { ArrayList<Profile> expResult = new ArrayList<Profile>(); expResult.add(defaultProfile); expResult.add(testProfile1); expResult.add(testProfileZ); expResult.add(testProfileWeirdChar); boolean equal = Arrays.deepEquals(expResult.toArray(), _testService.getAllProfiles().toArray()); assertEquals(equal, true); }
From source file:org.jasig.jpa.CacheKey.java
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; if (hashCode() != obj.hashCode()) return false; CacheKey other = (CacheKey) obj;/* w w w. j ava2 s.c om*/ if (!Arrays.deepEquals(key, other.key)) return false; if (source == null) { if (other.source != null) return false; } else if (!source.equals(other.source)) return false; return true; }
From source file:com.qcadoo.view.internal.CustomMethodHolder.java
public static boolean methodExists(final String className, final String methodName, final ApplicationContext applicationContext, final Class<?>[] expectedParameterTypes) { Preconditions.checkArgument(!StringUtils.isBlank(className), "class name attribute is not specified!"); Preconditions.checkArgument(!StringUtils.isBlank(methodName), "method name attribute is not specified!"); Preconditions.checkArgument(expectedParameterTypes != null, "expected parameter types are not specified!"); try {//from www .j av a 2 s . c om final Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(className); for (Method method : clazz.getMethods()) { if (method.getName().equals(methodName) && Arrays.deepEquals(method.getParameterTypes(), expectedParameterTypes)) { return true; } } return false; } catch (ClassNotFoundException e) { return false; } }
From source file:org.apache.lens.server.api.error.LensException.java
@Override public boolean equals(final Object o) { if (this == o) { return true; }// w ww .j a va 2s .com if (!(o instanceof LensException)) { return false; } LensException e = (LensException) o; if (errorInfo.equals(e.errorInfo) && isErrorMsgEqual(e) && Arrays.deepEquals(errorMsgFormattingArgs, e.errorMsgFormattingArgs)) { return true; } return false; }
From source file:org.sakaiproject.config.test.StoredConfigServiceTest.java
private void persistAndRetrieve(ConfigItem item) { LOG.info("persistAndRetrieve: " + item.toString()); HibernateConfigItem origItem = storedConfigService.createHibernateConfigItem(item); storedConfigService.saveOrUpdate(origItem); HibernateConfigItem savedItem = storedConfigService.findByName(origItem.getName()); Assert.assertTrue(origItem.equals(savedItem)); ConfigItem persistedItem = storedConfigService.createConfigItem(savedItem); Assert.assertEquals(item, persistedItem); // check the values are still the same if (origItem.getType().equals(ServerConfigurationService.TYPE_ARRAY)) { Assert.assertTrue(Arrays.deepEquals((String[]) item.getValue(), (String[]) persistedItem.getValue())); } else {/*from ww w . j a va 2 s .co m*/ Assert.assertTrue(item.getValue().equals(persistedItem.getValue())); } }
From source file:org.apache.flink.api.java.typeutils.TupleTypeInfoBase.java
@Override public boolean equals(Object obj) { if (obj instanceof TupleTypeInfoBase) { @SuppressWarnings("unchecked") TupleTypeInfoBase<T> other = (TupleTypeInfoBase<T>) obj; return ((this.tupleType == null && other.tupleType == null) || this.tupleType.equals(other.tupleType)) && Arrays.deepEquals(this.types, other.types); } else {//from w w w .j a va2 s.c o m return false; } }
From source file:edu.wpi.checksims.algorithm.similaritymatrix.SimilarityMatrix.java
@Override public boolean equals(Object other) { if (!(other instanceof SimilarityMatrix)) { return false; }/*from w w w . j a v a 2 s . com*/ SimilarityMatrix otherMatrix = (SimilarityMatrix) other; return otherMatrix.builtFrom.equals(builtFrom) && otherMatrix.xSubmissions.equals(xSubmissions) && otherMatrix.ySubmissions.equals(ySubmissions) && Arrays.deepEquals(otherMatrix.entries, entries); }
From source file:com.opengamma.engine.calcnode.CalculationJobItem.java
@Override public boolean equals(final Object o) { if (!(o instanceof CalculationJobItem)) { return false; }/*from w ww .j a v a 2s .c om*/ final CalculationJobItem other = (CalculationJobItem) o; return _functionUniqueIdentifier.equals(other._functionUniqueIdentifier) && _computationTargetSpecification.equals(other._computationTargetSpecification) && Arrays.deepEquals(_inputSpecifications, other._inputSpecifications) && Arrays.deepEquals(_outputSpecifications, other._outputSpecifications); }
From source file:org.netxilia.spi.impl.formula.TestFormulaParser.java
@Test public void testFilter() throws NetxiliaResourceException, NetxiliaBusinessException { JavaCCFormulaParserImpl parser = getParser(); ISheet sheet = SheetUtils.sheetWithCell("A1", "abc", "A2", "cde", "A3", "abc"); List<Integer> rows = parser.filterWithFormula(new Formula("=A1=\"abc\""), sheet); Assert.assertNotNull(rows);// w w w.ja va2 s. c o m Assert.assertTrue(Arrays.deepEquals(new Integer[] { 0, 2 }, rows.toArray(new Integer[2]))); }
From source file:ReflectUtil.java
/** * Fetches all methods of all access types from the supplied class and super * classes. Methods that have been overridden in the inheritance hierarchy are * only returned once, using the instance lowest down the hierarchy. * * @param clazz the class to inspect/*from w w w . j a va 2 s . c o m*/ * @return a collection of methods */ public static Collection<Method> getMethods(Class<?> clazz) { Collection<Method> found = new ArrayList<Method>(); while (clazz != null) { for (Method m1 : clazz.getDeclaredMethods()) { boolean overridden = false; for (Method m2 : found) { if (m2.getName().equals(m1.getName()) && Arrays.deepEquals(m1.getParameterTypes(), m2.getParameterTypes())) { overridden = true; break; } } if (!overridden) found.add(m1); } clazz = clazz.getSuperclass(); } return found; }