javaquery/demo-calculator-dynamic/src/test/java/org/apidesign/bck2brwsr/demo/calc/CalcTest.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 07 Feb 2013 12:58:12 +0100
branchemul
changeset 694 0d277415ed02
permissions -rw-r--r--
Rebasing the Inflater support on jzlib which, unlike GNU ClassPath, has correct implementation of Huffman code. Making the implementation more easily testable by turning Inflater and ZipInputStream into pure delegates. Current implementation is going to need proper long support.
jaroslav@514
     1
/**
jaroslav@514
     2
 * Back 2 Browser Bytecode Translator
jaroslav@514
     3
 * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@514
     4
 *
jaroslav@514
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@514
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@514
     7
 * the Free Software Foundation, version 2 of the License.
jaroslav@514
     8
 *
jaroslav@514
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@514
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@514
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@514
    12
 * GNU General Public License for more details.
jaroslav@514
    13
 *
jaroslav@514
    14
 * You should have received a copy of the GNU General Public License
jaroslav@514
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@514
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
jaroslav@514
    17
 */
jaroslav@514
    18
package org.apidesign.bck2brwsr.demo.calc;
jaroslav@514
    19
jaroslav@514
    20
import static org.testng.Assert.*;
jaroslav@514
    21
import org.testng.annotations.BeforeMethod;
jaroslav@514
    22
import org.testng.annotations.Test;
jaroslav@514
    23
jaroslav@514
    24
/** Demonstrating POJO testing of HTML page model.
jaroslav@514
    25
 *
jaroslav@514
    26
 * @author Jaroslav Tulach <jtulach@netbeans.org>
jaroslav@514
    27
 */
jaroslav@514
    28
public class CalcTest {
jaroslav@514
    29
    private Calculator model;
jaroslav@514
    30
    
jaroslav@514
    31
jaroslav@514
    32
    @BeforeMethod
jaroslav@514
    33
    public void initModel() {
jaroslav@514
    34
        model = new Calculator().applyBindings();
jaroslav@514
    35
    }
jaroslav@514
    36
jaroslav@514
    37
    @Test
jaroslav@514
    38
    public void testSomeMethod() {
jaroslav@514
    39
        model.setDisplay(10);
jaroslav@514
    40
        Calc.applyOp(model, "plus");
jaroslav@514
    41
        assertEquals(0.0, model.getDisplay(), "Cleared after pressing +");
jaroslav@514
    42
        model.setDisplay(5);
jaroslav@514
    43
        Calc.computeTheValue(model);
jaroslav@514
    44
        assertEquals(15.0, model.getDisplay(), "Shows fifteen");
jaroslav@514
    45
    }
jaroslav@514
    46
}