/** Test of checkFullKey(String, MessageRef), of class Property. */ @Test public void testCheckFullKey_String_MessageRef() { try { UtilProperty.checkFullKey("a", PropertyRef.PROPERTY); UtilProperty.checkFullKey("a.b", PropertyRef.PROPERTY); UtilProperty.checkFullKey("a.b.c", PropertyRef.PROPERTY); } catch (UserException ex) { ex.printStackTrace(); fail("Check should not have failed with valid keys: " + ex.getMessage()); } try { UtilProperty.checkFullKey("", PropertyRef.PROPERTY); fail("Check should have failed with invalid key"); } catch (UserException ex) { System.out.println(ex.getMessage()); } try { UtilProperty.checkFullKey(".b.c", PropertyRef.PROPERTY); fail("Check should have failed with invalid key"); } catch (UserException ex) { System.out.println(ex.getMessage()); } try { UtilProperty.checkFullKey("a..c", PropertyRef.PROPERTY); fail("Check should have failed with invalid key"); } catch (UserException ex) { System.out.println(ex.getMessage()); } try { UtilProperty.checkFullKey("a.b.", PropertyRef.PROPERTY); fail("Check should have failed with invalid key"); } catch (UserException ex) { System.out.println(ex.getMessage()); } }
/** * Test of BidAbstract(Account, AUCTION, int) method, of class BidAbstract. * * @throws Bid4WinException Issue not expected during this test */ @Test public void testBidAbstract_Account_AUCTION_int() throws Bid4WinException { Account account = this.getGenerator().createAccount(); AuctionAbstractStub auction = this.getGenerator().createAuctionAbstract(); try { BidAbstractStub bid = new BidAbstractStub(account, auction, 1); assertTrue("Bad account", account == bid.getAccount()); assertTrue("Bad auction", auction == bid.getAuction()); assertEquals("Bad position", 1, bid.getPosition()); } catch (UserException ex) { ex.printStackTrace(); fail("Instanciation should not fail: " + ex.getMessage()); } try { new BidAbstractStub(null, auction, 1); fail("Should should fail with null account"); } catch (UserException ex) { System.out.println(ex.getMessage()); } try { new BidAbstractStub(account, null, 1); fail("Should should fail with null auction"); } catch (UserException ex) { System.out.println(ex.getMessage()); } try { new BidAbstractStub(account, auction, 0); fail("Should should fail with zero or negative position"); } catch (UserException ex) { System.out.println(ex.getMessage()); } }