package test.pete.executables;

import static org.junit.Assert.assertEquals;

import java.nio.file.Paths;

import org.junit.Test;

import pete.executables.DirectoryAnalyzer;
import pete.metrics.installability.deployability.DeploymentPackageAnalyzer;
import pete.metrics.installability.server.AverageInstallationTimeCalculator;
import pete.reporting.Report;

public class DirectoryAnalyzerTests {

	private DirectoryAnalyzer sut;

	@Test
	public void testDeployability() {
		sut = new DirectoryAnalyzer(new DeploymentPackageAnalyzer());
		Report report = sut.analyzeDirectory(Paths
				.get("src/test/resources/installability/deployment"));
		assertEquals(214, report.getSummedVariable("DE"));
	}

	@Test
	public void testServerInstallability() {
		sut = new DirectoryAnalyzer(new AverageInstallationTimeCalculator());
		Report report = sut.analyzeDirectory(Paths
				.get("src/test/resources/installability/server/"));
		assertEquals("2,88", report.getEntries().get(0).getVariableValue("AIT"));
		assertEquals("1,00", report.getEntries().get(0).getVariableValue("ESR"));
	}

}

@@ -639,25 +639,16 @@
 ;%0A%09%09
-assertEquals(214,
+int de =
  rep
@@ -674,16 +674,75 @@
 le(%22DE%22)
+;%0A%09%09assertEquals(%22DE should be 214, but was %22 + de, 214, de
 );%0A%09%7D%0A%0A%09
@@ -966,30 +966,23 @@
 ));%0A
+%0A
 %09%09
-assertEquals(%222,88%22,
+String ait =
  rep
@@ -1028,17 +1028,16 @@
 e(%22AIT%22)
-)
 ;%0A%09%09asse
@@ -1050,65 +1050,185 @@
 ls(%22
-1,00%22, report.getEntries().get(0).getVariableValue(%22ESR%22)
+AIT should be 2,88, but was %22, %222,88%22, ait);%0A%0A%09%09String esr = report.getEntries().get(0).getVariableValue(%22ESR%22);%0A%09%09assertEquals(%22ESR should be 1,00, but was %22 + esr, %221,00%22, esr
 );%0A%09

Add messages to DirectoryAnalyzerTests