@Override public String toString() { return toStringHelper(this) .add("timestamp", getTimestamp()) .add("command", getCommand()) .add("bus", getBus()) .add("enabled", isEnabled()) .add("bypass", isBypass()) .add("format", getFormat()) .add("unix_time",getUnixTime()) .add("action", getAction()) .add("diagnostic_request", getDiagnosticRequest()) .add("extras", getExtras()) .toString(); }
@Override public MessageKey getKey() { if (super.getKey() == null) { HashMap<String, Object> key = new HashMap<>(); key.put(COMMAND_KEY, getCommand()); setKey(new MessageKey(key)); } return super.getKey(); }
@Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeSerializable(getCommand()); out.writeString(getAction()); out.writeParcelable(getDiagnosticRequest(), flags); out.writeInt(getBus()); out.writeByte((byte) (isEnabled() ? 1 : 0)); out.writeByte((byte) (isBypass() ? 1 : 0)); out.writeString(getFormat()); out.writeLong(getUnixTime()); }
@Override public boolean equals(Object obj) { if (!super.equals(obj) || !(obj instanceof Command)) { return false; } final Command other = (Command) obj; return Objects.equal(getCommand(), other.getCommand()) && Objects.equal(getDiagnosticRequest(), other.getDiagnosticRequest()) && Objects.equal(getAction(), other.getAction()) && Objects.equal(getBus(), other.getBus()) && Objects.equal(isEnabled(), other.isEnabled()) && Objects.equal(isBypass(), other.isBypass()) && Objects.equal(getFormat(), other.getFormat()) && Objects.equal(getUnixTime(), other.getUnixTime()); }
@Test public void getCommandReturnsCommand() { assertEquals(command, message.getCommand()); }
CommandType commandType = message.getCommand(); if (commandType.equals(CommandType.VERSION)) { messageBuilder.setType(BinaryMessages.ControlCommand.Type.VERSION);