Skip to content

Instantly share code, notes, and snippets.

View mauricioaniche's full-sized avatar

Maurício Aniche mauricioaniche

View GitHub Profile
package nl.tudelft.mocks2;
import java.util.ArrayList;
import java.util.List;
public class InvoiceFilter {
private InvoiceDao invoiceDao;
private Webservice webservice;
package nl.tudelft.mocks;
import java.util.ArrayList;
import java.util.List;
import java.util.Queue;
public class InvoiceFilter {
private InvoiceDao invoiceDao;
package nl.tudelft.mocks;
public class Invoice {
private String customer;
private double value;
public Invoice(String customer, double value) {
this.customer = customer;
this.value = value;
class X{
public void x() {
assertEquals("Frodo", frodo.getName());
assertNotEquals(frodo, sauron);
assertThat(frodo.getName()).isEqualTo("Frodo");
assertThat(frodo).isNotEqualTo(sauron);
Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/platform/engine/EngineExecutionListener
at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:53)
at com.intellij.junit5.JUnit5IdeaTestRunner.createListeners(JUnit5IdeaTestRunner.java:39)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:49)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.ClassNotFoundException: org.junit.platform.engine.EngineExecutionListener
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
public class Palindrome {
public int count(String word) {
return count(word.replace(" ", "").toUpperCase(), 0);
}
private int count(String word, int acc) {
if(word.isEmpty()) return acc;
if(word.length() == 1) return acc+1;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class TesteMap {
public static void main(String[] args) {
List<Integer> nums = new ArrayList<Integer>();
for(int i = 0; i < 50; i++)
703: $query = "SELECT b.id FROM ".$bean->getTableName()." b LEFT JOIN aod_indexevent ie ON (ie.record_id = b.id AND ie.record_module = '".$beanModule."') WHERE b.deleted = 0 AND (ie.id IS NULL OR ie.date_modified < b.date_modified) ORDER BY b.date_modified ASC";
148: $query = "SELECT filename name FROM document_revisions INNER JOIN documents ON documents.id = document_revisions.document_id ";
210: $q2="select * from email_addr_bean_rel eabr WHERE eabr.bean_id = '".$this->db->quote($id)."' AND eabr.bean_module = '".$this->db->quote($module)."' and eabr.deleted=0";
public class CustomerServiceTest{
@Test
public void shouldGenerateInvoices() {
// mocking CustomerDAO
CustomerDAO customerDao = Mockito.mock(CustomerDAO.class);
Mockito.when(
customerDao.findCustomerById(1))
.thenReturn(new Customer(1, "Customer1"));
// instantiating the CUT, and passing
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mx.edu.um.mateo.colportor.dao.hibernate;
import java.util.HashMap;
import java.util.Map;