@isTest public class ConvertTestClass {      public static testMethod void test1() {          Lead__c ld = new Lead__c ();         ld.First_Name__c = 'Test';         ld.Name    ='first';         ld.Company__c ='Test company';         ld.Status__c = 'Qualified';         insert ld;          Test.StartTest();           PageReference pageRef = Page.RedirectingToLead;          Test.setCurrentPage(pageRef);           ApexPages.StandardController sc = new ApexPages.StandardController(ld);         ConvertTheLead testAccPlan = new ConvertTheLead(sc);         testAccPlan.RedirecttoSite();         testAccPlan.convertbutton();         Test.StopTest();      }      public static testMethod void test2() {          Lead__c ld = new Lead__c ();         ld.First_Name__c = 'Test';         ld.Name    ='first';         ld.Company__c ='Test company';         // Set Status as any valid value other then "Qualified"         ld.Status__c = 'New';          insert ld;          Test.StartTest();           PageReference pageRef = Page.RedirectingToLead;          Test.setCurrentPage(pageRef);         PageReference RedirectingToLead = extension.myUpdate();           ApexPages.StandardController sc = new ApexPages.StandardController(ld);         ConvertTheLead testAccPlan = new ConvertTheLead(sc);         testAccPlan.RedirecttoSite();         testAccPlan.convertbutton();         Test.StopTest();         system.assert(ApexPages.addMessage(), 'There should be an error');     system.assertEquals(null, RedirectingToLead, 'Redirect should be cancelled');      }  }
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 is code coverage obtained and calculated? How do I increase my coverage?  Why can't I cover these lines? Why isn't the body of my loop or conditional statement covered?
Why does my NTFS partition mount as read only? Until recently both my Windows Partition (C:) and my Data Partition (E:) would mount as read/write. Now both seem to only mount as read-only.    GParted Resize (Error)  ntfsresize v2.0.0 (libntfs 10:0:0) Device name : /dev/sda4 NTFS volume version: 3.1 Cluster size : 4096 bytes Current volume size: 86207623680 bytes (86208 MB) Current device size: 86207627264 bytes (86208 MB) New volume size : 78662066688 bytes (78663 MB) Checking filesystem consistency ... Accounting clusters ... Space in use : 62126 MB (72.1%) Collecting resizing constraints ... Needed relocations : 1606868 (6582 MB) Schedule chkdsk for NTFS consistency check at Windows boot time ... Resetting $LogFile ... (this might take a while) Relocating needed data ... ERROR: Extended record needed (1032 &gt; 1024), not yet supported! Please try to free less space.   chkdsk Output:     Checking file system on E: The type of the file system is NTFS. Volume label is Data.  A disk check has been scheduled. Windows will now check the disk.                            99482 file records processed.   495 large file records processed.                        0 bad file records processed.                            0 EA records processed.                                  0 reparse records processed.                             104412 index entries processed.                          0 unindexed files processed.                             99482 security descriptors processed.                    2466 data files processed.                              CHKDSK is verifying Usn Journal...   4479208 USN bytes processed.                                      Usn Journal verification completed. Windows has checked the file system and found no problems.  84187132 KB total disk space.   60479688 KB in 69969 files.      15520 KB in 2467 indexes.          0 KB in bad sectors.     174336 KB in use by the system.      65536 KB occupied by the log file.   23517588 KB available on disk.       4096 bytes in each allocation unit.   21046783 total allocation units on disk.    5879397 allocation units available on disk.  Internal Info: 9a 84 01 00 00 1b 01 00 fc 1a 01 00 00 00 00 00  ................ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................ 42 00 00 00 52 73 5c 77 b0 e7 1d 00 b0 df 1d 00  B...Rs\w........   fstab  # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # &lt;file system&gt; &lt;mount point&gt;   &lt;type&gt;  &lt;options&gt;       &lt;dump&gt;  &lt;pass&gt; proc            /proc           proc    nodev,noexec,nosuid 0       0 # / was on /dev/sda5 during installation UUID=8213cc89-2438-41b9-899f-13b4c5b299af /               ext4    errors=remount-ro 0       1 # swap was on /dev/sda6 during installation UUID=45873767-d9ae-4f0c-baab-ffc2726ac24e none            swap    sw              0       0   Checked the drive in GParted, GSmartControl and with ntfsfix, all completed successfully, no change.  Partitions  dev/sda1 NTFS WinRE dev/sda2 NTFS Windows C: dev/sda3 Extended dev/sda4 NTFS Data E: dev/sda5 EXT4 Ubuntu dev/sda6 linux-swap    I am looking for an explanation of:    Internal Info: 9a 84 01 00 00 1b 01 00 fc 1a 01 00 00 00 00 00  ................ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................ 42 00 00 00 52 73 5c 77 b0 e7 1d 00 b0 df 1d 00  B...Rs\w........   and    Resetting $LogFile ... (this might take a while) Relocating needed data ... ERROR: Extended record needed (1032 &gt; 1024), not yet supported! Please try to free less space. If $Y$ is connected, why is $A\cup Y$ connected in this case? Getting text from the Resource file in asp.net 4 What's the best way to take a segment out of a text file? What's a good way of extracting say, lines 20 -45 out of a huge text file. Non-interactively of course! If Durmstrang and Beauxbatons were hidden from common knowledge, how did people from other schools go to them for the Triwizard tournament? So in GoF, they state that Beauxbatons and Durmstrang are hidden from view and don't have their locations public.     “Durmstrang’s another wizarding school?” said Harry      “Yes,” said Hermione sniffily, “and it’s got a horrible reputation.      According to An Appraisal of Magical Education in Europe, it puts a   lot of emphasis on the Dark Arts.”      “I think I’ve heard of it,” said Ron vaguely. “Where is it? What   country?”      “Well, nobody knows, do they?” said Hermione, raising her   eyebrows.      “Er — why not?” said Harry.      “There’s traditionally been a lot of rivalry between all the magic   schools. Durmstrang and Beauxbatons like to conceal their whereabouts   so nobody can steal their secrets,” said Hermione matter-offactly.   So how do students get to the other school for the Triwizard tournament? to set start Thunderbird in minimized mode at startup, but it wasn't helpful.   After following the instructions, I could not even start Thunderbird. So I was forced to start TB in safe mode to delete the "FireTray Plugin" and fix this issue. After that it started to work but it deleted all my email accounts and I had to do that chore all over again .  So is there any working way to start Thunderbird minimized on start-up? Where are temporary files in Chrome stored? (Posted here as probably applies to all sites).  I was examining my reputation gain yesterday on Stack Overflow: 190. I believe I should have hit the 200 cap. Mainly due to         Respectively, I had 10, 7, 3, and 2 upvotes on those questions alone. There are a couple of other minnows in the list but the above alone should enable me to hit the cap.  There was a user removed sometime yesterday which knocked off 10 points (and possibly accounts for the disparity) but I think (1) the cap should have been recalibrated and (2) I answered (3) after this event before turning in for the night.  I checked all the usual suspects: the reputation graph on your profile and  the achievements tab, but they are all showing 190. What are the regional Pokémon? I have heard that there are some Pokémon that are region specific.  Could someone please clarify which Pokémon are region specific and in which regions that they can be found in? Behavior of $\|f\|_p$ when $p$ is near the endpoint of $I$ Given measure space $(X, \mu)$ and measurable function $f$. If $p \in (0, +\infty]$, below are the facts I know about $\Vert f \Vert_p$:  (log convex in $\frac 1 p$) $\forall p_1, p_2\in (0, +\infty] \text{ such that } p_1 &lt; p_2. \forall t \in(0, 1), \text{ let } \frac 1 p = \frac t {p_1} + \frac {1-t} {p_2}$, then $\Vert f \Vert_p \le \Vert f \Vert_{p_1}^t\Vert f \Vert_{p_2}^{1-t}$ ($0\cdot(+\infty)$ is defined to be $0$). (lower semi-continuity) $\forall p_0 \in (0, +\infty], \liminf_{p\to p_0}\Vert f\Vert_p \ge \Vert f \Vert_{p_0}$. If $0&lt;\mu(X) &lt; +\infty$, then $ \Vert f \Vert_p/\mu(X)^{\frac 1 p}$ is monotone increasing in $p$, combine it with (2) we get $\lim_{p\to p_0-}\Vert f\Vert_p = \Vert f \Vert_{p_0}$.  From (1) we know the set of $p$ such that $\Vert f \Vert_p &lt; +\infty$ is an interval $I$ (possibly empty or a singleton).  If $I \not\in a = \inf I$ and $a \neq 0$, from (2) we know $\lim_{p\to a+} \Vert f \Vert_p = +\infty$. If $I \not\in b = \sup I$, then $\lim_{p\to b-} \Vert f \Vert_p = +\infty$.  From (1) and the dominated convergence theorem we know that if $I \ni p_0 \neq \inf I$ and $p_0 &lt; +\infty$, then $\lim_{p\to p_0+} \Vert f \Vert_p = \Vert f \Vert_{p_0}$. If $I \ni p_0 \neq \sup I$, then $\lim_{p\to p_0-} \Vert f \Vert_p = \Vert f \Vert_{p_0}$.  If $I$ is nondegenerate and $+\infty \in I$, then $\lim_{p\to +\infty}\|f\|_p = \|f\|_{\infty}$.  If $\inf I = 0$, from (1) we know $\lim_{p\to 0+}\|f\|_p$ exists.   Question: How $\Vert f \Vert_p$ behaves when $p$ is the endpoint of $I$? To be more precise, assume $I$ is nonempty. Let $p_0 = \sup I$ (only right endpoint is considered for simplicity):  $p_0\in I$ or $p_0 \not\in I$? Can $I$ be a singleton? What if $p_0 = +\infty$? What if $0&lt;\mu(X) &lt; +\infty$?  Please also notify me if there is any mistake above. Downloading PlayOnLinux I'm downloading PlayOnLinux to run Paint Tool SAI, but I cannot open PlayOnLinux. When I click on it to open it, a dialog box comes up that says: "PlayOnLinux cannot find curl (from cURL) You need to install it to continue". How do I install this?   I'm referring to this article: Picking random points in the volume of sphere with uniform probability How do I play a YouTube video in the background on my iPad? I like to 'listen' to YouTube video in the background while I am surfing on my desktop. However, I cannot do this on the iPad as, as soon as I switch from YouTube video to the browser, the video pauses. Is there a solution for this either in the form of an app or a website? I have studied that  and motional emf are two different lines of thinking but are essentially same. But then, how can Faraday's paradox be explained by Faraday's law of induction? Particularly in paradoxes in which Faraday's law of induction predicts zero EMF but there is a non-zero . The wikipedia article is more confusing rather than enlightening.  I need an explanation regarding  EDIT : I wanted to know how is flux changing if faraday's law is valid . Ubuntu 18.10 Cosmic not starting GNOME session on bootup I need to be able to merge two (very simple) JavaScript objects at runtime.  For example I'd like to:  var obj1 = { food: 'pizza', car: 'ford' } var obj2 = { animal: 'dog' }  obj1.merge(obj2);  //obj1 now has three properties: food, car, and animal   Does anyone have a script for this or know of a built in way to do this?  I do not need recursion, and I do not need to merge functions, just methods on flat objects. UK Visa in an expired Nigerian passport - what to use? Best explanation of Ruby blocks? CUDA Driver API vs. CUDA runtime How to use exclamation marks in Minecraft commands?