Skip to content

Instantly share code, notes, and snippets.

View katherinechu92's full-sized avatar

katherinechu92

View GitHub Profile
@katherinechu92
katherinechu92 / Low Stock Class
Last active May 18, 2026 21:48
Final Project
public with sharing class LowStock {
//This should return a list of all the Stock Items that have a stock-on-hand count at or below their minimum stock level.
//integer of minimumStock is passed in as an argument
public static List<Stock_Item__c> getLowStockItems(Integer minimumStock){
//create a list called lowStockList where stock on hand is <= minimum stock
List<Stock_Item__c> lowStockList = [SELECT id, Item_Name__c, Item_Stock_is_Low__c, Minimum_Stock_Level__c, Stock_on_Hand__c
FROM Stock_Item__c
WHERE Stock_on_Hand__c <= :minimumStock];
@isTest
private class AccountTriggerHandlerTest {
/** Test methods needs to be designed for class AccountTriggerHandler to meet code coverage requirements.
* Design methods in the beforeInsert and after insert test method
*/
@isTest
static void testbeforeInsert() {
// Read and understand the funtionality in the method handleBeforeInsert in AccountTrigger Handler
// Test method should try to create and insert an Account programatically and
//Opportunity Trigger
trigger opportunityTrigger on Opportunity (before insert) {
opportunityTriggerHandler.handleAfterInsert(Trigger.new);
}
//Opportunity Handler
public class opportunityTriggerHandler {
public static void handleAfterInsert(List<Opportunity> newOpps){
//When an Opportunity is inserted, check and see if this account has a rating of 'Hot'. If not, make it 'Hot'
public with sharing class WeekSevenHomework {
//Assignment: The following method is supposed to create the number of accounts specified in the argument that it takes.
//Each Account should be named 'Sample Account #sampleNumber' where sample number is the count. So if you created 2 Accounts
//one would be called 'Sample Account 1' and the other 'Sample Account 2'
//Also, when we're done inserting them, we will create a case for each one with a Status of 'New', Origin of 'New Account' and the
//desription and subject of your choice.
//This isn't working quite right. Can you use your debugging skills to fix it? I had to comment it out since it won't compile
public with sharing class WeekSixHomework {
// Remember Sets & Maps?? We did a little practice with Lists in week 2, but we need to make sure we know how to use Sets & Maps as well!!
public static void setsReview(){
//Your assignment: Play with Sets!
// 1. Create a set of Strings and add at least 5 entries
Set<string> dogCare = new Set<string> ();
dogCare.add ('leash');
public with sharing class WeekFiveHomework {
//Let's practice calling different methods by writing our very own methods. You will write and save methods in the space below
//Note: There are existing pre-written methods at the bottom of this class that you can use to help with your own methods. Ready? Let's go!
//Sample: Here is a public method that calls the getCitiesForExpansion below and prints the results to our debug log
public static void printOutCitiesForExpansionDemo() {
//The code on the left of the equals sign instantiates a list of Strings, the code on the right side calls our method and returns a list of cities
//the equals sign assigns the returned value, to the list we created
public with sharing class WeekFourHomework {
public static void soqlPractice() {
//1. Below is a SOQL query that should be returning the top 5 Accounts in our org based on Annual Revenue.
//Something's not quite right, can you fix the query?
List<Account> topFiveAccounts = [SELECT Id, Name, AnnualRevenue FROM Account WHERE AnnualRevenue > 0 ORDER BY AnnualRevenue ASC LIMIT 5];
System.debug('This should be 5: ' + topFiveAccounts.size());
public with sharing class WeekThreeHomework {
public static void homeworkAssignmentMethod() {
//Read through the setup below and then complete the code following the prompts. When you're done, make sure to compile (save) your work
//Open Execute Anonymous in the Developer Console and execute your code by typing in: WeekThreeHomework.homeworkAssignmentMethod();
//Read through the debug statements to make sure you're done your work correctly.
//************************************************************************************************************
@katherinechu92
katherinechu92 / Commenting on Code
Created March 26, 2026 14:27
Week Two Homework
public with sharing class CommentingOnCodeExercise {
/**
* Your Assignment is to add comments describing what is being done in the methods below.
* Call out the concepts you learned in your readings and in class.
*/
public static void cartValues() {
// Declaring the variable minimumCartValue with the type Integer, and assigning it a value of 50
Integer minimumCartValue = 50;