Skip to content

Instantly share code, notes, and snippets.

@karlkovaciny
karlkovaciny / mockito-templates.xml
Created January 4, 2020 00:58 — forked from fappel/mockito-templates.xml
Mockito Templates for Eclipse
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="false" context="java-statements" deleted="false" description="Mockito doAnswer(answer).when(mock).call() construct" enabled="true" name="doAnswer">${a:importStatic(org.mockito.Mockito.doAnswer)}${b:import(org.mockito.stubbing.Answer, org.mockito.invocation.InvocationOnMock, java.lang.Throwable)}doAnswer( new Answer&lt;${T}&gt;() {&#13;
public ${T} answer( InvocationOnMock invocation ) throws Throwable {&#13;
${cursor}&#13;
return null;&#13;
}&#13;
} ).when( ${mock} ).${call};</template><template autoinsert="false" context="java-statements" deleted="false" description="Mockito doAnswer(answer).when(mock).call() construct that manipulates invocation argument" enabled="true" name="doAnswerOnArgument">${a:importStatic(org.mockito.Mockito.doAnswer)}${b:import(org.mockito.stubbing.Answer, org.mockito.invocation.InvocationOnMock, java.lang.Throwable)}doAnswer( new Answer&lt;${T}&gt;() {&#13;
public ${T} answer( InvocationOn
public void setSelectedWorkOrder(int woNumber) {
if (!mWoNumbersList.contains(woNumber)) {
throw new NoSuchElementException("Work order number not in the list of work orders, need to add it");
}
if (hasSelectedWorkOrder()) {
if (mSelectedWorkOrder.getWoNumber() == woNumber) {
return;
} else {
saveState();
// TODO(dimvar): Either INEXISTENT_PROPERTY shouldn't be here, or we should
// change DiagnosticGroups.setWarningLevel to not accidentally enable it.
static final DiagnosticGroup ALL_DIAGNOSTICS = new DiagnosticGroup(
DETERMINISTIC_TEST,
INEXISTENT_ENUM_ELEMENT,
INEXISTENT_PROPERTY,
POSSIBLE_INEXISTENT_PROPERTY,
INEXISTENT_PROPERTY_WITH_SUGGESTION,
if (isset($_POST['inreplyto'])) { //admin is setting date
$newinreplyto = $_POST['inreplyto'];
} else if (isset($_GET['irtid'])){ //for edits by regular users
$newinreplyto = $_GET['irtid'];
} else {$newinreplyto = 0;}