Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

271 lines (254 sloc) 9.804 kb
<?xml version="1.0" encoding="UTF-8"?>
<junithelper-extension>
<!--
=============================
* Instantiation *
=============================
[NOTE] Mock objects or extension's Arg Patterns are given preference.
[NOTE] {instance} will be replaced to arg variable
****** <XML> ******
<instantiation class="com.example.Worker">
<import>com.example.WorkerFactory</import>
<assign>WorkerFactory.getNewWorker()</assign>
</instantiation>
<instantiation class="java.util.Calendar">
<pre-assign></pre-assign>
<assign>Calendar.getInstance()</assign>
<post-assign>{instance}.add(Calendar.DATE, -1);</post-assign>
</instantiation>
****** <Target> ******
public void putCalendar(Calendar cal) {}
****** <Test> ******
@Test
public void putCalendar_A$() throws Exception {
// TODO auto-generated by JUnit Helper.
Worker target = WorkerFactory.getNewWorker();
Calendar cal = Calendar.getIntance();
cal.add(Calendar.DATE, -1);
target.putCalendar(cal);
}
-->
<instantiation class="java.util.Calendar">
<assign>Calendar.getInstance()</assign>
<post-assign>{instance}.add(Calendar.DATE, -1)</post-assign>
</instantiation>
<instantiation class="java.io.InputStream">
<import>java.io.ByteArrayInputStream</import>
<assign>new ByteArrayInputStream(new byte[] {})</assign>
</instantiation>
<!--
=============================
* Arg Patterns *
=============================
[NOTE] {arg} will be replaced to arg variable
****** <XML> ******
<arg class="int" >
<pattern name="minus1"><assign>-1</assign></pattern>
<pattern name="random">
<import>java.util.Random</import>
<pre-assign>System.out.println("Before");</pre-assign>
<assign>new Random().nextInt(10)</assign>
<post-assign>System.out.println("After");</post-assign>
</pattern>
</arg>
****** <Target> ******
public void increment(int i) {}
****** <Test> ******
@Test
public void increment_A$int_intIsMinus1() throws Exception {
// TODO auto-generated by JUnit Helper.
Sample target = new Sample();
int i = -1;
target.increment(i);
}
@Test
public void increment_A$int_intIsRandom() throws Exception {
// TODO auto-generated by JUnit Helper.
Sample target = new Sample();
System.out.println("Before");
int i = new Random().nextInt(10);
System.out.println("After");
target.increment(i);
}
-->
<!-- Primitive types -->
<arg class="int" >
<pattern name="minus1"><assign>-1</assign></pattern>
<pattern name="0"><assign>0</assign></pattern>
<pattern name="1"><assign>1</assign></pattern>
<pattern name="2"><assign>2</assign></pattern>
<pattern name="random">
<import>java.util.Random</import>
<assign>new Random().nextInt(10)</assign>
</pattern>
</arg>
<arg class="long" >
<pattern name="minus1L"><assign>-1L</assign></pattern>
<pattern name="0L"><assign>0L</assign></pattern>
<pattern name="1L"><assign>1L</assign></pattern>
<pattern name="2L"><assign>2L</assign></pattern>
</arg>
<arg class="double" >
<pattern name="minus1_0D"><assign>-1.0D</assign></pattern>
<pattern name="0_0D"><assign>0.0D</assign></pattern>
<pattern name="0_5D"><assign>0.5D</assign></pattern>
<pattern name="1_0D"><assign>1.0D</assign></pattern>
</arg>
<arg class="boolean" >
<pattern name="true"><assign>true</assign></pattern>
<pattern name="false"><assign>false</assign></pattern>
</arg>
<!-- Primitive wrapper types -->
<arg class="java.lang.Integer" >
<pattern name="null"><assign>null</assign></pattern>
<pattern name="minus1"><assign>-1</assign></pattern>
<pattern name="0"><assign>0</assign></pattern>
<pattern name="1"><assign>1</assign></pattern>
<pattern name="2"><assign>2</assign></pattern>
</arg>
<arg class="java.lang.Long" >
<pattern name="null"><assign>null</assign></pattern>
<pattern name="minus1L"><assign>-1L</assign></pattern>
<pattern name="0L"><assign>0L</assign></pattern>
<pattern name="1L"><assign>1L</assign></pattern>
<pattern name="2L"><assign>2L</assign></pattern>
</arg>
<arg class="java.lang.Double" >
<pattern name="null"><assign>null</assign></pattern>
<pattern name="minus1_0D"><assign>-1.0D</assign></pattern>
<pattern name="0_0D"><assign>0.0D</assign></pattern>
<pattern name="0_5D"><assign>0.5D</assign></pattern>
<pattern name="1_0D"><assign>1.0D</assign></pattern>
</arg>
<arg class="java.lang.Boolean" >
<pattern name="null"><assign>null</assign></pattern>
<pattern name="true"><assign>true</assign></pattern>
<pattern name="false"><assign>false</assign></pattern>
</arg>
<arg class="java.lang.String" >
<pattern name="null"><assign>null</assign></pattern>
<pattern name="empty"><assign>""</assign></pattern>
</arg>
<!-- Date time -->
<arg class="java.util.Date">
<pattern name="null"><assign>null</assign></pattern>
<pattern name="now"><assign>new Date()</assign></pattern>
</arg>
<arg class="java.util.Calendar" >
<pattern name="null"><assign>null</assign></pattern>
<pattern name="now"><assign>Calendar.getInstance();</assign></pattern>
<pattern name="Date02_29">
<assign>Calendar.getInstance();</assign>
<post-assign>
{arg}.set(Calendar.YEAR, 2000);
{arg}.set(Calendar.MONTH, 2 - 1);
{arg}.set(Calendar.DATE, 29);
{arg}.set(Calendar.HOUR_OF_DAY, 0);
{arg}.set(Calendar.MINUTE, 0);
{arg}.set(Calendar.SECOND, 0);
{arg}.set(Calendar.MILLISECOND, 0);
</post-assign>
</pattern>
<pattern name="Date12_31">
<assign>Calendar.getInstance();</assign>
<post-assign>
{arg}.set(Calendar.YEAR, 1999);
{arg}.set(Calendar.MONTH, 12 - 1);
{arg}.set(Calendar.DATE, 31);
{arg}.set(Calendar.HOUR_OF_DAY, 0);
{arg}.set(Calendar.MINUTE, 0);
{arg}.set(Calendar.SECOND, 0);
{arg}.set(Calendar.MILLISECOND, 0);
</post-assign>
</pattern>
<pattern name="Date01_01">
<assign>Calendar.getInstance();</assign>
<post-assign>
{arg}.set(Calendar.YEAR, 2000);
{arg}.set(Calendar.MONTH, 1 - 1);
{arg}.set(Calendar.DATE, 1);
{arg}.set(Calendar.HOUR_OF_DAY, 0);
{arg}.set(Calendar.MINUTE, 0);
{arg}.set(Calendar.SECOND, 0);
{arg}.set(Calendar.MILLISECOND, 0);
</post-assign>
</pattern>
<pattern name="Time23_59_59">
<assign>Calendar.getInstance();</assign>
<post-assign>{arg}.set(Calendar.YEAR, 1995);
{arg}.set(Calendar.MONTH, 5 - 1);
{arg}.set(Calendar.DATE, 24);
{arg}.set(Calendar.HOUR_OF_DAY, 23);
{arg}.set(Calendar.MINUTE, 59);
{arg}.set(Calendar.SECOND, 59);
{arg}.set(Calendar.MILLISECOND, 0);
</post-assign>
</pattern>
<pattern name="Time00_00_00">
<assign>Calendar.getInstance();</assign>
<post-assign>
{arg}.set(Calendar.YEAR, 1995);
{arg}.set(Calendar.MONTH, 5 - 1);
{arg}.set(Calendar.DATE, 25);
{arg}.set(Calendar.HOUR_OF_DAY, 0);
{arg}.set(Calendar.MINUTE, 0);
{arg}.set(Calendar.SECOND, 0);
{arg}.set(Calendar.MILLISECOND, 0);
</post-assign>
</pattern>
</arg>
<arg class="org.joda.time.DateTime">
<import>org.joda.time.format.DateTimeFormat</import>
<pattern name="null"><assign>null</assign></pattern>
<pattern name="JavaBirthday">
<assign>
DateTimeFormat.forPattern("yyyyMMddHHmmss").parseDateTime("19950525000000")
</assign>
</pattern>
</arg>
<!--
=============================
* Assertions *
=============================
****** <XML> ******
<return class="int">
<import>static org.hamcrest.Matchers.*</import>
<import>static org.junit.Assert.*</import>
<assert>assertThat(actual, is(greaterThanOrEqualTo(0)));</assert>
<assert>assertThat(actual, is(lessThanOrEqualTo(Integer.MAX_VALUE)));</assert>
</return>
****** <Target> ******
public int increment() {
this.i += 1;
return this.i;
}
****** <Test> ******
@Test
public void increment_A$() throws Exception {
// TODO auto-generated by JUnit Helper.
Sample target = new Sample();
int actual = target.increment();
assertThat(actual, is(greaterThanOrEqualTo(0)));
assertThat(actual, is(lessThanOrEqualTo(Integer.MAX_VALUE)));
}
-->
<!-- JUnit 3.x -->
<!--
<return class="int">
<assert>assertTrue(actual >= 0);</assert>
</return>
-->
<!-- JUnit 4.x -->
<return class="int">
<import>static org.hamcrest.Matchers.*</import>
<import>static org.junit.Assert.*</import>
<assert>assertThat(actual, is(greaterThanOrEqualTo(0)));</assert>
<assert>assertThat(actual, is(lessThanOrEqualTo(Integer.MAX_VALUE)));</assert>
</return>
<return class="java.lang.Integer">
<import>static org.hamcrest.Matchers.*</import>
<import>static org.junit.Assert.*</import>
<assert>assertThat(actual, is(greaterThanOrEqualTo(0)));</assert>
<assert>assertThat(actual, is(lessThanOrEqualTo(Integer.MAX_VALUE)));</assert>
</return>
</junithelper-extension>
Jump to Line
Something went wrong with that request. Please try again.