본문 바로가기

Dev_HongUniverse

(43)
Apex Testing Apex Test Code 예제를 보며 System.assertEquals() , System.assert()를 사용하여 예외 케이스까지 테스트 해본다. public class AccountService { // Enum to represent Account Levels public enum AccountLevel { STANDARD, PREMIUM, VIP } // Method to update the Account Level based on revenue public static void updateAccountLevel(Id accountId) { Account account = [SELECT Id, AnnualRevenue FROM Account..
[자바의정석] Chapter2 변수 변수 변수 초기화 변수의 초기화란, 변수를 사용하기 전에 처음으로 값을 저장하는 것 두 변수의 값 교환하기 public class VarEx2 { public static void main(String[] args) { int x = 10, y = 20; int tmp = 0; System.out.println("x:"+x + " y:"+y); tmp = x; x = y; y = tmp; System.out.println("x:"+x + " y:"+y); } } 출력) x:10 y:20 x:20 y:10 변수의 명명규칙 예약어 (키워드 또는 리져브드 워드)는 프로그래밍언어의 구문에 사용되는 단어로 클래스나 변수, 메서드의 이름으로 사용할 수 없다. 클래스 이름의 첫 글자는 항상 대문자로 한다. 여러 단어..
기초 : String 클래스 인스턴스 생성 1) new 키워드 없이 인스턴스를 만드는 경우 String str1 = "hello"; String str2 = "hello"; - 문자열이 메모리 중 상수를 저장하는 영역에 저장된다. - str1과 str2는 같은 인스턴스를 참조한다. 2) new 키워드로 인스턴스를 만드는 경우 String str1 = new String("hello"); String str2 = new String("hello"); - 인스턴스는 무조건 힙 메모리 영역에 새로 만드므로 str1과 str2는 서로 다른 인스턴스를 참조한다. package javaStudy; public class StringExam { public static void main(String[] args) { String str1 = new Strin..
자바스크립트 | 정렬, 객체 배열 합치기 사이트맵을 만드는 과정에서 제목을 클릭했을 때 하위 제목들이 나올 수 있도록 구현하였다. var data = { name : "최상위제목", parentdDatas : [ { title : '부모제목 1', childDatas : [ { title : '자식제목 1_1', position : 1, content : '테' }, { title : '자식제목 1_2', position : 2, content : '스' } ] }, { title : '부모제목 2', childDatas : [ { title : '자식제목 2_1', position : 2, content :'중' }, { title : '자식제목 2_2', position : 1, content :'트' } ] } ] }; let li = [..
Get List of Profiles that are visible to a particular tab How can I get a list of profiles visible on a particular tab? //get all Tab names to do a query of prmissionSetTabSetting List tabList = [SELECT Label, Name, Url From TabDefinition ORDER BY Label]; Map tabMap = new Map(); for(TabDefinition tab : tabList){ tabMap.put(tab.Name, tab); } //Querying using a nameset List targetList = [SELECT Parent.Profile.Name, Parent.Iscustom, Name, Visibility FROM ..
[프로그래머스] 문자열 내 p와 y의 개수 / Level 1 / JAVA ✏️ 문제 : 문자열 내 p와 y의 개수 ✏️문제 설명 대문자와 소문자가 섞여있는 문자열 s가 주어집니다. s에 'p'의 개수와 'y'의 개수를 비교해 같으면 True, 다르면 False를 return 하는 solution를 완성하세요. 'p', 'y' 모두 하나도 없는 경우는 항상 True를 리턴합니다. 단, 개수를 비교할 때 대문자와 소문자는 구별하지 않습니다. 예를 들어 s가 "pPoooyY"면 true를 return하고 "Pyy"라면 false를 return합니다. ✏️제한사항 문자열 s의 길이 : 50 이하의 자연수 문자열 s는 알파벳으로만 이루어져 있습니다. ✏️입출력 예 s answer "pPoooyY" true "Pyy" false 1) 시도 : 100점 import java.util.*;..
[SQL 쿡북] Chapter 10 : 범위 관련 작업 (MYSQL) 10.2 같은 그룹 또는 파티션의 행 간 차이 찾기 같은 부서, 즉 deptno이 같은 사원간의 급여 차이를 나타내려고 한다. 그리고 고용된 순으로 나타내고, 마지막으로 고용된 사원의 급여 차액은 'N/A로 반환하려고 한다. with next_sal_tab (deptno, ename, sal, hiredate, next_sal) as (select deptno, ename, sal, hiredate, lead(sal) over(partition by deptno order by hiredate) as next_sal from emp) select deptno, ename, sal, hiredate, coalesce(cast(sal - next_sal as char), 'N/A') as diff from ..
[SQL 쿡북] Chapter 9 : 날짜 조작 기법 (MYSQL) 9.1 연도의 윤년 여부 결정하기 LAST_DAY함수를 이용하여 2월의 마지막 날을 찾으려고 한다. select day( last_day( date_add( date_add( date_add(current_date, interval -dayofyear(current_date) day), interval 1 day), interval 1 month))) dy from t1 DATE_ADD(기준 날짜, INTERVAL) [MySQL] 시간 더하기, 빼기 (DATE_ADD, DATE_SUB 함수) ▶MySQL 시간 더하기, 빼기 (DATE_ADD, DATE_SUB 함수) ▶설명 MySQL에서 특정 시간을 기준으로 더하거나, 빼야 하는 경우가 있습니다.이 때 사용하는 함수가 DATE_ADD와 DATE_SUB입니..