Character c = new Wizard(); .... Character c = new Elf();
@Test(dataProvider = ARQUILLIAN_DATA_PROVIDER) @SpecAssertions({ @SpecAssertion(section = NEW_EE, id = "yj") }) public void testNewBeanCreatedForObserverMethod(Wizard wizard) { Bean<Hat> bean = getUniqueBean(Hat.class, New.Literal.INSTANCE); checkNewQualifiedBean(bean, Object.class, Hat.class); getCurrentManager().fireEvent(new Wizard()); assertTrue(wizard.getHat().ping()); }
@Test(dataProvider = ARQUILLIAN_DATA_PROVIDER) @SpecAssertions({ @SpecAssertion(section = NEW_EE, id = "yf") }) public void testNewBeanCreatedForConstructorInjectionPoint(Wizard wizard) { Bean<Spell> bean = getUniqueBean(Spell.class, New.Literal.INSTANCE); checkNewQualifiedBean(bean, Object.class, Spell.class); assertTrue(wizard.getSpell().ping()); }
@Test(dataProvider = ARQUILLIAN_DATA_PROVIDER) @SpecAssertions({ @SpecAssertion(section = NEW_EE, id = "yd") }) public void testNewBeanCreatedForInitializerInjectionPoint(Wizard wizard) { Bean<Staff> bean = getUniqueBean(Staff.class, New.Literal.INSTANCE); checkNewQualifiedBean(bean, Object.class, Staff.class); assertTrue(wizard.getStaff().ping()); }
@Test(dataProvider = ARQUILLIAN_DATA_PROVIDER) @SpecAssertions({ @SpecAssertion(section = NEW_EE, id = "yb") }) public void testNewBeanCreatedForFieldInjectionPoint(Wizard wizard) { Bean<Tiger> bean = getUniqueBean(Tiger.class, New.Literal.INSTANCE); checkNewQualifiedBean(bean, Object.class, Tiger.class); assertTrue(wizard.getTiger().ping()); }
@Test(dataProvider = ARQUILLIAN_DATA_PROVIDER) @SpecAssertions({ @SpecAssertion(section = NEW_EE, id = "yh") }) public void testNewBeanCreatedForProducerMethod(Wizard wizard) { Bean<Dragon> bean = getUniqueBean(Dragon.class, New.Literal.INSTANCE); checkNewQualifiedBean(bean, Object.class, Dragon.class); assertTrue(wizard.getDragon().ping()); }
Wizard w = new SerialiserTest().new Wizard(); outputStream = new ByteArrayOutputStream(); objectOutputStream = new ObjectOutputStream(outputStream); objectOutputStream.writeObject(w); byteArrayInputStream = new ByteArrayInputStream(outputStream.toByteArray()); inputStream = new ObjectInputStream(byteArrayInputStream); Wizard wiz = (Wizard) inputStream.readObject(); Exception in thread "main" java.io.InvalidClassException: jtk.file.ser.SerialiserTest$Wizard; no valid constructor at java.io.ObjectStreamClass$ExceptionInfo.newInvalidClassException(ObjectStreamClass.java:150)
Champion wizard = new Wizard(); Champion warrior = new Warrior(); AttackTypes attackType = AttackTypes.Ranged; System.out.println("can wizard attack? : " + wizard.canAttack(attackType)); System.out.println("can warrior attack? : " + warrior.canAttack(attackType));
public void actionPerformed(ActionEvent event) { if (event.getSource() == create) { String type = classOptions[playerClass.getSelectedIndex()]; if (type == "Rogue") { player1 = new Rogue(); } if (type == "Wizard") { player1 = new Wizard(); } if (type == "Warrior") { player1 = new Warrior(); } player1.name = name.getText(); JOptionPane.showMessageDialog(this, "You are a " + type + ". Your name is " + player1.name + "."); init2(); } else if (event.getSource() == proceed) { JOptionPane.showMessageDialog(this, "It Works!"); System.out.println("hi"); { }