Files
spring-boot-rest/java-strings-ops/src/test/java/com/baeldung/string/tostring/CustomerComplexObjectToStringUnitTest.java
Martin van Wingerden 81c6758d01 [BAEL-3291] Move missing code snippets for the String Numeric article
Also: format the java-strings-ops project with required eclipse profile
2019-10-23 21:32:49 +02:00

25 lines
861 B
Java

package com.baeldung.string.tostring;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
public class CustomerComplexObjectToStringUnitTest {
private static final String CUSTOMER_COMPLEX_TO_STRING = "Customer [order=Order [orderId=A1111, desc=Game, value=0], getFirstName()=Rajesh, getLastName()=Bhojwani]";
@Test
public void givenComplex_whenToString_thenCustomerDetails() {
CustomerComplexObjectToString customer = new CustomerComplexObjectToString();
customer.setFirstName("Rajesh");
customer.setLastName("Bhojwani");
Order order = new Order();
order.setOrderId("A1111");
order.setDesc("Game");
order.setStatus("In-Shiping");
customer.setOrder(order);
assertEquals(CUSTOMER_COMPLEX_TO_STRING, customer.toString());
}
}