The main purpose of this example is to show you :
Another particularity of this example is that we do not need to write a custom fixture : the Calculator class will be use directly.
| Import |
| com.greenpepper.confluence.demo.calculator |
| GreenPepper.Confluence.Demo.Calculator |
| Rule for |
calculator |
| x |
y |
sum? |
product? |
quotient? |
| 0 |
0 |
0 |
0 |
error |
| 1 |
0 |
1 |
0 |
error |
| 0 |
1 |
1 |
0 |
0 |
| 1 |
1 |
2 |
1 |
1 |
| 10 |
2 |
12 |
20 |
5 |
Source Code
Calculator.java
package com.greenpepper.confluence.demo.calculator;
public class Calculator
{
private int x;
private int y;
public int getY()
{
return y;
}
public void setY(int y)
{
this.y = y;
}
public int getX()
{
return x;
}
public void setX(int x)
{
this.x = x;
}
public int sum()
{
return x + y;
}
public int difference()
{
return x - y;
}
public int product()
{
return x * y;
}
public int quotient()
{
return x / y;
}
}
Testing
Unknown macro: {table-plus}
| rule for |
Calculator |
| x |
y |
Sum? |
| 50 |
100 |
150 |
| 20 |
30 |
|