/*
 * Copyright 2021-2022 DiffPlug
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.diffplug.spotless.maven.kotlin;

import java.io.File;

import org.junit.jupiter.api.Test;

import com.diffplug.spotless.maven.MavenIntegrationHarness;

class DiktatTest extends MavenIntegrationHarness {

	@Test
	void testDiktat() throws Exception {

		writePomWithKotlinSteps("<diktat/>");

		String path = "src/main/kotlin/Main.kt";
		setFile(path).toResource("kotlin/diktat/main.dirty");
		mavenRunner().withArguments("spotless:apply").runNoError();
		assertFile(path).sameAsResource("kotlin/diktat/main.clean");

	}

	@Test
	void testDiktatWithVersion() throws Exception {

		writePomWithKotlinSteps(
				"<diktat>",
				"  <version>1.0.1</version>",
				"</diktat>");

		String path = "src/main/kotlin/Main.kt";
		setFile(path).toResource("kotlin/diktat/main.dirty");
		mavenRunner().withArguments("spotless:apply").runNoError();
		assertFile(path).sameAsResource("kotlin/diktat/main.clean");
	}

	@Test
	void testDiktatConfig() throws Exception {

		String configPath = "src/main/kotlin/diktat-analysis.yml";
		File conf = setFile(configPath).toResource("kotlin/diktat/diktat-analysis.yml");
		writePomWithKotlinSteps(
				"<diktat>",
				"  <version>1.0.1</version>",
				"  <configFile>" + conf.getAbsolutePath() + "</configFile>",
				"</diktat>");

		String path = "src/main/kotlin/Main.kt";
		setFile(path).toResource("kotlin/diktat/main.dirty");
		mavenRunner().withArguments("spotless:apply").runNoError();
		assertFile(path).sameAsResource("kotlin/diktat/main.clean");
	}

}

@@ -1232,35 +1232,35 @@
 %09%09%22  %3Cversion%3E1.
-0.1
+2.0
 %3C/version%3E%22,%0A%09%09%09
@@ -1764,11 +1764,11 @@
 n%3E1.
-0.1
+2.0
 %3C/ve

Update the maven tests for Diktat.