// Path: javagit/src/main/java/edu/nyu/cs/javagit/utilities/ExceptionMessageMap.java
// public class ExceptionMessageMap {
// 
//   private static Map<String, String> MESSAGE_MAP;
// 
//   static {
//     MESSAGE_MAP = new HashMap<String, String>();
// 
//     MESSAGE_MAP.put("000001", "000001: A String argument was not specified but is required.");
//     MESSAGE_MAP.put("000002", "000002: A List<String> argument was not specified but is required.");
//     MESSAGE_MAP.put("000003", "000003: An Object argument was not specified but is required.");
//     MESSAGE_MAP.put("000004",
//         "000004: The int argument is not greater than the lower bound (lowerBound < toCheck).");
//     MESSAGE_MAP.put("000005",
//         "000005: An List<?> argument was not specified or is empty but is required.");
//     MESSAGE_MAP.put("000006",
//         "000006: The int argument is outside the allowable range (start <= index < end).");
//     MESSAGE_MAP.put("000007","000007: The argument should be a directory.");
// 
//     MESSAGE_MAP.put("000100", "000100: Invalid option combination for git-commit command.");
//     MESSAGE_MAP.put("000110", "000110: Invalid option combination for git-add command.");
//     MESSAGE_MAP.put("000120", "000120: Invalid option combination for git-branch command.");
//     MESSAGE_MAP.put("000130", "000130: Invalid option combination for git-checkout command.");
//     
//     MESSAGE_MAP.put("020001", "020001: File or path does not exist.");
//     MESSAGE_MAP.put("020002", "020002: File or path is not a directory.");
// 
//     MESSAGE_MAP.put("020100", "020100: Unable to start sub-process.");
//     MESSAGE_MAP.put("020101", "020101: Error reading input from the sub-process.");
// 
//     MESSAGE_MAP.put("100000", "100000: Incorrect refType type.");
//     MESSAGE_MAP.put("100001", "100001: Error retrieving git version.");
//     MESSAGE_MAP.put("100002", "100002: Invalid path to git specified.");
// 
//     MESSAGE_MAP.put("401000", "401000: Error calling git-add.");
//     MESSAGE_MAP.put("401001", "401001: Error fatal pathspec error while executing git-add.");
// 
//     MESSAGE_MAP.put("410000", "410000: Error calling git-commit.");
// 
//     MESSAGE_MAP.put("404000", "404000: Error calling git-branch. ");
// 
//     MESSAGE_MAP.put("424000", "424000: Error calling git-mv. ");
// 
//     MESSAGE_MAP.put("424001", "424001: Error calling git-mv for dry-run. ");
// 
//     MESSAGE_MAP.put("420001", "420001: Error calling git log");
// 
//     MESSAGE_MAP.put("432000", "432000: Error calling git-reset.");
// 
//     MESSAGE_MAP.put("418000", "418000: Error calling git init.");
// 
//     MESSAGE_MAP.put("434000", "434000: Error calling git-rm.");
// 
//     MESSAGE_MAP.put("406000", "406000: Error calling git-checkout");
//     MESSAGE_MAP.put("406001", "406001: Error not a treeIsh RefType");
// 
//     MESSAGE_MAP.put("438000", "438000: Error calling git-status");
// 
//     MESSAGE_MAP.put("442001", "442001: No git, or wrong, major version number.");
//     MESSAGE_MAP.put("442002", "442002: No git, or wrong, minor version number.");
//     MESSAGE_MAP.put("442003", "442003: No git, or wrong, major release version number.");
//     MESSAGE_MAP.put("442004", "442004: Wrong minor release version number.");
//   }
// 
//   /**
//    * Gets the error message for the specified code.
//    * 
//    * @param code
//    *          The error code for which to get the associated error message.
//    * @return The error message for the specified code.
//    */
//   public static String getMessage(String code) {
//     String str = MESSAGE_MAP.get(code);
//     if (null == str) {
//       return "NO MESSAGE FOR ERROR CODE. { code=[" + code + "] }";
//     }
//     return str;
//   }
// 
// }


import edu.nyu.cs.javagit.utilities.ExceptionMessageMap;
import junit.framework.TestCase;
import org.junit.Before;
import org.junit.Test;
/*
 * ====================================================================
 * Copyright (c) 2008 JavaGit Project.  All rights reserved.
 *
 * This software is licensed using the GNU LGPL v2.1 license.  A copy
 * of the license is included with the distribution of this source
 * code in the LICENSE.txt file.  The text of the license can also
 * be obtained at:
 *
 *   http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
 *
 * For more information on the JavaGit project, see:
 *
 *   http://www.javagit.com
 * ====================================================================
 */
package edu.nyu.cs.javagit.test.utilities;


/**
 * Test class for edu.nyu.cs.javagit.utiltites.ExceptionMessageMap.
 */
public class TestExceptionMessageMap extends TestCase {

    @Before
    protected void setUp() {
    }

    @Test
    public void testGetMessage() {
        assertGetMessageValid(null, "NO MESSAGE FOR ERROR CODE. { code=[null] }");
        assertGetMessageValid("", "NO MESSAGE FOR ERROR CODE. { code=[] }");
        assertGetMessageValid("0", "NO MESSAGE FOR ERROR CODE. { code=[0] }");
        assertGetMessageValid("000001", "000001: A String argument was not specified but is required.");
    }

