Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 3fb6aa14 authored by Marc's avatar Marc
Browse files

docs: Exemple d'assertion Approvals en java

parent 196c82bb
No related branches found
No related tags found
No related merge requests found
target
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.baldir.exemples.approval</groupId>
<artifactId>exemples-java</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.target>22</maven.compiler.target>
<maven.compiler.source>22</maven.compiler.source>
</properties>
<!-- tag::dependencies[] -->
<dependencies>
<dependency>
<groupId>com.approvaltests</groupId>
<artifactId>approvaltests</artifactId>
<version>23.0.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!-- end::dependencies[] -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.10.2</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
</project>
\ No newline at end of file
package fr.baldir.exemples.approval;
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
\ No newline at end of file
package fr.baldir.exemples.approval;
import org.approvaltests.Approvals;
import org.junit.jupiter.api.Test;
class TrucTestBasique {
// tag::truc_approved_basic[]
@Test
void truc_approved_basic() {
Approvals.verify("""
Foo : bar
Bar : baz
Baldir.fr""");
}
// end::truc_approved_basic[]
}
\ No newline at end of file
This diff is collapsed.
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
// :sectionsdir: {docdir}/sections // :sectionsdir: {docdir}/sections
:revealjs_theme: white :revealjs_theme: white
:revealjs_transition: fade :revealjs_transition: fade
:highlightjs-theme: reveal.js/plugin/highlight/a11y-light.css
:revealjs_width: 1920 :revealjs_width: 1920
:revealjs_height: 1080 :revealjs_height: 1080
...@@ -191,6 +190,30 @@ Attention à l'explosion combinatoire! ...@@ -191,6 +190,30 @@ Attention à l'explosion combinatoire!
Kata Kata
== En Java
[source,xml]
.pom.xml
----
include::exemples/java/exemples-java/pom.xml[tag=dependencies,indent=0]
----
=== Un test avec une assertion Approval
[source,java]
.TrucTest.java
----
include::exemples/java/exemples-java/src/test/java/fr/baldir/exemples/approval/TrucTestBasique.java[tag=truc_approved_basic,indent=0]
----
=== Diff tool et fichiers .approved / .received
image::java_approvals_01_diff_tool_and_approved_received_after_running_test_first_time.png[]
== Conclude == Conclude
== Questions ? == Questions ?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment