@Test public void toString_should_return_a_valid_string_representation() { Collection<QueryParameter> queryParameters = newArrayList(new QueryParameter("Foo"),new QueryParameter("Bar") ); ApiQuery apiQuery = new ApiQuery(queryParameters); assertThat(apiQuery.toString()).isEqualTo("ApiQuery{queryParameters=[FooBar]}"); }
@Override public String toString() { final StringBuilder stringBuilder = new StringBuilder("ApiQuery{") .append("queryParameters=["); for (QueryParameter queryParameter : queryParameters) { stringBuilder.append(queryParameter.getName()); } stringBuilder.append("]").append("}"); return stringBuilder.toString(); }
ApiQuery { @Override public String toString() { final StringBuilder stringBuilder = new StringBuilder("ApiQuery{") .append("queryParameters=["); for (QueryParameter queryParameter : queryParameters) { stringBuilder.append(queryParameter.getName()); } stringBuilder.append("]").append("}"); return stringBuilder.toString(); } }
ApiQuery { @Override public String toString() { final StringBuilder stringBuilder = new StringBuilder("ApiQuery{") .append("queryParameters=["); for (QueryParameter queryParameter : queryParameters) { stringBuilder.append(queryParameter.getName()); } stringBuilder.append("]").append("}"); return stringBuilder.toString(); } ApiQuery(Collection<QueryParameter> queryParameters); }
ApiQuery { @Override public String toString() { final StringBuilder stringBuilder = new StringBuilder("ApiQuery{") .append("queryParameters=["); for (QueryParameter queryParameter : queryParameters) { stringBuilder.append(queryParameter.getName()); } stringBuilder.append("]").append("}"); return stringBuilder.toString(); } ApiQuery(Collection<QueryParameter> queryParameters); Collection<QueryParameter> getQueryParameters(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); }
ApiQuery { @Override public String toString() { final StringBuilder stringBuilder = new StringBuilder("ApiQuery{") .append("queryParameters=["); for (QueryParameter queryParameter : queryParameters) { stringBuilder.append(queryParameter.getName()); } stringBuilder.append("]").append("}"); return stringBuilder.toString(); } ApiQuery(Collection<QueryParameter> queryParameters); Collection<QueryParameter> getQueryParameters(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }