List of usage examples for java.util Arrays deepEquals
public static boolean deepEquals(Object[] a1, Object[] a2)
From source file:com.opengamma.maths.lowlevelapi.datatypes.primitive.PackedMatrixTest.java
@Test // test sanity of toArray public void testToArray() { PackedMatrix tmp = new PackedMatrix(_banded); assertTrue(Arrays.deepEquals(tmp.toArray(), _banded)); tmp = new PackedMatrix(_bandedBLAS, allowZerosOn.none); assertTrue(Arrays.deepEquals(tmp.toArray(), _bandedBLAS)); }
From source file:de.pavloff.spark4knime.jsnippet.ui.JarListPanel.java
/** * Set the files to display./*from w ww . j av a 2s.c o m*/ * @param files the files */ public void setJarFiles(final String[] files) { boolean doUpdate = false; if (m_filesCache == null) { m_filesCache = files; doUpdate = true; } else { if (!Arrays.deepEquals(m_filesCache, files)) { m_filesCache = files; doUpdate = true; } } if (doUpdate) { DefaultListModel<String> jarListModel = (DefaultListModel<String>) m_addJarList.getModel(); jarListModel.removeAllElements(); for (String f : files) { try { JavaSnippetUtil.toFile(f); // validate existence etc. jarListModel.addElement(f); } catch (InvalidSettingsException e) { // ignore } } } }
From source file:org.alfresco.repo.transfer.HttpClientTransmitterImplTest.java
public void testGetStatusErrorRehydration() throws Exception { final ExceptionJsonSerializer errorSerializer = new ExceptionJsonSerializer(); final TransferException expectedException = new TransferException("my message id", new Object[] { "param1", "param2" }); when(mockedHttpClient.executeMethod(any(HostConfiguration.class), any(HttpMethod.class), any(HttpState.class))).thenReturn(200); doAnswer(new Answer<String>() { @Override//from w ww . j a v a 2 s. c o m public String answer(InvocationOnMock invocation) throws Throwable { JSONObject progressObject = new JSONObject(); progressObject.put("transferId", "mytransferid"); progressObject.put("status", Status.ERROR); progressObject.put("currentPosition", 1); progressObject.put("endPosition", 10); JSONObject errorObject = errorSerializer.serialize(expectedException); progressObject.put("error", errorObject); return progressObject.toString(); } }).when(mockedHttpMethodFactory.latestPostMethod).getResponseBodyAsString(); Transfer transfer = new Transfer(); transfer.setTransferId("mytransferid"); transfer.setTransferTarget(target); TransferProgress progress = transmitter.getStatus(transfer); assertTrue(progress.getError() != null); assertEquals(expectedException.getClass(), progress.getError().getClass()); TransferException receivedException = (TransferException) progress.getError(); assertEquals(expectedException.getMsgId(), receivedException.getMsgId()); assertTrue(Arrays.deepEquals(expectedException.getMsgParams(), receivedException.getMsgParams())); }
From source file:com.opengamma.analytics.financial.forex.method.FXMatrix.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }//from w w w.ja v a 2 s. co m if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final FXMatrix other = (FXMatrix) obj; if (!ObjectUtils.equals(_currencies, other._currencies)) { return false; } if (!Arrays.deepEquals(_fxRates, other._fxRates)) { return false; } return true; }
From source file:com.link_intersystems.lang.reflect.Member2.java
/** * Check deep equality on parameters of this {@link Member2} with another * {@link Member2}.//from ww w . ja va 2 s. c o m * * @param compareWithMember2 * @return * @since 1.0.0.0 */ protected boolean areParametersEqual(Member2<?> compareWithMember2) { return Arrays.deepEquals(getParameterTypes(), compareWithMember2.getParameterTypes()); }
From source file:org.apache.flink.test.util.TestBaseUtils.java
public static void compareResultsByLinesInMemory(String expectedResultStr, String resultPath, String[] excludePrefixes) throws Exception { ArrayList<String> list = new ArrayList<>(); readAllResultLines(list, resultPath, excludePrefixes, false); String[] result = list.toArray(new String[list.size()]); Arrays.sort(result);//from www .j a v a2 s .c o m String[] expected = expectedResultStr.isEmpty() ? new String[0] : expectedResultStr.split("\n"); Arrays.sort(expected); if (expected.length != result.length || !Arrays.deepEquals(expected, result)) { String msg = String.format( "Different elements in arrays: expected %d elements and received %d\n" + "files: %s\n expected: %s\n received: %s", expected.length, result.length, Arrays.toString(getAllInvolvedFiles(resultPath, excludePrefixes)), Arrays.toString(expected), Arrays.toString(result)); fail(msg); } }
From source file:org.alfresco.repo.transfer.HttpClientTransmitterImplTest.java
public void testBeginFailure() throws Exception { final ExceptionJsonSerializer errorSerializer = new ExceptionJsonSerializer(); final TransferException expectedException = new TransferException("my message id", new Object[] { "param1", "param2" }); when(mockedHttpClient.executeMethod(any(HostConfiguration.class), any(HttpMethod.class), any(HttpState.class))).thenReturn(500); doAnswer(new Answer<String>() { @Override/*from w w w . jav a 2s . co m*/ public String answer(InvocationOnMock invocation) throws Throwable { JSONObject errorObject = errorSerializer.serialize(expectedException); return errorObject.toString(); } }).when(mockedHttpMethodFactory.latestPostMethod).getResponseBodyAsString(); try { transmitter.begin(target, "1234", new TransferVersionImpl("2", "2", "2", "Dummy")); fail(); } catch (TransferException ex) { assertEquals(expectedException.getClass(), ex.getClass()); assertEquals(expectedException.getMsgId(), ex.getMsgId()); assertTrue(Arrays.deepEquals(expectedException.getMsgParams(), ex.getMsgParams())); } }
From source file:com.futureplatforms.kirin.test.DatabasesBackendTest_inactive.java
public void testTransaction_appendToScript() { mBackend.beginTransaction_(mTransactionConfig); DBTransaction tx = mBackend.getTransaction(txId); assertNotNull(tx);/*from w w w . ja va2s .c om*/ List<DBStatement> statements = tx.getEntries(); assertTrue(statements.isEmpty()); mBackend.appendToScript(txId, newJSONArray(newJSONArray("rowset", "STATEMENT 0", newJSONArray(), "onSQLSuccess0", "onSQLError0"), // newJSONArray("row", "STATEMENT 1", newJSONArray("foo"), "onSQLSuccess1"))); assertFalse(statements.isEmpty()); assertEquals(2, statements.size()); DBStatement s0 = statements.get(0); assertEquals(StatementType.rowset, s0.mType); assertEquals("STATEMENT 0", s0.mSql); assertEquals(0, s0.mParams.length); assertEquals("onSQLSuccess0", s0.mOnSuccess); assertEquals("onSQLError0", s0.mOnError); s0 = statements.get(1); assertEquals(StatementType.row, s0.mType); assertEquals("STATEMENT 1", s0.mSql); assertTrue(Arrays.deepEquals(new Object[] { "foo" }, s0.mParams)); assertEquals("onSQLSuccess1", s0.mOnSuccess); assertNull("onError is " + s0.mOnError, s0.mOnError); }
From source file:io.fouad.jtb.core.beans.Message.java
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Message)) return false; Message message = (Message) o;/* w w w . j a va 2s . c o m*/ if (messageId != message.messageId) return false; if (date != message.date) return false; if (editDate != message.editDate) return false; if (from != null ? !from.equals(message.from) : message.from != null) return false; if (chat != null ? !chat.equals(message.chat) : message.chat != null) return false; if (forwardFrom != null ? !forwardFrom.equals(message.forwardFrom) : message.forwardFrom != null) return false; if (forwardFromChat != null ? !forwardFromChat.equals(message.forwardFromChat) : message.forwardFromChat != null) return false; if (forwardDate != null ? !forwardDate.equals(message.forwardDate) : message.forwardDate != null) return false; if (replyToMessage != null ? !replyToMessage.equals(message.replyToMessage) : message.replyToMessage != null) return false; if (text != null ? !text.equals(message.text) : message.text != null) return false; if (!Arrays.deepEquals(entities, message.entities)) return false; if (audio != null ? !audio.equals(message.audio) : message.audio != null) return false; if (document != null ? !document.equals(message.document) : message.document != null) return false; if (!Arrays.deepEquals(photo, message.photo)) return false; if (sticker != null ? !sticker.equals(message.sticker) : message.sticker != null) return false; if (video != null ? !video.equals(message.video) : message.video != null) return false; if (voice != null ? !voice.equals(message.voice) : message.voice != null) return false; if (caption != null ? !caption.equals(message.caption) : message.caption != null) return false; if (contact != null ? !contact.equals(message.contact) : message.contact != null) return false; if (location != null ? !location.equals(message.location) : message.location != null) return false; if (venue != null ? !venue.equals(message.venue) : message.venue != null) return false; if (newChatMember != null ? !newChatMember.equals(message.newChatMember) : message.newChatMember != null) return false; if (leftChatMember != null ? !leftChatMember.equals(message.leftChatMember) : message.leftChatMember != null) return false; if (newChatTitle != null ? !newChatTitle.equals(message.newChatTitle) : message.newChatTitle != null) return false; if (!Arrays.deepEquals(newChatPhoto, message.newChatPhoto)) return false; if (deleteChatPhoto != null ? !deleteChatPhoto.equals(message.deleteChatPhoto) : message.deleteChatPhoto != null) return false; if (groupChatCreated != null ? !groupChatCreated.equals(message.groupChatCreated) : message.groupChatCreated != null) return false; if (superGroupChatCreated != null ? !superGroupChatCreated.equals(message.superGroupChatCreated) : message.superGroupChatCreated != null) return false; if (channelChatCreated != null ? !channelChatCreated.equals(message.channelChatCreated) : message.channelChatCreated != null) return false; if (migrateToChatId != null ? !migrateToChatId.equals(message.migrateToChatId) : message.migrateToChatId != null) return false; if (migrateFromChatId != null ? !migrateFromChatId.equals(message.migrateFromChatId) : message.migrateFromChatId != null) return false; return pinnedMessage != null ? pinnedMessage.equals(message.pinnedMessage) : message.pinnedMessage == null; }
From source file:mil.jpeojtrs.sca.util.tests.AnyUtilsTest.java
@Test public void test_complexArray() throws Exception { ComplexNumber[] cValue = new ComplexBoolean[] { new ComplexBoolean(), new ComplexBoolean() }; Any tmpAny = AnyUtils.toAny(cValue, (String) null); Object newValue = AnyUtils.convertAny(tmpAny); Assert.assertTrue(Arrays.deepEquals(cValue, (Object[]) newValue)); cValue = new ComplexByte[] { new ComplexByte(), new ComplexByte() }; tmpAny = AnyUtils.toAny(cValue, (String) null); newValue = AnyUtils.convertAny(tmpAny); Assert.assertTrue(Arrays.deepEquals(cValue, (Object[]) newValue)); cValue = new ComplexDouble[] { new ComplexDouble(), new ComplexDouble() }; tmpAny = AnyUtils.toAny(cValue, (String) null); newValue = AnyUtils.convertAny(tmpAny); Assert.assertTrue(Arrays.deepEquals(cValue, (Object[]) newValue)); cValue = new ComplexFloat[] { new ComplexFloat(), new ComplexFloat() }; tmpAny = AnyUtils.toAny(cValue, (String) null); newValue = AnyUtils.convertAny(tmpAny); Assert.assertTrue(Arrays.deepEquals(cValue, (Object[]) newValue)); cValue = new ComplexLong[] { new ComplexLong(), new ComplexLong() }; tmpAny = AnyUtils.toAny(cValue, (String) null); newValue = AnyUtils.convertAny(tmpAny); Assert.assertTrue(Arrays.deepEquals(cValue, (Object[]) newValue)); cValue = new ComplexLongLong[] { new ComplexLongLong(), new ComplexLongLong() }; tmpAny = AnyUtils.toAny(cValue, (String) null); newValue = AnyUtils.convertAny(tmpAny); Assert.assertTrue(Arrays.deepEquals(cValue, (Object[]) newValue)); cValue = new ComplexShort[] { new ComplexShort(), new ComplexShort() }; tmpAny = AnyUtils.toAny(cValue, (String) null); newValue = AnyUtils.convertAny(tmpAny); Assert.assertTrue(Arrays.deepEquals(cValue, (Object[]) newValue)); cValue = new ComplexUByte[] { new ComplexUByte(), new ComplexUByte() }; tmpAny = AnyUtils.toAny(cValue, (String) null); newValue = AnyUtils.convertAny(tmpAny); Assert.assertTrue(Arrays.deepEquals(cValue, (Object[]) newValue)); cValue = new ComplexULong[] { new ComplexULong(), new ComplexULong() }; tmpAny = AnyUtils.toAny(cValue, (String) null); newValue = AnyUtils.convertAny(tmpAny); Assert.assertTrue(Arrays.deepEquals(cValue, (Object[]) newValue)); cValue = new ComplexULongLong[] { new ComplexULongLong(), new ComplexULongLong() }; tmpAny = AnyUtils.toAny(cValue, (String) null); newValue = AnyUtils.convertAny(tmpAny); Assert.assertTrue(Arrays.deepEquals(cValue, (Object[]) newValue)); cValue = new ComplexUShort[] { new ComplexUShort(), new ComplexUShort() }; tmpAny = AnyUtils.toAny(cValue, (String) null); newValue = AnyUtils.convertAny(tmpAny); Assert.assertTrue(Arrays.deepEquals(cValue, (Object[]) newValue)); }