package io.github.benas.randombeans.visibility;

import io.github.benas.randombeans.EnhancedRandomBuilder;
import io.github.benas.randombeans.FieldDefinition;
import io.github.benas.randombeans.FieldDefinitionBuilder;
import io.github.benas.randombeans.api.EnhancedRandom;
import io.github.benas.randombeans.beans.Human;
import org.junit.Test;

import java.util.function.Supplier;

import static io.github.benas.randombeans.EnhancedRandomBuilder.aNewEnhancedRandomBuilder;
import static org.junit.Assert.assertEquals;

public class VisibilityTest {
    @Test
    public void canPassSupplierLambdaFromOtherPackage() {
        EnhancedRandomBuilder builder = aNewEnhancedRandomBuilder();
        FieldDefinition field = FieldDefinitionBuilder.field().named("name").ofType(String.class).inClass(Human.class).get();
        builder.randomize(field, (Supplier) () -> "test");
        EnhancedRandom random = builder.build();
        Human human = random.nextObject(Human.class);
        assertEquals("test", human.getName());
    }
}

@@ -41,32 +41,39 @@
 bility;%0A%0Aimport 
+static 
 io.github.benas.
@@ -109,244 +109,91 @@
 lder
-;%0Aimport io.github.benas.randombeans.FieldDefinition;%0Aimport io.github.benas.randombeans.FieldDefinitionBuilder;%0Aimport io.github.benas.randombeans.api.EnhancedRandom;%0Aimpo
+.aNewEnhancedRandomBuilder;%0Aimport static org.assertj.core.api.Asse
 rt
- 
 io
-.github.benas.randombeans.beans.Human;%0Aimport org.junit.Tes
+ns.assertTha
 t;%0A%0A
@@ -228,38 +228,55 @@
 pplier;%0A%0Aimport 
-static
+org.junit.Test;%0A%0Aimport
  io.github.benas
@@ -280,32 +280,36 @@
 nas.randombeans.
+api.
 EnhancedRandomBu
@@ -310,86 +310,8 @@
 ndom
-Builder.aNewEnhancedRandomBuilder;%0Aimport static org.junit.Assert.assertEquals
 ;%0A%0Ap
@@ -339,16 +339,17 @@
 yTest %7B%0A
+%0A
     @Tes
@@ -434,23 +434,15 @@
 ndom
-Builder builder
+ random
  = a
@@ -471,167 +471,31 @@
 er()
-;%0A        FieldDefinition field = FieldDefinitionBuilder.field().named(%22name%22).ofType(String.class).inClass(Human.class).get();%0A        builder.randomize(field
+.randomize(String.class
 , (S
@@ -501,16 +501,24 @@
 Supplier
+%3CString%3E
 ) () -%3E 
@@ -528,49 +528,8 @@
 st%22)
-;%0A        EnhancedRandom random = builder
 .bui
@@ -534,24 +534,25 @@
 uild();%0A
+%0A
         
 Human hu
@@ -547,19 +547,20 @@
     
-Human human
+String value
  = r
@@ -580,13 +580,14 @@
 ect(
-Human
+String
 .cla
@@ -591,16 +591,17 @@
 class);%0A
+%0A
         
@@ -610,38 +610,36 @@
 sert
+That(value).is
 Equal
-s
+To
 (%22test%22
-, human.getName()
 );%0A 

simplify VisibilityTest#canPassSupplierLambdaFromOtherPackage