This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Animal { | |
boolean amIBird; | |
public Animal(boolean amIBird) { | |
this.amIBird = amIBird; | |
} | |
public void move(int distance) { | |
boolean isBird = amIBird(); | |
if (isBird) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(Parameterized.class) | |
public class AdderTest extends TestCase { | |
@Parameterized.Parameters(name = "{index}: add[{0}, {1}]={2}") | |
public static Iterable<Object[]> data() { | |
return Arrays.asList(new Object[][]{ | |
{0, 0, 0}, | |
{1, 1, 2}, | |
{2, 1, 3}, | |
{100, 400, 500}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import junit.framework.TestCase; | |
import org.junit.Test; | |
import org.mockito.ArgumentCaptor; | |
import static org.mockito.Mockito.mock; | |
import static org.mockito.Mockito.verify; | |
public class DogTest extends TestCase { | |
@Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Class__c classToCreate = new Class__c(Name='Science', Grade__c=8); | |
List<Class__c> duplicates = findDuplicateRecords(classToCreate); | |
if(duplicates.size() == 0){ | |
//no duplicates | |
insert classToCreate; | |
} else{ | |
//desired update | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Class__c classToCreate = new Class__c(Name='Science', Grade__c=8); | |
Database.SaveResult saveResult = Database.insert(classToCreate, false); | |
if (!saveResult.isSuccess()) { | |
for (Database.Error error : saveResult.getErrors()) { | |
if (error instanceof Database.DuplicateError) { | |
Database.DuplicateError duplicateError = (Database.DuplicateError)error; | |
Datacloud.DuplicateResult duplicateResult = duplicateError.getDuplicateResult(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Enrolments { | |
@InvocableMethod(label='Get Enrolments' description='Iterate over students, classes and payments and create junction records') | |
public static List<EnrolmentsResult> createEnrolments(List<EnrolmentsRequest> request){ | |
//parse inputs and variables | |
List<Account> students = request.get(0).students; | |
List<Class__c> classes = request.get(0).classes; | |
List<Payment__c> payments = request.get(0).payments; | |
List<Enrolment__c> enrolments = new List<Enrolment__c>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BadRequestException extends Exception { | |
private String errorCode = 'BAD_REQUEST'; | |
private Integer statusCode = 400; | |
public String getErrorCode() { | |
return this.errorCode; | |
} | |
public Integer getStatusCode() { | |
return this.statusCode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: "2.0" | |
info: | |
description: | | |
API documentation for Sample API. | |
version: "0.0.1" | |
title: "Sample API" | |
host: "payment.swagger.io" | |
basePath: "/v1" | |
consumes: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: "2.0" | |
info: | |
description: "This is a sample weather forecast server." | |
version: "1.0.0" | |
title: "Weather Forecast" | |
host: "localhost:3000" | |
schemes: | |
- "https" | |
- "http" | |
tags: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"function"!==typeof Object.create&&(Object.create=function(f){function g(){}g.prototype=f;return new g}); | |
(function(f,g,k){var l={init:function(a,b){this.$elem=f(b);this.options=f.extend({},f.fn.owlCarousel.options,this.$elem.data(),a);this.userOptions=a;this.loadContent()},loadContent:function(){function a(a){var d,e="";if("function"===typeof b.options.jsonSuccess)b.options.jsonSuccess.apply(this,[a]);else{for(d in a.owl)a.owl.hasOwnProperty(d)&&(e+=a.owl[d].item);b.$elem.html(e)}b.logIn()}var b=this,e;"function"===typeof b.options.beforeInit&&b.options.beforeInit.apply(this,[b.$elem]);"string"===typeof b.options.jsonPath? | |
(e=b.options.jsonPath,f.getJSON(e,a)):b.logIn()},logIn:function(){this.$elem.data("owl-originalStyles",this.$elem.attr("style"));this.$elem.data("owl-originalClasses",this.$elem.attr("class"));this.$elem.css({opacity:0});this.orignalItems=this.options.items;this.checkBrowser();this.wrapperWidth=0;this.checkVisible=null;this.setVars()},setVars:function(){if(0===this.$elem.children().length) |
NewerOlder