package com.five35.dex;

import org.junit.Assert;
import org.junit.Test;

@SuppressWarnings({ "javadoc", "static-method" })
public class ResultTest {
	private static class DummyResult extends Result<String> {
		protected DummyResult() {
			super("");
		}
	}

	@Test
	public void cast_returnsOriginalOnClassMatch() throws Exception {
		final Result<?> result = new ScalarResult(5);

		Assert.assertSame(result, result.cast(ScalarResult.class));
	}

	@Test(expected = ResultCastException.class)
	public void cast_throwsOnClassMismatch() throws Exception {
		new ResultTest.DummyResult().cast(ScalarResult.class);
	}
}

@@ -18,16 +18,38 @@
 5.dex;%0A%0A
+import mockit.Tested;%0A
 import o
@@ -218,14 +218,16 @@
 ult%3C
-String
+Class%3C?%3E
 %3E %7B%0A
@@ -254,16 +254,92 @@
 ult() %7B%0A
+%09%09%09this(Result.class);%0A%09%09%7D%0A%0A%09%09protected DummyResult(final Class%3C?%3E value) %7B%0A
 %09%09%09super
@@ -343,10 +343,13 @@
 per(
-%22%22
+value
 );%0A%09
@@ -351,24 +351,74 @@
 e);%0A%09%09%7D%0A%09%7D%0A%0A
+%09@Tested%0A%09private ResultTest.DummyResult result;%0A%0A
 %09@Test%0A%09publ
@@ -483,57 +483,8 @@
 n %7B%0A
-%09%09final Result%3C?%3E result = new ScalarResult(5);%0A%0A
 %09%09As
@@ -503,16 +503,21 @@
 ame(
+this.
 result, 
 resu
@@ -512,16 +512,21 @@
 result, 
+this.
 result.c
@@ -525,30 +525,40 @@
 result.cast(
-Scalar
+ResultTest.Dummy
 Result.class
@@ -730,11 +730,856 @@
 ass);%0A%09%7D
+%0A%0A%09@Test%0A%09public void equals_returnsFalseForNonResults() %7B%0A%09%09Assert.assertFalse(this.result.equals(new Integer(0)));%0A%09%7D%0A%0A%09@Test%0A%09public void equals_returnsFalseForNull() %7B%0A%09%09Assert.assertFalse(this.result.equals(null));%0A%09%7D%0A%0A%09@Test%0A%09public void equals_returnsFalseOnDifferentValue() %7B%0A%09%09Assert.assertFalse(this.result.equals(new ResultTest.DummyResult(ResultTest.class)));%0A%09%7D%0A%0A%09@Test%0A%09public void equals_returnsTrueOnSameValue() %7B%0A%09%09Assert.assertTrue(this.result.equals(new ResultTest.DummyResult(Result.class)));%0A%09%7D%0A%0A%09@Test%0A%09public void hashCode_isStableForSameValue() %7B%0A%09%09Assert.assertEquals(this.result.hashCode(), new ResultTest.DummyResult(Result.class).hashCode());%0A%09%7D%0A%0A%09@Test%0A%09public void hashCode_isUnstableForDifferentValue() %7B%0A%09%09Assert.assertNotEquals(this.result.hashCode(), new ResultTest.DummyResult(ResultTest.class).hashCode());%0A%09%7D
 %0A%7D%0A

improve and expand Result tests