BAEL-922 Type Erasure Explained (#2100)
* Define beans for handling different message types in a lean chat app * Add class based spring beans configuration * Define spring configuration in XML for constructor based bean injection * Refactor package structure to separate constructor based bean injection code set from setter based bean injection code set * Define configuration and classes specific to setter-based bean injection. * Implement tests for constructor-based and setter-based bean injections * develop codes for explaining type erasure * Write unit tests for type erasure examples * Remove evaluation article code * Modify type erasure examples and unit tests * Modify type erasure examples and unit tests * Add expected exception in TypeErasureUnitTest * Correct grammar in class name
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package com.baeldung.typeerasure;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class TypeErasureUnitTest {
|
||||
|
||||
@Test(expected = ClassCastException.class)
|
||||
public void givenIntegerStack_whenStringPushedAndAssignPoppedValueToInteger_shouldFail() {
|
||||
IntegerStack integerStack = new IntegerStack(5);
|
||||
Stack stack = integerStack;
|
||||
stack.push("Hello");
|
||||
Integer data = integerStack.pop();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAnyArray_whenInvokedPrintArray_shouldSucceed() {
|
||||
Integer[] scores = new Integer[] { 100, 200, 10, 99, 20 };
|
||||
ArrayContentPrintUtil.printArray(scores);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user