// Path: src/main/java/com/github/eostermueller/heapspank/garbagespank/GarbageSpank.java
// public class GarbageSpank {
// 	public static final String GARBAGE_SPANK = "gs_";
// 	private static ConcurrentHashMap<JStatOption,JStatMetricProvider> metricNames 
// 		= new ConcurrentHashMap<JStatOption,JStatMetricProvider>();
// 	private static ConcurrentHashMap<String,JStatMetricProvider> metricHeaders 
// 		= new ConcurrentHashMap<String,JStatMetricProvider>();
// 	
// 	static {
// 		addProvider( new Gc() );
// 		addProvider( new GcCapacity() );
// 		addProvider( new GcMetaCapacity() );
// 		addProvider( new GcNew() );
// 		addProvider( new GcNewCapacity() );
// 		addProvider( new GcOld() );
// 		addProvider( new GcOldCapacity() );
// 		addProvider( new GcUtil() );		
// 		/* add more providers below to provide support past JDK 1.8  */
// 	}
// 
// 	public static ConcurrentHashMap<JStatOption, JStatMetricProvider> getAllMetricNames() {
// 		return metricNames;
// 	}
// 	public JStatMetricProvider getMetric() {
// 		return getAllMetricNames().get(this.getJStatOption());
// 	}
// 	public static void setMetricNames(
// 			ConcurrentHashMap<JStatOption, JStatMetricProvider> metricNames) {
// 		GarbageSpank.metricNames = metricNames;
// 	}
// 	public long getPid() {
// 		return pid;
// 	}
// 	public void setPid(long pid) {
// 		this.pid = pid;
// 	}
// 	public JStatOption getJStatOption() {
// 		return jstatOption;
// 	}
// 	public void setJStatOption(JStatOption jstatOption) {
// 		this.jstatOption = jstatOption;
// 	}
// 	public long getIntervalInMilliSeconds() {
// 		return intervalInMilliSeconds;
// 	}
// 	public void setIntervalInMilliSeconds(long intervalInMilliSeconds) {
// 		this.intervalInMilliSeconds = intervalInMilliSeconds;
// 	}
// 	private long pid = -1;
// 	private JStatOption jstatOption = null;
// 	private long intervalInMilliSeconds = -1;
// 	
// 	private static void addProvider(JStatMetricProvider jsmp) {
// 		metricNames.put(jsmp.getJStatOption(), jsmp);
// 		metricHeaders.put(jsmp.getOriginalHeader(), jsmp);
// 		
// 	}
// 	public JStatMetricProvider getMetricNamesByOption(JStatOption jstatOption) {
// 		return this.metricNames.get(jstatOption);
// 	}
// 	public JStatMetricProvider getMetricByHeader(String headerFromJStat) {
// 		return this.metricHeaders.get(headerFromJStat);
// 	}
// }
// 
// Path: src/main/java/com/github/eostermueller/heapspank/garbagespank/JStatHeaderException.java
// public class JStatHeaderException extends Exception {
// 
// 	public JStatHeaderException(String string) {
// 		super(string);
// 	}
// 
// }


import static org.junit.Assert.*;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.io.StringReader;
import java.nio.charset.StandardCharsets;
import org.junit.Test;
import com.github.eostermueller.heapspank.garbagespank.GarbageSpank;
import com.github.eostermueller.heapspank.garbagespank.JStatHeaderException;
package com.github.eostermueller.heapspank.garbagespank.console;





public class TestEnhancedConsoleOld {

	   
	  
	   	
	
	static String  GCOLD_ORIG_OUTPUT_HEADER =
				  "   MC       MU      CCSC     CCSU       OC          OU       YGC    FGC    FGCT     GCT";
	static String  GCOLD_ORIG_OUTPUT_LINE_1 =
		       " 48128.0  47097.0   5888.0   5637.9    161280.0     89161.4  12973    10    1.775   13.415";
	static String  GCOLD_ORIG_OUTPUT_LINE_2 =
		       "48128.0  47097.0   5888.0   5637.9    161280.0     89185.4  12975    10    2.775   14.415";
	private static String GCNEW_ORIG_OUTPUT = GCOLD_ORIG_OUTPUT_HEADER + "\n" + GCOLD_ORIG_OUTPUT_LINE_1  + "\n" + GCOLD_ORIG_OUTPUT_LINE_2;
	
