jaroslav@514: /** jaroslav@514: * Back 2 Browser Bytecode Translator jaroslav@514: * Copyright (C) 2012 Jaroslav Tulach jaroslav@514: * jaroslav@514: * This program is free software: you can redistribute it and/or modify jaroslav@514: * it under the terms of the GNU General Public License as published by jaroslav@514: * the Free Software Foundation, version 2 of the License. jaroslav@514: * jaroslav@514: * This program is distributed in the hope that it will be useful, jaroslav@514: * but WITHOUT ANY WARRANTY; without even the implied warranty of jaroslav@514: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jaroslav@514: * GNU General Public License for more details. jaroslav@514: * jaroslav@514: * You should have received a copy of the GNU General Public License jaroslav@514: * along with this program. Look for COPYING file in the top folder. jaroslav@514: * If not, see http://opensource.org/licenses/GPL-2.0. jaroslav@514: */ jaroslav@514: package org.apidesign.bck2brwsr.demo.calc; jaroslav@514: jaroslav@514: import static org.testng.Assert.*; jaroslav@514: import org.testng.annotations.BeforeMethod; jaroslav@514: import org.testng.annotations.Test; jaroslav@514: jaroslav@514: /** Demonstrating POJO testing of HTML page model. jaroslav@514: * jaroslav@514: * @author Jaroslav Tulach jaroslav@514: */ jaroslav@514: public class CalcTest { jaroslav@514: private Calculator model; jaroslav@514: jaroslav@514: jaroslav@514: @BeforeMethod jaroslav@514: public void initModel() { jaroslav@514: model = new Calculator().applyBindings(); jaroslav@514: } jaroslav@514: jaroslav@514: @Test jaroslav@514: public void testSomeMethod() { jaroslav@514: model.setDisplay(10); jaroslav@514: Calc.applyOp(model, "plus"); jaroslav@514: assertEquals(0.0, model.getDisplay(), "Cleared after pressing +"); jaroslav@514: model.setDisplay(5); jaroslav@514: Calc.computeTheValue(model); jaroslav@514: assertEquals(15.0, model.getDisplay(), "Shows fifteen"); jaroslav@514: } jaroslav@514: }