Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RainerW/1043040 to your computer and use it in GitHub Desktop.
Save RainerW/1043040 to your computer and use it in GitHub Desktop.
System Test Patterns
package com.seitenbau.demo.systemtest;
import static com.seitenbau.assertions.Assertions.assertThat;
import javax.inject.Inject;
import org.junit.Test;
interface WorkDelegate<T> {
void doWork(T target);
}
public class CashPointSystemTest extends SystemTest {
@Inject CashPointForm cashPointForm;
@Inject PositionTable positionTable;
WorkDelegate<CashPointForm> papier1=new WorkDelegate<CashPointForm>{
void doWork(CashPointForm target) {
target.enterBasarNumber("100");
target.enterPrice("22,50");
}
}
@Test public void addTwoArticlesIntoTheCart() throws Exception {
cashPointForm.open();
cashPointForm.fillFields( papier );
cashPointForm.clickAdd();
cashPointForm.enterBasarNumber("101");
cashPointForm.enterPrice("23,50");
cashPointForm.clickAdd();
assertThat(cashPointForm.getSumme()).isEqualTo("46,00");
assertThat(positionTable.getRow(1).getBasarNumber()).isEqualTo("100");
assertThat(positionTable.getRow(1).getSeller()).isEqualTo("Test Kunde");
assertThat(positionTable.getRow(1).getPrice()).isEqualTo("+22,50 Euro");
assertThat(positionTable.getRow(2).getBasarNumber()).isEqualTo("101");
assertThat(positionTable.getRow(2).getSeller()).isEqualTo("");
assertThat(positionTable.getRow(2).getPrice()).isEqualTo("+23,50 Euro");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment