• Madhukar Reddy Vuradi
  • 0 Points
  • Member since 2018

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
  • 1
User-added image
I am confused with the term merged.
when i launch it shows this page
User-added image

when i install a package it shows me this

User-added image
The package is installing here.
When check for the challenge it is showing that the packae is not installed.
I'm very new to this and managed to write a trigger, preventing a duplicates on a custom object 'Time Estimating' and giving a customised error on screen.  Code is below.

The trigger works perfectly in Sandbox but I can't move the trigger into production as it doesn't include tests.  So I have written a separate apex class to test.  The code is also below.  When I debug I get the following error 'required (...)+ loop did not match anything at input '<EOF>'.  I have googled this to death with no helpful result. When I run tests I get 0% code coverage for the trigger.

Can anyone advise what I have done wrong?  

I'm using the Developer Console (can't install anything else).

Apex Trigger to check for duplicates (called PreventDuplicate)
trigger PreventDuplicate on Time_Estimating__c (before insert, before update){
    List<String> uniqueValueList = new List<String>();
    for(Time_Estimating__c a : Trigger.new){

    List<Time_Estimating__c> acctList = [select id, name, Unique_Year_Estimate__c from Time_Estimating__c where Unique_Year_Estimate__c IN :uniqueValueList];
    Map<String,Time_Estimating__c> uniqueValueMap = new Map<String,Time_Estimating__c>();
    for(Time_Estimating__c a : acctList){
    for(Time_Estimating__c a : Trigger.new){
            if(trigger.isInsert || (trigger.isUpdate && a.id<>uniqueValueMap.get(a.Unique_Year_Estimate__c).id)){
                a.addError('A Time Estimate for the year you have specified already exists.  Please click the cancel button and update the existing time estimate.');

Apex class to test trigger (called PreventDuplicateTest)

//test for PreventDuplicate trigger on Time Estimating
Public Class PreventDuplicateTest
   Static testMethod Void PreventDuplicate()
      Boolean result = false;
      Time_Estimating__c firstAcc = new 
          Time_Estimating__c(Unique_Year_Estimate__c = 'test - 2015',Matter_Name__c = 'test');
      insert firstAcc;
           Time_Estimating__c secondAcc = new 
               Time_Estimating__c(Unique_Year_Estimate__c = 'test - 2015',Matter_Name__c = 'test');
           insert secondAcc;
       }catch(DmlException ex){ result = true;}

Many thanks for your help!