I'm having trouble providing code coverage for my Apex Class.  Apex Class  public class CSMetricsDashboardController {     public CS_Metrics_Dashboard__c dashboard {get;set;}      public CSMetricsDashboardController() {         List&lt;CS_Metrics_Dashboard__c&gt; results = [             SELECT                 Antic_Needs_Avg__c,                 Antic_Needs_Target__c,                 Expenses_Color__c,                 KLAS__c,                 KLAS_Target__c,                 Investment_Projects_Led__c,                 Investment_Projects_Supported__c,                 Product_Release_Training_Color__c,                 Project_NPS_Avg__c,                 Project_NPS_Target__c,                 Project_On_Budget__c,                 Project_On_Budget_Target__c,                 Time_Entry_Color__c,                 Time_Entry_Missed__c,                 Time_Entry_Missed_Percentage__c,                 Time_Entry_Rating__c,                 Utilization_MTD_Actual__c,                 Utilization_YTD_Target__c,                 Utilization_YTD_Actual__c             FROM CS_Metrics_Dashboard__c             WHERE User_Name__c =: UserInfo.getUserId()             AND Inactive__c = false         ];         if (results.size() &gt; 0) {             this.dashboard = results[0];         }     } }   Test Class:  @isTest public class CSMetricsDashboardContollerTest {      public static testmethod void testRunAs(){         // Setup test data         // Grap Profile         Profile p = [SELECT Id FROM Profile WHERE Name ='Standard User'];         // Create new user         User u = new User(Alias = 'standt',                            Email = 'standarduser@stratadecision.com',                           EmailEncodingKey = 'UTF-8',                            LastName = 'Tester',                            LanguageLocaleKey = 'en_US',                           ProfileId = p.Id,                           TimeZoneSidKey = 'America/Chicago',                           UserName = 'standarduser@stratadecision.com');         insert u;         // Create new account          Account a = new Account(Name = 'Test Account',                                 DBA_Name__c = 'Test Account', // Legal Entity Name                                 Type = 'Prospect');          insert a;         // Create new contact, master to CS Metrics Dashboard         Contact c = new Contact(LastName = 'Tester',                                 AccountId = a.Id,                                 Status__c = 'Active');         insert c;         // Create new CS Metrics Dashboard record related to new contact         CS_Metrics_Dashboard__c cs = new CS_Metrics_Dashboard__c(Contact__c = c.Id,                                                                  User_Name__c = u.Id,                                                                  Project_NPS_Avg__c = 90,                                                                  Inactive__c = false);         insert cs;          // start test         test.startTest();              System.runAs(u){                 // The following code runs as user 'u'             List&lt;CS_Metrics_Dashboard__c&gt; results = [SELECT Id,                                                             Inactive__c,                                                             Project_NPS_Avg__c,                                                             User_Name__c                                                       FROM CS_Metrics_Dashboard__c                                                       WHERE User_Name__c =: u.Id];                  System.assert(u != null);                 System.assertEquals(false, results[0].Inactive__c);                 System.assertEquals(90, results[0].Project_NPS_Avg__c);                 System.assertEquals(u.Id, results[0].User_Name__c);          // stop test          test.stopTest();         }       } }
This is a canonical question and answer developed by the community to help address common questions. If you've been directed here, or your question has been closed as a duplicate, please look through the resources here and use them to shape more specific questions. To browse all canonical questions and answers, including more unit test resources, navigate to the  tag.  This canonical question is intended to address several classes of common questions by providing a quick summary and links to comprehensive resources:   How do I start writing my first unit test?  How do I unit test this code?  I need help writing this unit test.   Salesforce Stack Exchange looks for detailed, specific questions that the community can help you with, and can't write tests on your behalf. We feel that working with the resources below can help you get started, and we encourage you to make an attempt to write your test and return to SFSE with your specific questions when you encounter challenges you can't resolve.
Looking for a book series about a girl and her friends captured and sold as slaves I'm trying to find the name of a book series I read about 10 years ago. It might be a children/young-adult series since I was fairly young. There is also a small chance it was written by a french author, as I read it in french. The series is composed of at least three books, maybe more. Here is what I remember :   The main character is a poor girl/young woman, but there are several point of view characters At the beginning of the first book the plot is set in a city where rich people live in the city center and the further you go from the center the poorest people are. Moreover, the houses are painted according to the wealth of the owner. It was something like : the richer had red houses, the poorer blue houses, and the moderately wealthy purple (it was not those colors in particular but it was something like that) At the end of one of the book there is some kind of uprising and the people paint all the houses in multiple colorful shades (to symbolize the new found equality between the citizen) At some point the main character and other peoples of the city get captured (maybe after some kind of war the city was involved in), separated and sold to slavery One of them, an older boy, become a soldier and learn a special fighting technique that looks like dancing (and he grows to like it) Another of the captives, a young girl (the sister of the main character if I recall correctly) get marked with a fire-heated mark to show her condition of slave   That is all I remember, I have no clue about the time or geographic setting nor the story details.  I know it's not much to go by, any help would be greatly appreciated, as I would like to find these books and read them again. Using a question mark mid-sentence May I use a question mark in the middle of a sentence? Examples:  Would you like the drapes to be white? or perhaps something off-white? Would you like the logo to be centered? at the bottom? left off entirely? Is the Macbook 12 inch's USB-C charger interchangeable with other USB-C chargers or devices? If there is only the Macbook 12 inch USB-C charger nearby, can it be used to charge other USB-C devices, such as any Android phones that also use USB-C? (will it be "too powerful" and damage other devices?)  Vice versa, if there is a Quick Charge 2.0 or 3.0 USB-C charger from other devices nearby, can it be used to charge the Macbook 12 inch?  The main concern is about whether it could damage the device or battery. Is there a well-known term for the synonym or near-synonym "telescoping" words? This has been rattling around in the back of my mind for many years (way before Stack Exchange came into existence), so it's a relief to finally ask the question.  There are words that can be "contracted" by removing one or more letter(s) (without changing the order of the letters) to form a shorter word with the same meaning, or one very close to it.  The two strongest examples I can think of right now are:  rapscallion -> rascal  and  satiate -> sate  This is a slightly weaker example:  rapine -> rape  Even though "rape" has come, in modern usage, to refer almost exclusively to a sexual crime, it can still be used in a more literary (and purposefully anachronistic) sense to mean "the plunder and pillage of a country or region". In that sense, "rape" can be used in a similar fashion to "rapine"; in any case, the two words are etymologically related to the Latin rapere which is tied to the archaic usage.  Another weaker example:  transliterate -> translate  These words are near-synonyms, but there is a definite difference in their meaning. Still, I guess this pair would qualify, albeit in a looser sense.  I wanted to exclude some relatively trivial examples, such as:  (inflammable -> flammable)  (perambulate -> ambulate)  and so forth. So I've imposed the additional rule (arbitrary though it may seem) that the "stripped" letters must not come from the start or the end of the word, but only from its middle.  Acronyms and portmanteaus are also excluded, as are "slangier" contractions e.g.:  (modulator-demodulator -> modem)  (motor-hotel -> motel)  (certitude or certainty or certificate -> cert)  I guess the long-short forms of the same word would form a linguistic doublet. I've coined the term "telescoping word" to describe the long form that "collapses" into the short form with letter deletion sans anagramming.  My question is: has this phenomenon already been studied? If so, what name have authorities given it? Is there already an existing reference or resource on it? Thanks in advance.  (This is not a duplicate of , as that is asking about the more general phenomenon of words (not necessarily synonyms) occurring within larger words. In fact, the question specifically mentions "kangaroo word" and states that a broader scope is being sought.) Finding real roots of $ P(x)=x^8 - x^7 +x^2 -x +15$ Let $ P(x)=x^8 - x^7 +x^2 -x +15 $, Descartes' Rule of Signs tells us that the polynomial has 4 positive real roots , but if we group the terms as $$ P(x)= x(x-1)(x^6+1) +15 $$ we find that $ P(x) $ does not have any positive roots.  Where did I err ? How can I remove snaps without losing GUI? I want to know how to check how many snaps programs/apps I'm running. Also, how to replace them (if possible) without losing GUI? How do I Sort a Multidimensional Array in PHP How do I rename a directory via the command line? I have got the directory /home/user/oldname and I want to rename it to /home/user/newname. How can I do this in a terminal? Reproducible LaTeX builds - compile to a file which always hashes to the same value Is it possible in blender to change the dimensions of a downloaded 3d model in .blend format or .obj format in blender using python scripting? I am totally new to blender, I have downloaded a 3D model of a humanoid and am able to see it in blender. I want to change its dimensions and size in all perform editing on by changing its size, height, arm width, length, etc. In a more clear picture of the question, suppose i have 5 persons whose 3D model I have to make automatically, so I want to change the dimensions of that humanoid to match the body measurements of these people. If I can mark those points manually on the humanoid and define parameters of shoulder width, arm length, height, etc and just input the values then my project can go a little forward. The model I am using is attached in this link,  Please if anyone can tell me if it is possible to edit the model by defining certain parameters through python scripting. I need it as an add on for my project. And i just need to know how can i do that rest i shall experiment and do. Displaying row/column of point in raster using QGIS? Checking if Ubuntu package contains desired update What is the purpose of LongLength for .Net Arrays? What is the purpose of the LongLength property for arrays in .Net.  Using a standard integer for length, you could accommodate up to 2 billion indices.  Are there really people using .Net to maintain a single array with more the 2 billion elements.  Even if each element was a single byte, that would still be 2 GB of data.   Is it feasible to use such a large array in .Net? Limit of $(\cos1/n)^{n^2}$ when $n\to\infty$ I've been trying to solve this limit: $$\lim_{n\to \infty} \left(\cos\left(\frac{1}{n}\right)\right)^{n^2}$$ I solved it using l'hopital but I have to try in another way. I tried to make the expression:  $$ \lim_{n \to \infty}\exp\left(n^2\ln\left(\cos\left(\frac{1}{n}\right)\right)\right)$$  but it didn't work out for me... Lenovo Legion Y720 laptop Keyboard backlight I just moved from Windows to Ubuntu, but I cannot get the keyboard backlight to work at all. On Windows there was a specific program for controlling the backlight. I have searched for days now without luck. Anyone got a solution?  I am using Ubuntu 18.04 undefined control sequence when using \addchap When I compile my thesis.tex file which is compiled fine including the \addchap, I noticed that I have used \usepackage{unnumberedtotoc}. When I want to use my thesis.tex file on another computer it says tex capacity exceeded, sorry [input stack size=5000]. When I uncomment \usepackage{unnumberedtotoc}, it says ! undefined control sequence  \addchap.  Here I have pasted all the beginning of the packages that I have used in my thesis but I still get some problems in compilation, I don't know why, but I think if I can compile this code, then I can solve the problem  :   \immediate\write18{makeindex \jobname.nlo -s nomencl.ist -o \jobname.nls} \documentclass[12pt]{report} \DeclareMathSizes{12}{30}{16}{12} \usepackage[utf8]{inputenc} \usepackage{graphicx} \usepackage{lineno} \usepackage{amsmath}  \usepackage{array, nccmath}  \usepackage[nottoc]{tocbibind} \newcolumntype{L}{&gt;{$}l&lt;{$}} \newcolumntype{m}{&gt;{\displaystyle}l} \usepackage{framed} \usepackage{cclicenses} \usepackage{makecell} \usepackage[french]{babel} \usepackage{setspace} \usepackage{mathptmx}  \usepackage{multirow}  \usepackage{gensymb}  \usepackage{empheq}   \usepackage{mathtools}   \usepackage{array}   \renewcommand{\arraystretch}{1.9}   \newcolumntype{P}{&gt;{\centering\arraybackslash$}p{1.6em}&lt;{$}}   \newcolumntype{C}{&gt;{\centering\arraybackslash$}c&lt;{$}}   \usepackage{makecell}   \usepackage{booktabs}   \usepackage{subcaption}   \usepackage[intoc]{nomencl}   \makenomenclature   \setcounter{secnumdepth}{4}   \setcounter{tocdepth}{4}   \usepackage[justification=centering]{caption}    \usepackage{etoolbox}     \usepackage{unnumberedtotoc} %https://github.com/johannesbottcher/unnumberedtotoc/     \usepackage[automark,     plainheadsepline,     headsepline,     plainfootsepline,      footsepline,     markcase=ignoreupper]{scrlayer-scrpage}    \clearpairofpagestyles    \ihead*{\leftmark}    \cfoot*{\pagemark}    \setkomafont{pageheadfoot}{\scshape}    \usepackage{titlesec}    \graphicspath{{imagesthesis/}}    \def\frenchlistfigurename{Liste des figures}    \usepackage[a4paper,right=20mm,left=25mm,top=26mm, bottom=26mm]{geometry}    \makeatletter    \titleformat{\chapter}[display]    {\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}    % this alters "before" spacing (the second length argument) to 0    \titlespacing*{\chapter}{0pt}{0pt}{20pt}    %\patchcmd{\@makechapterhead}{\vspace*{20\p@}}{}{}{}% Removes space above \chapter head    %\patchcmd{\@makeschapterhead}{\vspace*{20\p@}}{}{}{}% Removes space above \chapter* head    \makeatother    \title {itle of the thesis}    \titleformat{\paragraph}    {\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}    \titlespacing*{\paragraph}     {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}     \usepackage[thin, , thinc]{esdiff}  \usepackage{subcaption}  \usepackage{caption}  \usepackage{framed}    \usepackage{nomencl}   \setlength{\nomitemsep}{-\parskip}\usepackage{booktabs,multirow}  \renewcommand{\cellset}{\renewcommand{\arraystretch}{0.5}}   \begin{document}  \renewcommand\arraystretch{0.8} %\noindent  \doublespacing  \maketitle  \tableofcontents %\listoffigures  \addchap{Publications et communications}   \section*{$\:$  a. Publications:}  \section*{$\:$  b. Communications:}  \addchap{Remerciements}  \end{document} In Java when one interface extends another, why would one redeclare a method in a subinterface? I've been looking at the JMS API from J2EE and found a strange behavior where certain methods that are declared in an interface (e.g., createQueue in Session) are declared again in the subinterfaces such as QueueSession, and with identical documentation.  Since an subinterface "inherits" all the method declarations of the interface it inherits, and since the JavaDoc tool has no problem sorting out the JavaDocs of the subinterface and creating an "inherited operations" list, I can't figure out what this achieves.  The only think of is that initially the call was in Session, and then moved to QueueSession when the specific subclass was created, though then I would have expected to see something in the documentation of the upperclass. But this is just conjecture.  So the question is: Is there a convincing reason to redeclare a method in a subinterface? How do I edit PDF files produced by LaTeX in Illustrator? Fonts are not found When I try to use Adobe Illustrator (CS4) to edit a PDF file produced by LaTeX with several equations in it, Illustrator complains that it can't find the fonts:  The font CMBX10 is missing.  Affected text will be displayed using a substitute font. The font CMMI10 is missing.  Affected text will be displayed using a substitute font. The font CMMI6 is missing.  Affected text will be displayed using a substitute font. The font CMMI7 is missing.  Affected text will be displayed using a substitute font. The font CMMI8 is missing.  Affected text will be displayed using a substitute font. The font CMMIB10 is missing.  Affected text will be displayed using a substitute font. The font CMR10 is missing.  Affected text will be displayed using a substitute font. The font CMR7 is missing.  Affected text will be displayed using a substitute font. The font CMSY10 is missing.  Affected text will be displayed using a substitute font. The font CMSY6 is missing.  Affected text will be displayed using a substitute font. The font CMSY7 is missing.  Affected text will be displayed using a substitute font. The font MSBM10 is missing.  Affected text will be displayed using a substitute font. To preserve appearance, some text has been outlined.   How do I find &amp; install the necessary fonts? How can I capitalize the first letter of each word in a string in Perl? AMD GPU Material in "material preview mode" and "rendered mode", is entirely gray as background. Only outline is displayed