	@Test
	public void test() throws IOException, JStatHeaderException {
		BufferedReader br = new BufferedReader( new StringReader(GCNEW_ORIG_OUTPUT) );
		GarbageSpankConsole jsc = new GarbageSpankConsole();
		jsc.getGarbageSpank().setIntervalInMilliSeconds(5000);
		jsc.setReader(br);
		
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		PrintStream ps = new PrintStream(baos);
		jsc.setPrintStream(ps);
		int count = 0;
		
		jsc.processJStatLines();
		
		String content = new String(baos.toByteArray(), StandardCharsets.UTF_8);		
		
	    String[] output = content.split("\n");
	    boolean ynHeader = false;
	    
	    assertEquals(
	    		"Header line wasn't correct for enhanced gcnew", 
	    		GCOLD_ORIG_OUTPUT_HEADER.trim()+"    POF    POT", 
	    		output[0].trim());
		
	    assertEquals(
// Path: src/main/java/com/github/eostermueller/heapspank/garbagespank/GarbageSpank.java
// public class GarbageSpank {
// 	public static final String GARBAGE_SPANK = "gs_";
// 	private static ConcurrentHashMap<JStatOption,JStatMetricProvider> metricNames 
// 		= new ConcurrentHashMap<JStatOption,JStatMetricProvider>();
// 	private static ConcurrentHashMap<String,JStatMetricProvider> metricHeaders 
// 		= new ConcurrentHashMap<String,JStatMetricProvider>();
// 	
// 	static {
// 		addProvider( new Gc() );
// 		addProvider( new GcCapacity() );
// 		addProvider( new GcMetaCapacity() );
// 		addProvider( new GcNew() );
// 		addProvider( new GcNewCapacity() );
// 		addProvider( new GcOld() );
// 		addProvider( new GcOldCapacity() );
// 		addProvider( new GcUtil() );		
// 		/* add more providers below to provide support past JDK 1.8  */
// 	}
// 
// 	public static ConcurrentHashMap<JStatOption, JStatMetricProvider> getAllMetricNames() {
// 		return metricNames;
// 	}
// 	public JStatMetricProvider getMetric() {
// 		return getAllMetricNames().get(this.getJStatOption());
// 	}
// 	public static void setMetricNames(
// 			ConcurrentHashMap<JStatOption, JStatMetricProvider> metricNames) {
// 		GarbageSpank.metricNames = metricNames;
// 	}
// 	public long getPid() {
// 		return pid;
// 	}
// 	public void setPid(long pid) {
// 		this.pid = pid;
// 	}
// 	public JStatOption getJStatOption() {
// 		return jstatOption;
// 	}
// 	public void setJStatOption(JStatOption jstatOption) {
// 		this.jstatOption = jstatOption;
// 	}
// 	public long getIntervalInMilliSeconds() {
// 		return intervalInMilliSeconds;
// 	}
// 	public void setIntervalInMilliSeconds(long intervalInMilliSeconds) {
// 		this.intervalInMilliSeconds = intervalInMilliSeconds;
// 	}
// 	private long pid = -1;
// 	private JStatOption jstatOption = null;
// 	private long intervalInMilliSeconds = -1;
// 	
// 	private static void addProvider(JStatMetricProvider jsmp) {
// 		metricNames.put(jsmp.getJStatOption(), jsmp);
// 		metricHeaders.put(jsmp.getOriginalHeader(), jsmp);
// 		
// 	}
// 	public JStatMetricProvider getMetricNamesByOption(JStatOption jstatOption) {
// 		return this.metricNames.get(jstatOption);
// 	}
// 	public JStatMetricProvider getMetricByHeader(String headerFromJStat) {
// 		return this.metricHeaders.get(headerFromJStat);
// 	}
// }
// 
// Path: src/main/java/com/github/eostermueller/heapspank/garbagespank/JStatHeaderException.java
// public class JStatHeaderException extends Exception {
// 
// 	public JStatHeaderException(String string) {
// 		super(string);
// 	}
// 
// }


// Path: src/test/java/com/github/eostermueller/heapspank/garbagespank/console/TestEnhancedConsoleOld.java
import static org.junit.Assert.*;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.io.StringReader;
import java.nio.charset.StandardCharsets;
import org.junit.Test;
import com.github.eostermueller.heapspank.garbagespank.GarbageSpank;
import com.github.eostermueller.heapspank.garbagespank.JStatHeaderException;

package com.github.eostermueller.heapspank.garbagespank.console;





public class TestEnhancedConsoleOld {

	   
	  
	   	
	
	static String  GCOLD_ORIG_OUTPUT_HEADER =
				  "   MC       MU      CCSC     CCSU       OC          OU       YGC    FGC    FGCT     GCT";
	static String  GCOLD_ORIG_OUTPUT_LINE_1 =
		       " 48128.0  47097.0   5888.0   5637.9    161280.0     89161.4  12973    10    1.775   13.415";
	static String  GCOLD_ORIG_OUTPUT_LINE_2 =
		       "48128.0  47097.0   5888.0   5637.9    161280.0     89185.4  12975    10    2.775   14.415";
	private static String GCNEW_ORIG_OUTPUT = GCOLD_ORIG_OUTPUT_HEADER + "\n" + GCOLD_ORIG_OUTPUT_LINE_1  + "\n" + GCOLD_ORIG_OUTPUT_LINE_2;
	
	@Test
	public void test() throws IOException, JStatHeaderException {
		BufferedReader br = new BufferedReader( new StringReader(GCNEW_ORIG_OUTPUT) );
		GarbageSpankConsole jsc = new GarbageSpankConsole();
		jsc.getGarbageSpank().setIntervalInMilliSeconds(5000);
		jsc.setReader(br);
		
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		PrintStream ps = new PrintStream(baos);
		jsc.setPrintStream(ps);
		int count = 0;
		
		jsc.processJStatLines();
		
		String content = new String(baos.toByteArray(), StandardCharsets.UTF_8);		
		
	    String[] output = content.split("\n");
	    boolean ynHeader = false;
	    
	    assertEquals(
	    		"Header line wasn't correct for enhanced gcnew", 
	    		GCOLD_ORIG_OUTPUT_HEADER.trim()+"    POF    POT", 
	    		output[0].trim());
		
	    assertEquals(
	    		"line 1 of gcnew output wasn't correct for enhanced gcnew", 