package edu.oregonstate.cope.clientRecorder;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import edu.oregonstate.cope.tests.util.StubFileProvider;

public class RecorderPropertiesTest {

	private RecorderProperties properties;
	private StubFileProvider fileProvider;

	@Before
	public void setup() {
		fileProvider = new StubFileProvider();
		properties = new RecorderProperties(fileProvider);
	}

	@Test
	public void testAddNull() {
		properties.addProperty(null, null);
		assertNull(properties.getProperty(null), null);
		assertTrue(fileProvider.isCurrentFileEmpty());
	}
	
	@Test
	public void testAddEmpty() throws Exception {
		properties.addProperty("", "");
		assertTrue(fileProvider.isCurrentFileEmpty());
	}
	
	@Test
	public void testAddNonEmpty() throws Exception {
		properties.addProperty("k", "v");
		assertEquals("v", properties.getProperty("k"));
		assertEquals("v", new RecorderProperties(fileProvider).getProperty("k"));
	}
}

@@ -782,15 +782,13 @@
 tAdd
-NonEmpt
+OneKe
 y() 
@@ -838,24 +838,296 @@
 (%22k%22, %22v%22);%0A
+%09%09testForKey(%22k%22, %22v%22);%0A%09%7D%0A%0A%09@Test%0A%09public void testAddTwoKeys() throws Exception %7B%0A%09%09properties.addProperty(%22k1%22, %22v1%22);%0A%09%09properties.addProperty(%22k2%22, %22v2%22);%0A%09%09%0A%09%09testForKey(%22k1%22, %22v1%22);%0A%09%09testForKey(%22k2%22, %22v2%22);%0A%09%7D%0A%0A%09private void testForKey(String key, String value) %7B%0A
 %09%09assertEqua
@@ -1129,19 +1129,21 @@
 tEquals(
-%22v%22
+value
 , proper
@@ -1155,27 +1155,27 @@
 getProperty(
-%22k%22
+key
 ));%0A%09%09assert
@@ -1181,19 +1181,21 @@
 tEquals(
-%22v%22
+value
 , new Re
@@ -1237,19 +1237,19 @@
 roperty(
-%22k%22
+key
 ));%0A%09%7D%0A%7D

Test for multiple key insertions added