    private void assertGetMessageValid(String code, String expectedMessage) {
// Path: javagit/src/main/java/edu/nyu/cs/javagit/utilities/ExceptionMessageMap.java
// public class ExceptionMessageMap {
// 
//   private static Map<String, String> MESSAGE_MAP;
// 
//   static {
//     MESSAGE_MAP = new HashMap<String, String>();
// 
//     MESSAGE_MAP.put("000001", "000001: A String argument was not specified but is required.");
//     MESSAGE_MAP.put("000002", "000002: A List<String> argument was not specified but is required.");
//     MESSAGE_MAP.put("000003", "000003: An Object argument was not specified but is required.");
//     MESSAGE_MAP.put("000004",
//         "000004: The int argument is not greater than the lower bound (lowerBound < toCheck).");
//     MESSAGE_MAP.put("000005",
//         "000005: An List<?> argument was not specified or is empty but is required.");
//     MESSAGE_MAP.put("000006",
//         "000006: The int argument is outside the allowable range (start <= index < end).");
//     MESSAGE_MAP.put("000007","000007: The argument should be a directory.");
// 
//     MESSAGE_MAP.put("000100", "000100: Invalid option combination for git-commit command.");
//     MESSAGE_MAP.put("000110", "000110: Invalid option combination for git-add command.");
//     MESSAGE_MAP.put("000120", "000120: Invalid option combination for git-branch command.");
//     MESSAGE_MAP.put("000130", "000130: Invalid option combination for git-checkout command.");
//     
//     MESSAGE_MAP.put("020001", "020001: File or path does not exist.");
//     MESSAGE_MAP.put("020002", "020002: File or path is not a directory.");
// 
//     MESSAGE_MAP.put("020100", "020100: Unable to start sub-process.");
//     MESSAGE_MAP.put("020101", "020101: Error reading input from the sub-process.");
// 
//     MESSAGE_MAP.put("100000", "100000: Incorrect refType type.");
//     MESSAGE_MAP.put("100001", "100001: Error retrieving git version.");
//     MESSAGE_MAP.put("100002", "100002: Invalid path to git specified.");
// 
//     MESSAGE_MAP.put("401000", "401000: Error calling git-add.");
//     MESSAGE_MAP.put("401001", "401001: Error fatal pathspec error while executing git-add.");
// 
//     MESSAGE_MAP.put("410000", "410000: Error calling git-commit.");
// 
//     MESSAGE_MAP.put("404000", "404000: Error calling git-branch. ");
// 
//     MESSAGE_MAP.put("424000", "424000: Error calling git-mv. ");
// 
//     MESSAGE_MAP.put("424001", "424001: Error calling git-mv for dry-run. ");
// 
//     MESSAGE_MAP.put("420001", "420001: Error calling git log");
// 
//     MESSAGE_MAP.put("432000", "432000: Error calling git-reset.");
// 
//     MESSAGE_MAP.put("418000", "418000: Error calling git init.");
// 
//     MESSAGE_MAP.put("434000", "434000: Error calling git-rm.");
// 
//     MESSAGE_MAP.put("406000", "406000: Error calling git-checkout");
//     MESSAGE_MAP.put("406001", "406001: Error not a treeIsh RefType");
// 
//     MESSAGE_MAP.put("438000", "438000: Error calling git-status");
// 
//     MESSAGE_MAP.put("442001", "442001: No git, or wrong, major version number.");
//     MESSAGE_MAP.put("442002", "442002: No git, or wrong, minor version number.");
//     MESSAGE_MAP.put("442003", "442003: No git, or wrong, major release version number.");
//     MESSAGE_MAP.put("442004", "442004: Wrong minor release version number.");
//   }
// 
//   /**
//    * Gets the error message for the specified code.
//    * 
//    * @param code
//    *          The error code for which to get the associated error message.
//    * @return The error message for the specified code.
//    */
//   public static String getMessage(String code) {
//     String str = MESSAGE_MAP.get(code);
//     if (null == str) {
//       return "NO MESSAGE FOR ERROR CODE. { code=[" + code + "] }";
//     }
//     return str;
//   }
// 
// }


// Path: javagit/src/test/java/edu/nyu/cs/javagit/test/utilities/TestExceptionMessageMap.java
import edu.nyu.cs.javagit.utilities.ExceptionMessageMap;
import junit.framework.TestCase;
import org.junit.Before;
import org.junit.Test;

/*
 * ====================================================================
 * Copyright (c) 2008 JavaGit Project.  All rights reserved.
 *
 * This software is licensed using the GNU LGPL v2.1 license.  A copy
 * of the license is included with the distribution of this source
 * code in the LICENSE.txt file.  The text of the license can also
 * be obtained at:
 *
 *   http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
 *
 * For more information on the JavaGit project, see:
 *
 *   http://www.javagit.com
 * ====================================================================
 */
package edu.nyu.cs.javagit.test.utilities;


/**
 * Test class for edu.nyu.cs.javagit.utiltites.ExceptionMessageMap.
 */
public class TestExceptionMessageMap extends TestCase {

    @Before
    protected void setUp() {
    }

    @Test
    public void testGetMessage() {
        assertGetMessageValid(null, "NO MESSAGE FOR ERROR CODE. { code=[null] }");
        assertGetMessageValid("", "NO MESSAGE FOR ERROR CODE. { code=[] }");
        assertGetMessageValid("0", "NO MESSAGE FOR ERROR CODE. { code=[0] }");
        assertGetMessageValid("000001", "000001: A String argument was not specified but is required.");
    }

    private void assertGetMessageValid(String code, String expectedMessage) {
        String actualMessage = ExceptionMessageMap.getMessage(code);