From 5b29c53b326b5fd283cb06356e94df5f78508860 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 23 Mar 2012 16:35:48 -0400
Subject: [PATCH] Update indexed branches on federation pull

---
 tests/com/gitblit/tests/FileUtilsTest.java |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/tests/com/gitblit/tests/FileUtilsTest.java b/tests/com/gitblit/tests/FileUtilsTest.java
index 4e416cb..12161bc 100644
--- a/tests/com/gitblit/tests/FileUtilsTest.java
+++ b/tests/com/gitblit/tests/FileUtilsTest.java
@@ -15,20 +15,34 @@
  */
 package com.gitblit.tests;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import java.io.File;
+
+import org.junit.Test;
 
 import com.gitblit.utils.FileUtils;
 
-import junit.framework.TestCase;
+public class FileUtilsTest {
 
-public class FileUtilsTest extends TestCase {
-
+	@Test
 	public void testReadContent() throws Exception {
 		File dir = new File(System.getProperty("user.dir"));
 		String rawContent = FileUtils.readContent(new File(dir, "LICENSE"), "\n");
 		assertTrue(rawContent.trim().startsWith("Apache License"));
 	}
 
+	@Test
+	public void testWriteContent() throws Exception {
+		String contentA = "this is a test";
+		File tmp = File.createTempFile("gitblit-", ".test");
+		FileUtils.writeContent(tmp, contentA);
+		String contentB = FileUtils.readContent(tmp, "\n").trim();
+		assertEquals(contentA, contentB);
+	}
+
+	@Test
 	public void testFolderSize() throws Exception {
 		assertEquals(-1, FileUtils.folderSize(null));
 		assertEquals(-1, FileUtils.folderSize(new File(System.getProperty("user.dir"), "pretend")));
@@ -39,7 +53,6 @@
 
 		File file = new File(System.getProperty("user.dir"), "LICENSE");
 		size = FileUtils.folderSize(file);
-		assertTrue("size is actually " + size, size == 11556L);
-
+		assertEquals("size is actually " + size, 11556L, size);
 	}
 }
\ No newline at end of file

--
Gitblit v1.9.1