Package com.darkhonor.rage.model

Examples of com.darkhonor.rage.model.TestCase


    public void testDeleteIdNoInputs()
    {
        System.out.println("delete (id) - No Inputs");
        Long id = new Long(6L);

        TestCase result = instance.find(id);
        assertNotNull(result);

        assertTrue(instance.isOpen());
        instance.delete(id);
        assertTrue(instance.isOpen());
View Full Code Here


    public void testDeleteIdNoExemptions()
    {
        System.out.println("delete (id) - No Exemptions");
        Long id = new Long(2L);

        TestCase result = instance.find(id);
        assertNotNull(result);

        assertTrue(instance.isOpen());
        instance.delete(id);
        assertTrue(instance.isOpen());
View Full Code Here

    public void testDeleteIdClosedConnection()
    {
        System.out.println("delete (id) - Closed Connection");
        Long id = new Long(5L);

        TestCase result = instance.find(id);
        assertNotNull(result);

        assertTrue(instance.isOpen());
        instance.closeConnection();
        assertFalse(instance.isOpen());
View Full Code Here

    public void testDeleteIdNotFound()
    {
        System.out.println("delete (id) - TestCase not found");
        Long id = new Long(42L);

        TestCase result = instance.find(id);
        assertNull(result);

        assertTrue(instance.isOpen());
        instance.delete(id);
    }
View Full Code Here

     *
     * @return      A predictable TestCase
     */
    private TestCase createSampleTestCase1()
    {
        TestCase testCase = new TestCase(new BigDecimal("1.0"));
        testCase.setId(new Long(5L));
        testCase.addInput("1234");
        testCase.addInput("5678");
        testCase.addOutput("Result = 12345678");
        testCase.addExclusion("2345");
        testCase.addExclusion("9876");
        testCase.addExclusion("Result = 12345678");
        return testCase;
    }
View Full Code Here

     *
     * @return      A predictable TestCase
     */
    private TestCase createSampleTestCase2()
    {
        TestCase testCase = new TestCase(new BigDecimal("2.5"));
        testCase.setId(new Long(2L));
        testCase.addInput("4");
        testCase.addInput("5");
        testCase.addOutput("Result = 999999999");
        return testCase;
    }
View Full Code Here

     *
     * @return      A predictable TestCase
     */
    private TestCase createSampleTestCase3()
    {
        TestCase testCase = new TestCase(new BigDecimal("3.5"));
        testCase.setId(new Long(6L));
        testCase.addOutput("Hello World");
        testCase.addExclusion("Mini Me");
        return testCase;
    }
View Full Code Here

     *
     * @return      A predictable TestCase
     */
    private TestCase createNewTestCaseNoExcludes()
    {
        TestCase testCase = new TestCase(new BigDecimal("10.24"));
        testCase.setId(new Long(42L));
        testCase.addInput("12");
        testCase.addInput("34");
        testCase.addOutput("56");
        return testCase;
    }
View Full Code Here

     *
     * @return      A predictable TestCase
     */
    private TestCase createNewTestCase()
    {
        TestCase testCase = new TestCase(new BigDecimal("10.35"));
        testCase.setId(new Long(43L));
        testCase.addInput("42");
        testCase.addOutput("The Ultimate Answer");
        testCase.addExclusion("Question");
        return testCase;
    }
View Full Code Here

                        // Parse test cases for each question
                        NodeList testCaseNodes = (NodeList) xpath.evaluate("./TestCase", q, XPathConstants.NODESET);
                        for (int j = 0; j < testCaseNodes.getLength(); j++)
                        {
                            TestCase tc = new TestCase();
                            Node t = testCaseNodes.item(j);
                            String value = xpath.evaluate("./Value/@value", t);
                            tc.setValue(new BigDecimal(value));
                            NodeList tcInputs = (NodeList) xpath.evaluate("./input", t, XPathConstants.NODESET);
                            for (int k = 0; k < tcInputs.getLength(); k++)
                            {
                                Node inputNode = tcInputs.item(k);
                                String input = inputNode.getTextContent();
                                //System.out.println("Input: " + input);
                                tc.addInput(input);
                            }
                            NodeList tcOutputs = (NodeList) xpath.evaluate("./output", t, XPathConstants.NODESET);
                            for (int k = 0; k < tcOutputs.getLength(); k++)
                            {
                                Node outputNode = tcOutputs.item(k);
                                String output = outputNode.getTextContent();
                                //System.out.println("Expected Output: " + output);
                                tc.addOutput(output);
                            }
                            NodeList tcExcludes = (NodeList) xpath.evaluate("./exclude", t, XPathConstants.NODESET);
                            for (int k = 0; k < tcExcludes.getLength(); k++)
                            {
                                Node outputNode = tcExcludes.item(k);
                                String exclude = outputNode.getTextContent();
                                //System.out.println("Exclusion: " + exclude);
                                tc.addExclusion(exclude);
                            }
                            tx.begin();
                            em.persist(tc);
                            tx.commit();
                            quest.addTestCase(tc);
View Full Code Here

TOP

Related Classes of com.darkhonor.rage.model.TestCase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.