// Path: kawala-testing/src/main/java/com/kaching/platform/testing/EquivalenceTester.java
// public static void check(Collection<?>... equivalenceClasses) {
//   List<List<Object>> ec =
//       newArrayListWithExpectedSize(equivalenceClasses.length);
// 
//   // nothing can be equal to null
//   for (Collection<? extends Object> congruenceClass : equivalenceClasses) {
//     for (Object element : congruenceClass) {
//       try {
//         assertFalse(
//             format("%s can not be equal to null", element),
//             element.equals(null));
//       } catch (NullPointerException e) {
//         throw new AssertionError(
//             format("NullPointerException when comparing %s to null", element));
//       }
//     }
//   }
// 
//   // reflexivity
//   for (Collection<? extends Object> congruenceClass : equivalenceClasses) {
//     List<Object> c = newArrayList();
//     ec.add(c);
//     for (Object element : congruenceClass) {
//       assertTrue(format("reflexivity of %s", element),
//           element.equals(element));
//       compareShouldReturn0(element, element);
//       c.add(element);
//     }
//   }
// 
//   // equality within congruence classes
//   for (List<Object> c : ec) {
//     for (int i = 0; i < c.size(); i++) {
//       Object e1 = c.get(i);
//       for (int j = i + 1; j < c.size(); j++) {
//         Object e2 = c.get(j);
//         assertTrue(format("%s=%s", e1, e2), e1.equals(e2));
//         assertTrue(format("%s=%s", e2, e1), e2.equals(e1));
//         compareShouldReturn0(e1, e2);
//         compareShouldReturn0(e2, e1);
//         assertEquals(format("hashCode %s vs. %s", e1, e2), e1.hashCode(), e2.hashCode());
//       }
//     }
//   }
// 
//   // inequality across congruence classes
//   for (int i = 0; i < ec.size(); i++) {
//     List<Object> c1 = ec.get(i);
//     for (int j = i + 1; j < ec.size(); j++) {
//       List<Object> c2 = ec.get(j);
//       for (Object e1 : c1) {
//         for (Object e2 : c2) {
//           assertFalse(format("%s!=%s", e1, e2), e1.equals(e2));
//           assertFalse(format("%s!=%s", e2, e1), e2.equals(e1));
//           compareShouldNotReturn0(e1, e2);
//           compareShouldNotReturn0(e2, e1);
//         }
//       }
//     }
//   }
// }


import org.junit.Test;
import static com.google.common.collect.Lists.newArrayList;
import static com.kaching.platform.testing.EquivalenceTester.check;
import static org.junit.Assert.assertEquals;
/**
 * Copyright 2010 Wealthfront Inc. Licensed under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
 * or agreed to in writing, software distributed under the License is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
package com.kaching.platform.common.values;



public class SsnTest {

  @Test
  public void parts() throws Exception {
    Ssn ssn = new Ssn("123456789");
    assertEquals("123", ssn.getAreaNumber());
    assertEquals("45", ssn.getGroupNumber());
    assertEquals("6789", ssn.getSerialNumber());
  }

  @Test(expected = IllegalArgumentException.class)
  public void tooLong() throws Exception {
    new Ssn("1234567890");
  }

  @Test(expected = IllegalArgumentException.class)
  public void tooShort() throws Exception {
    new Ssn("12345678");
  }

  @Test(expected = IllegalArgumentException.class)
// Path: kawala-testing/src/main/java/com/kaching/platform/testing/EquivalenceTester.java
// public static void check(Collection<?>... equivalenceClasses) {
//   List<List<Object>> ec =
//       newArrayListWithExpectedSize(equivalenceClasses.length);
// 
//   // nothing can be equal to null
//   for (Collection<? extends Object> congruenceClass : equivalenceClasses) {
//     for (Object element : congruenceClass) {
//       try {
//         assertFalse(
//             format("%s can not be equal to null", element),
//             element.equals(null));
//       } catch (NullPointerException e) {
//         throw new AssertionError(
//             format("NullPointerException when comparing %s to null", element));
//       }
//     }
//   }
// 
//   // reflexivity
//   for (Collection<? extends Object> congruenceClass : equivalenceClasses) {
//     List<Object> c = newArrayList();
//     ec.add(c);
//     for (Object element : congruenceClass) {
//       assertTrue(format("reflexivity of %s", element),
//           element.equals(element));
//       compareShouldReturn0(element, element);
//       c.add(element);
//     }
//   }
// 
//   // equality within congruence classes
//   for (List<Object> c : ec) {
//     for (int i = 0; i < c.size(); i++) {
//       Object e1 = c.get(i);
//       for (int j = i + 1; j < c.size(); j++) {
//         Object e2 = c.get(j);
//         assertTrue(format("%s=%s", e1, e2), e1.equals(e2));
//         assertTrue(format("%s=%s", e2, e1), e2.equals(e1));
//         compareShouldReturn0(e1, e2);
//         compareShouldReturn0(e2, e1);
//         assertEquals(format("hashCode %s vs. %s", e1, e2), e1.hashCode(), e2.hashCode());
//       }
//     }
//   }
// 
//   // inequality across congruence classes
//   for (int i = 0; i < ec.size(); i++) {
//     List<Object> c1 = ec.get(i);
//     for (int j = i + 1; j < ec.size(); j++) {
//       List<Object> c2 = ec.get(j);
//       for (Object e1 : c1) {
//         for (Object e2 : c2) {
//           assertFalse(format("%s!=%s", e1, e2), e1.equals(e2));
//           assertFalse(format("%s!=%s", e2, e1), e2.equals(e1));
//           compareShouldNotReturn0(e1, e2);
//           compareShouldNotReturn0(e2, e1);
//         }
//       }
//     }
//   }
// }


// Path: kawala-common-tests/src/test/java/com/kaching/platform/common/values/SsnTest.java
import org.junit.Test;
import static com.google.common.collect.Lists.newArrayList;
import static com.kaching.platform.testing.EquivalenceTester.check;
import static org.junit.Assert.assertEquals;

/**
 * Copyright 2010 Wealthfront Inc. Licensed under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
 * or agreed to in writing, software distributed under the License is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
package com.kaching.platform.common.values;



public class SsnTest {

  @Test
  public void parts() throws Exception {
    Ssn ssn = new Ssn("123456789");
    assertEquals("123", ssn.getAreaNumber());
    assertEquals("45", ssn.getGroupNumber());
    assertEquals("6789", ssn.getSerialNumber());
  }

  @Test(expected = IllegalArgumentException.class)
  public void tooLong() throws Exception {
    new Ssn("1234567890");
  }

  @Test(expected = IllegalArgumentException.class)
  public void tooShort() throws Exception {
    new Ssn("12345678");
  }

  @Test(expected = IllegalArgumentException.class)
  public void notNumeric() throws Exception {