Skip to content

Commit

Permalink
Polish GroovyGradleExtensionTest
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Nov 26, 2023
1 parent 53fe1e0 commit 4775485
Showing 1 changed file with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2021 DiffPlug
* Copyright 2016-2023 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,24 +17,20 @@

import java.io.IOException;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

import com.diffplug.common.base.StringPrinter;

class GroovyGradleExtensionTest extends GradleIntegrationHarness {
/**
* We test GroovyGradleExtension only behaviors here.
*/
class GroovyGradleExtensionTest extends GroovyExtensionTest {
private static final String HEADER = "//My tests header";

@Test
void defaultTarget() throws IOException {
testTarget(true);
}

@Test
void customTarget() throws IOException {
testTarget(false);
}

private void testTarget(boolean useDefaultTarget) throws IOException {
@ParameterizedTest
@ValueSource(booleans = {true, false})
void testTarget(boolean useDefaultTarget) throws IOException {
String target = useDefaultTarget ? "" : "target 'other.gradle'";
String buildContent = StringPrinter.buildStringFromLines(
"plugins {",
Expand Down

0 comments on commit 4775485

Please sign in to comment.