package org.jusecase.properties.usecases;

import static org.assertj.core.api.Assertions.assertThat;
import static org.jusecase.Builders.a;
import static org.jusecase.Builders.list;

import java.nio.file.Path;
import java.nio.file.Paths;

import org.junit.Before;
import org.junit.Test;
import org.jusecase.UsecaseTest;
import org.jusecase.properties.gateways.PropertiesGatewayTrainer;
import org.jusecase.properties.plugins.diff.Diff;
import org.jusecase.properties.plugins.diff.DiffPluginTrainer;


@SuppressWarnings("SameParameterValue")
public class GetChangedKeys_FromDiffTest extends UsecaseTest<GetChangedKeys.Request, GetChangedKeys.Response> {

   DiffPluginTrainer        diffPluginTrainer        = new DiffPluginTrainer();
   PropertiesGatewayTrainer propertiesGatewayTrainer = new PropertiesGatewayTrainer();


   @Before
   public void before() {
      usecase = new GetChangedKeys(null, diffPluginTrainer, propertiesGatewayTrainer);
      propertiesGatewayTrainer.givenFiles(a(list(Paths.get("/dev/ws/project/src/main/resources/resources.properties"))));
      diffPluginTrainer.givenRepositoryDirectory(Paths.get("/dev/ws/project"));
   }

   @Test
   public void lineAdded() {
      Path file = Paths.get("src/main/resources/resources.properties");
      Diff diff = new Diff(file);
      diff.addedLines.add("key=value");
      diffPluginTrainer.givenChangedFiles(a(list(diff)));

      whenRequestIsExecuted();

      thenKeysAre("key");
   }

   @Test
   public void lineAdded_spaces() {
      Path file = Paths.get("src/main/resources/resources.properties");
      Diff diff = new Diff(file);
      diff.addedLines.add("key = value");
      diffPluginTrainer.givenChangedFiles(a(list(diff)));

      whenRequestIsExecuted();

      thenKeysAre("key");
   }

   @Test
   public void lineDeleted() {
      Path file = Paths.get("src/main/resources/resources.properties");
      Diff diff = new Diff(file);
      diff.deletedLines.add("key=value");
      diffPluginTrainer.givenChangedFiles(a(list(diff)));

      whenRequestIsExecuted();

      thenKeysAre();
   }

   private void thenKeysAre( String... keys ) {
      assertThat(response.keys).containsExactly(keys);
   }
}
@@ -392,16 +392,81 @@
 ainer;%0D%0A
+import org.jusecase.properties.gateways.UndoableRequestGateway;%0D%0A
 import o
@@ -508,16 +508,16 @@
 .Diff;%0D%0A
-
 import o
@@ -732,16 +732,102 @@
 e%3E %7B%0D%0A%0D%0A
+   UndoableRequestGateway   undoableRequestGateway   = new UndoableRequestGateway();%0D%0A
    DiffP
@@ -1069,12 +1069,30 @@
 eys(
-null
+undoableRequestGateway
 , di

Fix test