Installer une base MYSQL 4.1
Lancer le script create_schema.sql
C'est à dire, dans HeidiSQL :
Dans une onglet "requête":
Coller le contenu du fichier create_schema.sql
Cliquer sur la flèche bleu (executer ou F9)
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
package com.github.ledoyen; | |
import org.junit.jupiter.api.extension.ExtensionContext; | |
import org.junit.jupiter.params.provider.Arguments; | |
import org.junit.jupiter.params.provider.ArgumentsProvider; | |
import org.junit.jupiter.params.provider.ArgumentsSource; | |
import java.lang.annotation.Documented; | |
import java.lang.annotation.ElementType; | |
import java.lang.annotation.Retention; |
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
git config --global --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*" |
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
val diff = DiffBuilder.compare(expected).withTest(actual) | |
.withNodeMatcher(DefaultNodeMatcher(ElementSelectors.byNameAndAllAttributes, ElementSelectors.byName)) | |
.ignoreWhitespace() | |
.ignoreComments() | |
.withDifferenceEvaluator(DifferenceEvaluators.chain(DifferenceEvaluators.Default, XmlWildcardDifferenceEvaluator())) | |
.checkForSimilar() | |
.build() | |
assertThat(diff.differences).isEmpty() | |
class XmlWildcardDifferenceEvaluator : DifferenceEvaluator { |
Java8 is required.
With a method defined as:
private Object evaluate(String jsonDocument, String javascriptFunction) {
ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
try {
String script = "var fun = function(document) {\n" +
" return JSON.parse(document)." + javascriptFunction + ";\n" +
"};";
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
fn main() { | |
bottlesong_rec(99); | |
bottlesong_loop(99); | |
} | |
fn bottlesong_rec(bottle_number: i32) { | |
if bottle_number > 0 { | |
println!("{0} bottle{1} of beer on the wall, {0} bottle{1} of beer.", bottle_number, compute_plural(bottle_number)); | |
if bottle_number == 1 { | |
println!("Take one down and pass it around, no more bottles of beer on the wall.\n\n\ |
Given two interfaces such as
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.HttpClientErrorException;
public interface HttpClient<OUTPUT> {
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
package tools; | |
import java.lang.reflect.Constructor; | |
import java.lang.reflect.InvocationTargetException; | |
import java.util.Arrays; | |
import java.util.Optional; | |
import org.mockito.internal.util.Primitives; | |
import com.google.common.base.Preconditions; |
For testing purpose you may want to "unload" some classes.
Testing the new Spring Boot @ConditionalOnClass
or @ConditionalOnMissingClass
is a good example.
Once in your JUnit class, you usually don't get to modify the classpath to remove some jar and test that your application still works.
One way to do this test is to create a Maven project in a dedicated directory with a different pom.xml (and so a different classpath at runtime) and run tests in it from your main project with the invoker plugin. See how google does it in the auto-value project.
Another way to do it is to take advantage of the high mutability of Java and hack into the classloader to modify cached data :
NewerOlder