44import com .vmlens .api .Runner ;
55import dev .openfeature .sdk .providers .memory .Flag ;
66import dev .openfeature .sdk .providers .memory .InMemoryProvider ;
7+ import org .junit .jupiter .api .Test ;
78import java .util .HashMap ;
89import java .util .concurrent .atomic .AtomicInteger ;
910
@@ -15,6 +16,7 @@ public static void main(String[] args) throws InterruptedException {
1516 new VmLensTest ().asomeMethod ();
1617 }
1718
19+ @ Test
1820 public void asomeMethod () throws InterruptedException {
1921 var c = new AtomicInteger ();
2022 final OpenFeatureAPI api = new OpenFeatureAPI ();
@@ -25,20 +27,18 @@ public void asomeMethod() throws InterruptedException {
2527 flags .put ("c" , Flag .builder ().variant ("a" , "dfs" ).defaultVariant ("a" ).build ());
2628 flags .put ("d" , Flag .builder ().variant ("a" , "asddd" ).defaultVariant ("a" ).build ());
2729 api .setProviderAndWait (new InMemoryProvider (flags ));
28- var client = api . getClient ();
30+
2931 try (AllInterleavings allInterleavings = new AllInterleavings ("Concurrent evaluations and hook additions" )) {
3032 while (allInterleavings .hasNext ()) {
33+ var client = api .getClient ();
3134 c .incrementAndGet ();
32-
3335 Runner .runParallel (
3436 () -> client .getStringValue ("a" , "a" ),
3537 () -> client .addHooks (new Hook () {})
3638 );
3739 }
3840 }
39-
4041 api .shutdown ();
41-
4242 System .out .println ("c = " + c );
4343 }
4444}
0 commit comments