@Test public void passesCorrectFunctionName() { function.call(new TestInput("test")); verify(client).invoke(requestArgument.capture()); assertThat(requestArgument.getValue().functionName(), equalTo("TestFunction")); }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public String toString() { return ToString.builder("InvokeRequest").add("FunctionName", functionName()) .add("InvocationType", invocationTypeAsString()).add("LogType", logTypeAsString()) .add("ClientContext", clientContext()) .add("Payload", payload() == null ? null : "*** Sensitive Data Redacted ***").add("Qualifier", qualifier()) .build(); }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public String toString() { return ToString.builder("InvokeRequest").add("FunctionName", functionName()) .add("InvocationType", invocationTypeAsString()).add("LogType", logTypeAsString()) .add("ClientContext", clientContext()) .add("Payload", payload() == null ? null : "*** Sensitive Data Redacted ***").add("Qualifier", qualifier()) .build(); }
@Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(functionName()); hashCode = 31 * hashCode + Objects.hashCode(invocationTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(logTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(clientContext()); hashCode = 31 * hashCode + Objects.hashCode(payload()); hashCode = 31 * hashCode + Objects.hashCode(qualifier()); return hashCode; }
public <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) { switch (fieldName) { case "FunctionName": return Optional.ofNullable(clazz.cast(functionName())); case "InvocationType": return Optional.ofNullable(clazz.cast(invocationTypeAsString())); case "LogType": return Optional.ofNullable(clazz.cast(logTypeAsString())); case "ClientContext": return Optional.ofNullable(clazz.cast(clientContext())); case "Payload": return Optional.ofNullable(clazz.cast(payload())); case "Qualifier": return Optional.ofNullable(clazz.cast(qualifier())); default: return Optional.empty(); } }
@Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(functionName()); hashCode = 31 * hashCode + Objects.hashCode(invocationTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(logTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(clientContext()); hashCode = 31 * hashCode + Objects.hashCode(payload()); hashCode = 31 * hashCode + Objects.hashCode(qualifier()); return hashCode; }
public <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) { switch (fieldName) { case "FunctionName": return Optional.ofNullable(clazz.cast(functionName())); case "InvocationType": return Optional.ofNullable(clazz.cast(invocationTypeAsString())); case "LogType": return Optional.ofNullable(clazz.cast(logTypeAsString())); case "ClientContext": return Optional.ofNullable(clazz.cast(clientContext())); case "Payload": return Optional.ofNullable(clazz.cast(payload())); case "Qualifier": return Optional.ofNullable(clazz.cast(qualifier())); default: return Optional.empty(); } }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof InvokeRequest)) { return false; } InvokeRequest other = (InvokeRequest) obj; return Objects.equals(functionName(), other.functionName()) && Objects.equals(invocationTypeAsString(), other.invocationTypeAsString()) && Objects.equals(logTypeAsString(), other.logTypeAsString()) && Objects.equals(clientContext(), other.clientContext()) && Objects.equals(payload(), other.payload()) && Objects.equals(qualifier(), other.qualifier()); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof InvokeRequest)) { return false; } InvokeRequest other = (InvokeRequest) obj; return Objects.equals(functionName(), other.functionName()) && Objects.equals(invocationTypeAsString(), other.invocationTypeAsString()) && Objects.equals(logTypeAsString(), other.logTypeAsString()) && Objects.equals(clientContext(), other.clientContext()) && Objects.equals(payload(), other.payload()) && Objects.equals(qualifier(), other.qualifier()); }