package org.example;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import ch.qos.logback.core.net.SyslogOutputStream;
import org.example.domain.Customer;
import org.example.domain.User;
import org.junit.Assert;
import org.junit.Test;

import com.avaje.ebean.Ebean;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

public class BasicInsertTest extends ExampleBaseTestCase {

  @Test
  public void testInsert() throws IOException {
    
    Customer customer = new Customer();
    customer.setName("Frankie");
    
    Map<String,String> tags = new HashMap<>();
    tags.put("height","100");
    tags.put("length","400");
    tags.put("trim","large");
    
    customer.setTags(tags);
    customer.save();
    
    Assert.assertNotNull(customer.getId());

    String json = Ebean.json().toJson(customer);
    System.out.println(json);

    Customer customer1 = Ebean.json().toBean(Customer.class, json);

    assertEquals(customer.getId(), customer1.getId());
    assertEquals(customer.getName(), customer1.getName());
    assertEquals(customer.getTags().size(), customer1.getTags().size());
    assertEquals(customer.getTags().get("height"), customer1.getTags().get("height"));
    assertEquals("400", customer1.getTags().get("length"));
    assertEquals("large", customer1.getTags().get("trim"));


    Customer customer2 = Customer.find.byId(customer.getId());

    assertEquals(customer.getId(), customer2.getId());
    assertEquals(customer.getName(), customer2.getName());
    assertEquals(customer.getTags().size(), customer2.getTags().size());
    assertEquals(customer.getTags().get("height"), customer2.getTags().get("height"));
    assertEquals("400", customer2.getTags().get("length"));
    assertEquals("large", customer2.getTags().get("trim"));

    customer.setTags(new HashMap<String, String>());
    String jsonWithEmpty = Ebean.json().toJson(customer);
    System.out.println("WITH EMPTY-> "+jsonWithEmpty);
    Customer customerWithEmpty = Ebean.json().toBean(Customer.class, jsonWithEmpty);
    assertEquals(0, customerWithEmpty.getTags().size());


    customer.setTags(null);
    String jsonWithNull = Ebean.json().toJson(customer);
    System.out.println("WITH NULL-> " + jsonWithNull);
    Customer customerWithNull = Ebean.json().toBean(Customer.class, jsonWithNull);
    assertNull(customerWithNull.getTags());
  }

  @Test
  public void testInsertUser() {
    
    User user= new User();
    user.setName("Frankie");

    Ebean.save(user);
    
  }
}

@@ -26,127 +26,29 @@
 ort 
-java.io.IOException;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport ch.qos.logback.core.net.SyslogOutputStream
+com.avaje.ebean.Ebean
 ;%0Aim
@@ -169,37 +169,83 @@
 %0Aimport 
-com.avaje.ebean.Ebean
+java.io.IOException;%0Aimport java.util.HashMap;%0Aimport java.util.Map
 ;%0A%0Aimpor

Remove unused import