func TestPickIf(t *testing.T) {
	m := New().
		PickIf(alwaysTrue, "ID", "FirstName").
		PickIf(alwaysFalse, "Email").Transform(user)
	assert.Contains(t, m, "ID")
	assert.Contains(t, m, "FirstName")
	assert.NotContains(t, m, "Email")
	assert.NotContains(t, m, "Age")
}
func TestAddIf(t *testing.T) {
	m := New().AddIf(alwaysFalse, "Foo", "Bar").Transform(user)
	assert.NotContains(t, m, "Foo")
	m = New().AddIf(alwaysTrue, "Foo", "Bar").Transform(user)
	assert.Contains(t, m, "Foo")
	assert.Equal(t, "Bar", m["Foo"])
}
func TestConvertKeys(t *testing.T) {
	m := New().PickAll().ConvertKeys(func(s string) string {
		return "dummy_" + s
	}).Transform(user)
	assert.Contains(t, m, "dummy_ID")
	assert.Contains(t, m, "dummy_FirstName")
	assert.NotContains(t, m, "ID")
}
func TestAddFuncIf(t *testing.T) {
	m := New().AddFuncIf(alwaysTrue, "Foo", func(u interface{}) interface{} {
		return "Bar"
	}).Transform(user)
	assert.Contains(t, m, "Foo")
	assert.Equal(t, m["Foo"], "Bar")
	m = New().AddFuncIf(alwaysFalse, "Foo", identity).Transform(user)
	assert.NotContains(t, m, "Foo")
}
func TestPickFuncIf(t *testing.T) {
	m := New().PickFuncIf(alwaysTrue, func(t interface{}) interface{} {
		return t.(time.Time).Format(time.RFC3339)
	}, "CreatedAt", "UpdatedAt").PickFuncIf(alwaysFalse, identity, "Email").Transform(user)
	assert.Contains(t, m, "CreatedAt")
	assert.Contains(t, m, "UpdatedAt")
	assert.NotContains(t, m, "Email")
	assert.Equal(t, m["CreatedAt"], user.CreatedAt.Format(time.RFC3339))
}
func TestPick(t *testing.T) {
	m := New().Pick("ID", "Age").Transform(user)
	assert.Contains(t, m, "ID")
	assert.Contains(t, m, "Age")
	assert.NotContains(t, m, "FirstName")
	m = New().Pick("ID").Pick("Age").Transform(user)
	assert.Contains(t, m, "ID")
	assert.Contains(t, m, "Age")
	assert.Equal(t, m["ID"], user.ID)
}
func TestOmitIf(t *testing.T) {
	m := New().PickAll().OmitIf(func(u interface{}) bool {
		return u.(User).HideName
	}, "FirstName", "LastName").Transform(user)
	assert.NotContains(t, m, "FirstName", "LastName")

	m = New().PickAll().OmitIf(func(u interface{}) bool {
		return u.(User).Age < 18
	}, "Birthday", "Age").Transform(user)
	assert.Contains(t, m, "Birthday")
	assert.Contains(t, m, "Age")
}
func TestUseCamelCase(t *testing.T) {
	m := New().UseCamelCase().PickAll().Transform(user)
	assert.Contains(t, m, "id")
	assert.Contains(t, m, "firstName")
	assert.NotContains(t, m, "FirstName")
}
func TestOmit(t *testing.T) {
	m := New().PickAll().Omit("Birthday", "FirstName").Transform(user)
	assert.NotContains(t, m, "Birthday")
	assert.NotContains(t, m, "FirstName")
	assert.Contains(t, m, "ID")
}