package twitter4j; import static org.junit.Assert.*; import org.junit.Test; public class TestExceptionDiagnosis { @Test public void testConstructor() { Throwable th = new Throwable(); ExceptionDiagnosis diag = new ExceptionDiagnosis(th); assertNotNull(diag); assertEquals(diag.th, th); } @Test public void testConstructor2() { try { int i = 23/0; new Integer(i); } catch (Exception e) { ExceptionDiagnosis diag = new ExceptionDiagnosis(e); assertNotNull(diag); assertEquals(diag.th, e); assertEquals(diag.lineNumberHash, 0); assertEquals(diag.stackLineHash, 0); } } @Test public void testEquals() { Throwable th = new Throwable(); ExceptionDiagnosis diag = new ExceptionDiagnosis(th); assertTrue(diag.equals(diag)); } @Test public void testEquals2() { Throwable th = new Throwable(); ExceptionDiagnosis diag = new ExceptionDiagnosis(th); assertFalse(diag.equals("WhatEver")); } @Test public void testEquals6() { Throwable th = new Throwable(); ExceptionDiagnosis diag = new ExceptionDiagnosis(th); assertFalse(diag.equals(null)); } @Test public void testEquals3() { Throwable th = new Throwable(); ExceptionDiagnosis diag = new ExceptionDiagnosis(th); ExceptionDiagnosis diag2 = new ExceptionDiagnosis(th); assertTrue(diag.equals(diag2)); } @Test public void testEquals4() { Throwable th = new NullPointerException(); ExceptionDiagnosis diag = new ExceptionDiagnosis(th); Throwable th2 = new ClassCastException(); ExceptionDiagnosis diag2 = new ExceptionDiagnosis(th2); assertTrue(diag.equals(diag2)); } @Test public void testEquals5() { Throwable th = new Throwable("blah"); ExceptionDiagnosis diag = new ExceptionDiagnosis(th); Throwable th2 = new Throwable("org"); ExceptionDiagnosis diag2 = new ExceptionDiagnosis(th2); assertTrue(diag.equals(diag2)); } }