package org.adligo.tests4j_tests.run.common;

import org.adligo.tests4j.run.common.FileUtils;
import org.adligo.tests4j.shared.asserts.reference.AllowedReferences;
import org.adligo.tests4j.shared.asserts.reference.CircularDependencies;
import org.adligo.tests4j.system.shared.trials.SourceFileScope;
import org.adligo.tests4j.system.shared.trials.Test;
import org.adligo.tests4j_tests.base_trials.I_CountType;
import org.adligo.tests4j_tests.base_trials.SourceFileCountingTrial;
import org.adligo.tests4j_tests.references_groups.Tests4J_RunCommon_ReferenceGroup;

import java.io.File;

/**
 * @author scott
 *
 */
@SourceFileScope (sourceClass=FileUtils.class,minCoverage=41.0, 
  allowedCircularDependencies=CircularDependencies.AllowInnerOuterClasses)
@AllowedReferences (groups=Tests4J_RunCommon_ReferenceGroup.class)
public class FileUtilsTrial extends SourceFileCountingTrial {

  @Test
  public void testMethodGetRunDir() {
    File file = new File(".");
    String dir = FileUtils.getRunDir();
    assertTrue(file.getAbsolutePath().indexOf(dir) == 0);
    int idx = dir.lastIndexOf(".");
    assertFalse(idx == dir.length() - 1);
  }
  
	@Override
	public int getTests(I_CountType type) {
		return super.getTests(type, 1, true);
	}
	@Override
	public int getAsserts(I_CountType type) {
	  int asserts = 2;
		if (type.isFromMetaWithCoverage()) {
			//code coverage and circular dependencies
			return super.getAsserts(type,asserts + 3);
		} else {
			return super.getAsserts(type, asserts);
		}
	}

	@Override
	public int getUniqueAsserts(I_CountType type) {
	  int uasserts = 2;
		if (type.isFromMetaWithCoverage()) {
			return super.getUniqueAsserts(type,uasserts + 3);
		} else {
			return super.getUniqueAsserts(type, uasserts);
		}
	}

}

@@ -882,16 +882,46 @@
  %7B%0A%0A
+  @SuppressWarnings(%22boxing%22)%0A
   @Test%0A
   pu
@@ -916,16 +916,16 @@
   @Test%0A
-
   public
@@ -1161,16 +1161,84 @@
 ) - 1);%0A
+    assertEquals(File.separatorChar, dir.charAt(dir.length() - 1));%0A
   %7D%0A  %0A%09
@@ -1394,33 +1394,33 @@
   int asserts = 
-2
+3
 ;%0A%09%09if (type.isF
@@ -1679,9 +1679,9 @@
 s = 
-2
+3
 ;%0A%09%09

make sure runDir ends with File.separator.