// Path: src/main/java/com/logimethods/connector/spark/to_nats/SparkToNatsConnector.java
// protected static String combineSubjects(String preSubject, String postSubject) {
// 	if (preSubject.contains(SUBJECT_PATTERN_SEPARATOR)) {
// 		Pattern pattern;
// 		String replacement;
// 		if (subjectPatternMap.containsKey(preSubject)) {
// 			final Tuple2<Pattern, String> tuple = subjectPatternMap.get(preSubject);
// 			pattern = tuple._1;
// 			replacement = tuple._2;
// 		} else {
// 			// http://www.vogella.com/tutorials/JavaRegularExpressions/article.html
// 			final int pos = preSubject.indexOf(SUBJECT_PATTERN_SEPARATOR);
// 	
// 			final String patternStr = preSubject.substring(0, pos).trim().replace(".", "\\.").replace("*", "[^\\.]*");		
// 			logger.trace(patternStr);
// 			pattern = Pattern.compile(patternStr);
// 				
// 			replacement = preSubject.substring(pos+SUBJECT_PATTERN_SEPARATOR.length()).trim();
// 			logger.trace(replacement);	
// 				
// 			subjectPatternMap.put(preSubject, new Tuple2<Pattern, String>(pattern, replacement));
// 		}
// 		return pattern.matcher(postSubject).replaceFirst(replacement);
// 	} else {
// 		return preSubject + postSubject;
// 	}
// }


import static com.logimethods.connector.spark.to_nats.SparkToNatsConnector.combineSubjects;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Properties;
import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;
package com.logimethods.connector.spark.to_nats;




public class SparkToNatsConnectorTest {

	private static final String natsURL = "nats://123.123.123.123:4444";
	private static final Properties properties = new Properties();
	private static final Collection<String> subjects = Arrays.asList("Hello", "World!");
	private static final boolean isStoredAsKeyValue = true;

	@Test
	public void testCombineSubjectsNoSubstitution() {
		final String subA = "subA";
		final String subB = "subB";

// Path: src/main/java/com/logimethods/connector/spark/to_nats/SparkToNatsConnector.java
// protected static String combineSubjects(String preSubject, String postSubject) {
// 	if (preSubject.contains(SUBJECT_PATTERN_SEPARATOR)) {
// 		Pattern pattern;
// 		String replacement;
// 		if (subjectPatternMap.containsKey(preSubject)) {
// 			final Tuple2<Pattern, String> tuple = subjectPatternMap.get(preSubject);
// 			pattern = tuple._1;
// 			replacement = tuple._2;
// 		} else {
// 			// http://www.vogella.com/tutorials/JavaRegularExpressions/article.html
// 			final int pos = preSubject.indexOf(SUBJECT_PATTERN_SEPARATOR);
// 	
// 			final String patternStr = preSubject.substring(0, pos).trim().replace(".", "\\.").replace("*", "[^\\.]*");		
// 			logger.trace(patternStr);
// 			pattern = Pattern.compile(patternStr);
// 				
// 			replacement = preSubject.substring(pos+SUBJECT_PATTERN_SEPARATOR.length()).trim();
// 			logger.trace(replacement);	
// 				
// 			subjectPatternMap.put(preSubject, new Tuple2<Pattern, String>(pattern, replacement));
// 		}
// 		return pattern.matcher(postSubject).replaceFirst(replacement);
// 	} else {
// 		return preSubject + postSubject;
// 	}
// }


// Path: src/test/java/com/logimethods/connector/spark/to_nats/SparkToNatsConnectorTest.java
import static com.logimethods.connector.spark.to_nats.SparkToNatsConnector.combineSubjects;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Properties;
import org.apache.commons.lang3.SerializationUtils;
import org.junit.Test;

package com.logimethods.connector.spark.to_nats;




public class SparkToNatsConnectorTest {

	private static final String natsURL = "nats://123.123.123.123:4444";
	private static final Properties properties = new Properties();
	private static final Collection<String> subjects = Arrays.asList("Hello", "World!");
	private static final boolean isStoredAsKeyValue = true;

	@Test
	public void testCombineSubjectsNoSubstitution() {
		final String subA = "subA";
		final String subB = "subB";

		assertEquals(subA, combineSubjects("", subA));