List of usage examples for java.util Arrays deepEquals
public static boolean deepEquals(Object[] a1, Object[] a2)
From source file:org.quackbot.hooks.core.CoreQuackbotHookTest.java
@Test(dataProvider = "onCommandLongTests") public void executeOnCommandLongTest(String cmdMessage, OnCommandLong command, String[][] expectedArgs) throws Exception { //Build the CommandEvent CommandEvent event = new CommandEvent(command, new MessageEvent(bot, null, null, cmdMessage), null, null, cmdMessage, "?testCommand", hook.getArgs(cmdMessage)); //Execute and verify values String returned = hook.executeOnCommandLong(event); assertEquals(returned, "Success", "onCommandLong doesn't return expected value"); log.debug("Current command: " + command.getName()); logMultiArray(expectedArgs, "Expected args"); logMultiArray(command.getArgs(), "Given args"); assertTrue(Arrays.deepEquals(command.getArgs(), expectedArgs), "Command test " + command.getName() + " args don't equal"); }
From source file:com.github.nmorel.gwtjackson.shared.AbstractTester.java
public boolean isArray2dEquals(Object[][] a1, Object[][] a2) { if (a1 == a2) { return true; }/*from www .ja v a2s . co m*/ if (a1 == null || a2 == null) { return false; } int length = a1.length; if (a2.length != length) { return false; } for (int i = 0; i < length; i++) { Object[] e1 = a1[i]; Object[] e2 = a2[i]; if (!Arrays.deepEquals(e1, e2)) { return false; } } return true; }
From source file:io.fouad.jtb.core.beans.ReplyKeyboardMarkup.java
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ReplyKeyboardMarkup that = (ReplyKeyboardMarkup) o; if (!Arrays.deepEquals(keyboard, that.keyboard)) return false; if (resizeKeyboard != null ? !resizeKeyboard.equals(that.resizeKeyboard) : that.resizeKeyboard != null) return false; if (oneTimeKeyboard != null ? !oneTimeKeyboard.equals(that.oneTimeKeyboard) : that.oneTimeKeyboard != null) return false; return selective != null ? selective.equals(that.selective) : that.selective == null; }
From source file:com.espertech.esper.epl.expression.ExprNewNode.java
public boolean equalsNode(ExprNode node) { if (!(node instanceof ExprNewNode)) { return false; }/*from w ww .j av a 2 s.c om*/ ExprNewNode other = (ExprNewNode) node; return Arrays.deepEquals(other.columnNames, columnNames); }
From source file:edu.umd.cs.psl.model.atom.Atom.java
@Override public boolean equals(Object oth) { if (oth == this) return true; if (oth == null) return false; Atom other = (Atom) oth;/*from ww w .j a v a 2 s .c om*/ return predicate.equals(other.predicate) && Arrays.deepEquals(arguments, other.arguments); }
From source file:edu.umd.cs.psl.model.atom.TemplateAtom.java
@Override public boolean equals(Object oth) { if (oth == this) return true; if (oth == null || !(getClass().isInstance(oth))) return false; TemplateAtom other = (TemplateAtom) oth; return predicate.equals(other.predicate) && Arrays.deepEquals(arguments, other.arguments); }
From source file:org.alfresco.util.exec.RuntimeExecBeansTest.java
public void testSplitArgumentsAsSingleValue() throws Exception { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(APP_CONTEXT_XML); try {/*from w w w . j av a 2 s . c o m*/ RuntimeExec splitExec = (RuntimeExec) ctx.getBean("commandSplitArgumentsAsSingleValue"); assertNotNull(splitExec); String[] splitCommand = splitExec.getCommand(); assertTrue( "Command arguments not split into 'dir', '.' and '..' : " + Arrays.deepToString(splitCommand), Arrays.deepEquals(new String[] { "dir", ".", ".." }, splitCommand)); } finally { ctx.close(); } }
From source file:org.protempa.valueset.ValueSetBuilder.java
@Override public boolean equals(Object obj) { if (obj == null) { return false; }/* w w w. j a va2 s.c o m*/ if (getClass() != obj.getClass()) { return false; } final ValueSetBuilder other = (ValueSetBuilder) obj; if (!Objects.equals(this.id, other.id)) { return false; } if (!Objects.equals(this.displayName, other.displayName)) { return false; } if (this.ordered != other.ordered) { return false; } if (this.ordered) { if (!Arrays.deepEquals(this.valueSetElementBuilders, other.valueSetElementBuilders)) { return false; } } else { if (!Objects.equals(org.arp.javautil.arrays.Arrays.asSet(valueSetElementBuilders), org.arp.javautil.arrays.Arrays.asSet(other.valueSetElementBuilders))) { return false; } } if (!Objects.equals(this.lowerBoundBuilder, other.lowerBoundBuilder)) { return false; } if (!Objects.equals(this.upperBoundBuilder, other.upperBoundBuilder)) { return false; } if (!Objects.equals(this.sourceIdBuilder, other.sourceIdBuilder)) { return false; } return true; }
From source file:org.moneta.SearchRequestFactoryTest.java
@Test public void testDeriveSearachNodes() throws Exception { request.setUri("/myapp", "/Environment/one/two/three"); Assert.assertTrue(Arrays.deepEquals(factory.deriveSearchNodes(request), StringUtils.split("/Environment/one/two/three", '/'))); request.setUri("", "/moneta/Environment"); Assert.assertTrue(Arrays.deepEquals(factory.deriveSearchNodes(request), StringUtils.split("/moneta/Environment", '/'))); MonetaEnvironment.getConfiguration().setIgnoredContextPathNodes(new String[] { "moneta" }); Assert.assertTrue(//from w w w. j a v a 2s .c o m Arrays.deepEquals(factory.deriveSearchNodes(request), StringUtils.split("/Environment", '/'))); }
From source file:org.quackbot.hooks.core.CoreQuackbotHookTest.java
/** * Instead of only testing onCommandLong, test feeding into onMessage *//* w w w .j a v a 2 s . c om*/ @Test(dataProvider = "onCommandLongTests") public void executeTest(String cmdMessage, OnCommandLong command, String[][] expectedArgs) throws Exception { //Remove the prefix cmdMessage = cmdMessage.substring(1); //Build the messageEvent final StringBuilder response = new StringBuilder(); MessageEvent messageEvent = new MessageEvent(bot, channel, null, cmdMessage) { @Override public void respond(String commandResponse) { if (commandResponse != null) response.append(commandResponse); } }; //Add our test listener controller.getHookManager().addHook(command); //Feed into onMessage log.trace("Sending message " + cmdMessage); hook.execute(messageEvent, channel, user, cmdMessage); //Verify the results assertEquals(response.toString(), "Success", "onCommandLong in test " + command.getName() + " doesn't return expected value"); assertTrue(Arrays.deepEquals(command.getArgs(), expectedArgs), "Command test " + command.getName() + " args don't equal"); //Remove it to cleanup controller.getHookManager().removeHook(command); }