-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6a58c9c
commit afda4af
Showing
5 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/test/scala/ai/diffy/functional/algebra/BijectionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package ai.diffy.functional.algebra; | ||
|
||
public class BijectionTest { | ||
public static void main(String[] args) { | ||
Bijection<String, String> identity = Bijection.of(String::toUpperCase, String::toLowerCase); | ||
try { | ||
identity.apply("s"); | ||
identity.unapply("s"); | ||
String x = identity.wrap(str -> str+str).apply("lower"); | ||
System.out.println(x); | ||
} catch (Throwable e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/test/scala/ai/diffy/interpreter/SimpleTransformerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package ai.diffy.interpreter; | ||
|
||
public class SimpleTransformerTest { | ||
public static class Name{ | ||
public String first; | ||
public String last; | ||
} | ||
public static void main(String[] args) { | ||
try { | ||
Name name = new Name(); | ||
name.first = "Puneet"; | ||
name.last = "Khanduri"; | ||
Transformer<Name> transformer = new Transformer<>(Name.class, "(name)=>{console.log(JSON.stringify(name,null,4)); return name;}"); | ||
transformer.apply(name); | ||
} catch (Throwable e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/test/scala/ai/diffy/proxy/ReactorHttpDifferenceProxyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package ai.diffy.proxy; | ||
|
||
import reactor.core.publisher.Mono; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
public class ReactorHttpDifferenceProxyTest { | ||
public static void main(String[] args) { | ||
Mono.fromFuture(CompletableFuture.failedFuture(new RuntimeException())) | ||
.doOnError(t -> System.out.println("error")) | ||
.block() | ||
; | ||
} | ||
} |