/** * Provide a String representation of this bootstrap context's state. */ @Override public String toString() { return new ToStringCreator(this)// .append("testClass", this.testClass.getName())// .append("cacheAwareContextLoaderDelegate", this.cacheAwareContextLoaderDelegate.getClass().getName())// .toString(); }
@Override public String toString() { return new ToStringCreator(this)// .append("collaborator", this.collaborator)// .toString(); }
@Override public String toString() { return new ToStringCreator(this).append("familyFavoriteSport", map).toString(); } };
/** * Provide a textual representation of this {@code AnnotationDescriptor}. */ @Override public String toString() { return new ToStringCreator(this) .append("rootDeclaringClass", this.rootDeclaringClass) .append("declaringClass", this.declaringClass) .append("composedAnnotation", this.composedAnnotation) .append("annotation", this.annotation) .toString(); } }
@Test public void appendList() { List<SomeObject> list = new ArrayList<>(); list.add(s1); list.add(s2); list.add(s3); String str = new ToStringCreator(this).append("myLetters", list).toString(); assertEquals("[ToStringCreatorTests@" + ObjectUtils.getIdentityHexString(this) + " myLetters = list[A, B, C]]", str); }
@Test public void appendSet() { Set<SomeObject> set = new LinkedHashSet<>(); set.add(s1); set.add(s2); set.add(s3); String str = new ToStringCreator(this).append("myLetters", set).toString(); assertEquals("[ToStringCreatorTests@" + ObjectUtils.getIdentityHexString(this) + " myLetters = set[A, B, C]]", str); }
/** * Provide a String representation of the {@code @TestPropertySource} * attributes and declaring class. */ @Override public String toString() { return new ToStringCreator(this)// .append("declaringClass", this.declaringClass.getName())// .append("locations", ObjectUtils.nullSafeToString(this.locations))// .append("inheritLocations", this.inheritLocations)// .append("properties", ObjectUtils.nullSafeToString(this.properties))// .append("inheritProperties", this.inheritProperties)// .toString(); }
/** * Print the supplied cookies in a human-readable form, assuming the * {@link Cookie} implementation does not provide its own {@code toString()}. * @since 4.2 */ private void printCookies(Cookie[] cookies) { String[] cookieStrings = new String[cookies.length]; for (int i = 0; i < cookies.length; i++) { Cookie cookie = cookies[i]; cookieStrings[i] = new ToStringCreator(cookie) .append("name", cookie.getName()) .append("value", cookie.getValue()) .append("comment", cookie.getComment()) .append("domain", cookie.getDomain()) .append("maxAge", cookie.getMaxAge()) .append("path", cookie.getPath()) .append("secure", cookie.getSecure()) .append("version", cookie.getVersion()) .append("httpOnly", cookie.isHttpOnly()) .toString(); } this.printer.printValue("Cookies", cookieStrings); }
@Test public void appendMethod() throws Exception { String str = new ToStringCreator(this).append("myMethod", this.getClass().getMethod("appendMethod")).toString(); assertEquals("[ToStringCreatorTests@" + ObjectUtils.getIdentityHexString(this) + " myMethod = appendMethod@ToStringCreatorTests]", str); }
/** * Provide a String representation of this test context's state. */ @Override public String toString() { return new ToStringCreator(this) .append("testClass", this.testClass) .append("testInstance", this.testInstance) .append("testMethod", this.testMethod) .append("testException", this.testException) .append("mergedContextConfiguration", this.mergedContextConfiguration) .append("attributes", this.attributes) .toString(); }
/** * Provide a String representation of the context configuration attributes * and declaring class. */ @Override public String toString() { return new ToStringCreator(this) .append("declaringClass", this.declaringClass.getName()) .append("classes", ObjectUtils.nullSafeToString(this.classes)) .append("locations", ObjectUtils.nullSafeToString(this.locations)) .append("inheritLocations", this.inheritLocations) .append("initializers", ObjectUtils.nullSafeToString(this.initializers)) .append("inheritInitializers", this.inheritInitializers) .append("name", this.name) .append("contextLoaderClass", this.contextLoaderClass.getName()) .toString(); }
@Test public void appendClass() { String str = new ToStringCreator(this).append("myClass", this.getClass()).toString(); assertEquals("[ToStringCreatorTests@" + ObjectUtils.getIdentityHexString(this) + " myClass = ToStringCreatorTests]", str); }
@Test public void primitiveArrays() { int[] integers = new int[] {0, 1, 2, 3, 4}; String str = new ToStringCreator(integers).toString(); assertEquals("[@" + ObjectUtils.getIdentityHexString(integers) + " array<Integer>[0, 1, 2, 3, 4]]", str); }
@Test public void defaultStyleArray() { SomeObject[] array = new SomeObject[] {s1, s2, s3}; String str = new ToStringCreator(array).toString(); assertEquals("[@" + ObjectUtils.getIdentityHexString(array) + " array<ToStringCreatorTests.SomeObject>[A, B, C]]", str); }
/** * Provide a String representation of the merged SQL script configuration. */ @Override public String toString() { return new ToStringCreator(this) .append("dataSource", this.dataSource) .append("transactionManager", this.transactionManager) .append("transactionMode", this.transactionMode) .append("encoding", this.encoding) .append("separator", this.separator) .append("commentPrefix", this.commentPrefix) .append("blockCommentStartDelimiter", this.blockCommentStartDelimiter) .append("blockCommentEndDelimiter", this.blockCommentEndDelimiter) .append("errorMode", this.errorMode) .toString(); }
/** * Generate a text string containing the implementation type of this * cache and its statistics. * <p>The string returned by this method contains all information * required for compliance with the contract for {@link #logStatistics()}. * @return a string representation of this cache, including statistics */ @Override public String toString() { return new ToStringCreator(this) .append("size", size()) .append("maxSize", getMaxSize()) .append("parentContextCount", getParentContextCount()) .append("hitCount", getHitCount()) .append("missCount", getMissCount()) .toString(); }
@Override public String toString() { // @formatter:off return new ToStringCreator(this) .append("id", this.getId()) .append("name", this.name) .append("age", this.age) .append("eyeColor", this.eyeColor) .append("likesPets", this.likesPets) .append("favoriteNumber", this.favoriteNumber) .toString(); // @formatter:on }
@Override public String toString() { return new ToStringCreator(this) .append("id", this.getId()).append("new", this.isNew()) .append("lastName", this.getLastName()) .append("firstName", this.getFirstName()).append("address", this.address) .append("city", this.city).append("telephone", this.telephone).toString(); } }
/** * Provide a String representation of the {@linkplain #getTestClass() test class}, * {@linkplain #getLocations() locations}, {@linkplain #getClasses() annotated classes}, * {@linkplain #getContextInitializerClasses() context initializer classes}, * {@linkplain #getActiveProfiles() active profiles}, * {@linkplain #getPropertySourceLocations() property source locations}, * {@linkplain #getPropertySourceProperties() property source properties}, * {@linkplain #getContextCustomizers() context customizers}, * the name of the {@link #getContextLoader() ContextLoader}, and the * {@linkplain #getParent() parent configuration}. */ @Override public String toString() { return new ToStringCreator(this) .append("testClass", this.testClass) .append("locations", ObjectUtils.nullSafeToString(this.locations)) .append("classes", ObjectUtils.nullSafeToString(this.classes)) .append("contextInitializerClasses", ObjectUtils.nullSafeToString(this.contextInitializerClasses)) .append("activeProfiles", ObjectUtils.nullSafeToString(this.activeProfiles)) .append("propertySourceLocations", ObjectUtils.nullSafeToString(this.propertySourceLocations)) .append("propertySourceProperties", ObjectUtils.nullSafeToString(this.propertySourceProperties)) .append("contextCustomizers", this.contextCustomizers) .append("contextLoader", nullSafeClassName(this.contextLoader)) .append("parent", this.parent) .toString(); }
/** * Provide a String representation of the {@linkplain #getTestClass() test class}, * {@linkplain #getLocations() locations}, {@linkplain #getClasses() annotated classes}, * {@linkplain #getContextInitializerClasses() context initializer classes}, * {@linkplain #getActiveProfiles() active profiles}, * {@linkplain #getPropertySourceLocations() property source locations}, * {@linkplain #getPropertySourceProperties() property source properties}, * {@linkplain #getContextCustomizers() context customizers}, * {@linkplain #getResourceBasePath() resource base path}, the name of the * {@link #getContextLoader() ContextLoader}, and the * {@linkplain #getParent() parent configuration}. */ @Override public String toString() { return new ToStringCreator(this) .append("testClass", getTestClass()) .append("locations", ObjectUtils.nullSafeToString(getLocations())) .append("classes", ObjectUtils.nullSafeToString(getClasses())) .append("contextInitializerClasses", ObjectUtils.nullSafeToString(getContextInitializerClasses())) .append("activeProfiles", ObjectUtils.nullSafeToString(getActiveProfiles())) .append("propertySourceLocations", ObjectUtils.nullSafeToString(getPropertySourceLocations())) .append("propertySourceProperties", ObjectUtils.nullSafeToString(getPropertySourceProperties())) .append("contextCustomizers", getContextCustomizers()) .append("resourceBasePath", getResourceBasePath()) .append("contextLoader", nullSafeClassName(getContextLoader())) .append("parent", getParent()) .toString(); }