RawConfig extends ConfigInstance { @Override public boolean equals(Object o) { if (o == this) { return true; } if (! (o instanceof RawConfig)) { return false; } RawConfig other = (RawConfig) o; if (! (key.equals(other.key) && defMd5.equals(other.defMd5) && (errorCode == other.errorCode)) ) { return false; } if (isError()) return true; if (generation != other.generation) return false; if (configMd5 != null) { return configMd5.equals(other.configMd5); } else { return (other.configMd5 == null); } } RawConfig(ConfigKey<?> key, String defMd5);  RawConfig(ConfigKey<?> key, String defMd5, Payload payload, String configMd5, long generation,
                     boolean internalRedeploy, List<String> defContent, Optional<VespaVersion> vespaVersion);  RawConfig(RawConfig rawConfig);  RawConfig(ConfigKey<?> key, String defMd5, Payload payload, String configMd5, long generation,
                     boolean internalRedeploy, int errorCode, List<String> defContent, Optional<VespaVersion> vespaVersion); static RawConfig createFromResponseParameters(JRTClientConfigRequest req); static RawConfig createFromServerRequest(JRTServerConfigRequest req); ConfigKey<?> getKey(); String getName(); String getNamespace(); String getConfigId(); String getConfigMd5(); String getDefMd5(); long getGeneration(); void setGeneration(long generation); void setInternalRedeploy(boolean internalRedeploy); boolean isInternalRedeploy(); Payload getPayload(); int errorCode(); String getDefNamespace(); Optional<VespaVersion> getVespaVersion(); boolean hasEqualConfig(JRTServerConfigRequest req); boolean hasNewerGeneration(JRTServerConfigRequest req); boolean isError(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); List<String> getDefContent();  }
@Test public void testEquals() { RawConfig config = new RawConfig(key, defMd5); assertThat(config, is(new RawConfig(key, defMd5))); assertThat(config, is(not(new RawConfig(key, "a")))); assertThat(config.hashCode(), is(new RawConfig(key, defMd5).hashCode())); assertThat(config.hashCode(), is(not(new RawConfig(key, "a").hashCode()))); config = new RawConfig(key, defMd5, payload, configMd5, generation, false, defContent, Optional.empty()); RawConfig config2 = new RawConfig(key, defMd5, payload, configMd5, 2L, false, defContent, Optional.empty()); assertThat(config, is(not(config2))); assertThat(config.hashCode(), is(not(config2.hashCode()))); final VespaVersion vespaVersion = VespaVersion.fromString("5.37.38"); RawConfig config3 = new RawConfig(key, defMd5, payload, "9999", generation, false, defContent, Optional.of(vespaVersion)); assertThat(config, is(not(config3))); assertThat(config.hashCode(), is(not(config3.hashCode()))); assertThat(config3.getVespaVersion().get().toString(), is(vespaVersion.toString())); assertThat(config.getVespaVersion(), is(not(config3.getVespaVersion()))); assertNotEquals(null, config); assertNotEquals(config, key); RawConfig errorConfig1 = new RawConfig(key, defMd5, payload, configMd5, generation, false, 1, defContent, Optional.empty()); assertThat(errorConfig1, is(errorConfig1)); assertThat(config, is(not(errorConfig1))); assertThat(config.hashCode(), is(not(errorConfig1.hashCode()))); assertThat(errorConfig1, is(errorConfig1)); RawConfig errorConfig2 = new RawConfig(key, defMd5, payload, configMd5, generation, false, 2, defContent, Optional.empty()); assertThat(errorConfig1, is(not(errorConfig2))); assertThat(errorConfig1.hashCode(), is(not(errorConfig2.hashCode()))); }