|
| 1 | +/* |
| 2 | + * Copyright 2021-2024 DiffPlug |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package com.diffplug.spotless.generic; |
| 17 | + |
| 18 | +import static org.assertj.core.api.Assumptions.assumeThat; |
| 19 | + |
| 20 | +import java.io.File; |
| 21 | +import java.util.List; |
| 22 | + |
| 23 | +import org.junit.jupiter.api.Test; |
| 24 | + |
| 25 | +import com.diffplug.spotless.FormatterStep; |
| 26 | +import com.diffplug.spotless.ResourceHarness; |
| 27 | +import com.diffplug.spotless.StepHarnessWithFile; |
| 28 | + |
| 29 | +public class NativeCmdStepTest extends ResourceHarness { |
| 30 | + |
| 31 | + @Test |
| 32 | + public void testWithSed() { |
| 33 | + File sed = new File("/usr/bin/sed"); |
| 34 | + assumeThat(sed).exists(); |
| 35 | + FormatterStep step = NativeCmdStep.create("format-native", sed, List.of("s/placeholder/replaced/g")); |
| 36 | + StepHarnessWithFile.forStep(this, step) |
| 37 | + .testResource("native_cmd/dirty.txt", "native_cmd/clean.txt"); |
| 38 | + } |
| 39 | +} |
0 commit comments