{"action":"created","comment":{"url":"https://api.github.com/repos/eroispaziali/my-awesome-app/pulls/comments/61725330","id":61725330,"diff_hunk":"@@ -0,0 +1,851 @@\n+/**\n+ * This class contains unit tests for validating the behavior of Apex classes\n+ * and triggers.\n+ *\n+ * Unit tests are class methods that verify whether a particular piece\n+ * of code is working properly. Unit test methods take no arguments,\n+ * commit no data to the database, and are flagged with the testMethod\n+ * keyword in the method definition.\n+ *\n+ * All test methods in an organization are executed whenever Apex code is deployed\n+ * to a production organization to confirm correctness, ensure code\n+ * coverage, and prevent regressions. All Apex classes are\n+ * required to have at least 75% code coverage in order to be deployed\n+ * to a production organization. In addition, all triggers must have some code coverage.\n+ * \n+ * The @isTest class annotation indicates this class only contains test\n+ * methods. Classes defined with the @isTest annotation do not count against\n+ * the organization size limit for all Apex scripts.\n+ *\n+ * See the Apex Language Reference for more information about Testing and Code Coverage.\n+ */\n+@isTest\n+private class PobControllerExtTest {\n+\t\n+\tprivate static final Integer NUMBER_OF_LOTS = 12;\n+\tprivate static final String APPLES = 'Apples';\n+\tprivate static final String PEARS = 'Pears';\n+\tprivate static final String ORANGES = 'Oranges';\n+\tprivate static final Integer NUMBER_OF_LOTS_ORANGES = 5;\n+\tprivate static final Integer NUMBER_OF_LOTS_PEARS = 7;\n+\tprivate static final Integer EXPECTED_PAGES_ORANGES_AND_PEARS = 3;\n+\tprivate static final Integer EXPECTED_PAGES_ORANGES_ONLY = 1;\n+\tprivate static final Integer EXPECTED_PAGES_PEARS_ONLY = 2;\n+\tprivate static final Decimal TEST_ORDER_BUDGET = 150000;\n+\n+\t/** \n+\t\tTEST PRODUCT CATEGORY FILTER\n+\t\t==========================================================================================\n+    \tEnsure category filter works properly when the page is created, \n+    \tthe filter is set and reset back.\n+    \t\t1) by default the filter must be off\n+    \t\t2) when turned on only products of a specific category must be shown\n+    \t\t3) if the value of the filter isn't found, no results shoul be displayed\n+    \t========================================================================================== */\n+\tstatic testMethod void testCategoryFilter() {\n+\t\t\n+\t\t// Vars, users & data\n+\t\tAccount myAccount;\n+\t\tOrder__c myOrder;\n+\t\tUser accountManager = TestDataFactory.createUser('Account Managers', 'aManager');\n+\t\tUser inventoryManager = TestDataFactory.createUser('Inventory Managers','iManager');\n+\t\t\n+\t\tSystem.runAs(inventoryManager) {\n+\t\t\tList<Lot__c> lotsOfPears = TestDataFactory.createLots(PEARS, NUMBER_OF_LOTS_PEARS);\n+    \t\tList<Lot__c> lotsOfOranges = TestDataFactory.createLots(ORANGES, NUMBER_OF_LOTS_ORANGES);\n+    \t\tinsert lotsOfPears;\n+    \t\tinsert lotsOfOranges;\n+\t\t}\n+\t\t\n+\t\tSystem.runAs(accountManager) {\n+\t\t\tmyAccount = TestDataFactory.createAccount();\n+    \t\tinsert myAccount;\n+    \t\t\n+    \t\tTest.startTest();\n+    \t\t\n+\t    \t\t// Create controller    \t\n+\t\t    \tmyOrder = TestDataFactory.createOrder(myAccount);\n+\t\t\t\tApexPages.StandardController sc = new ApexPages.standardController(myOrder);\n+\t\t    \tPobControllerExt ce = new PobControllerExt(sc);\n+\t\t    \t\n+\t\t    \t// Test picklist values are loaded\n+\t\t    \tList<SelectOption> options = ce.getFilterValues();\n+\t\t    \tSystem.assertEquals(true, options.size()>0, 'Options expected in the filter picklist');\n+\t\t    \t\n+\t\t    \t\n+\t\t    \t/* \t(1)  By default filter must be OFF\n+\t\t    \t\tCheck number of pages, products count for each category\n+\t\t\t\t============================================================================ */\n+\t\t    \tSystem.assertEquals(EXPECTED_PAGES_ORANGES_AND_PEARS, ce.getNumberOfPages(), 'Inconsistent number of pages when filter is OFF');\n+\t\t    \tInteger orangesCount = 0, pearsCount = 0;\n+\t\t    \tfor (Integer i=0; i<ce.getNumberOfPages(); i++) {\n+\t\t    \t\tSystem.assertNotEquals(0, ce.wrappers.size(), 'Empty pages detected when filter is OFF'); \n+\t\t    \t\tfor (PobControllerExt.Wrapper w:ce.wrappers) {\n+\t\t    \t\t\tif (w.product.Product_Category__c == PEARS) {\n+\t\t    \t\t\t\tpearsCount++;\n+\t\t    \t\t\t}\n+\t\t    \t\t\tif (w.product.Product_Category__c == ORANGES) {\n+\t\t    \t\t\t\torangesCount++;\n+\t\t    \t\t\t}\n+\t\t    \t\t}\n+\t\t    \t\tce.nextPage();\n+\t\t    \t} \n+\t\t    \tSystem.assertEquals(NUMBER_OF_LOTS_PEARS, pearsCount, 'Inconsisent products count across pages with filter OFF');\n+\t\t    \tSystem.assertEquals(NUMBER_OF_LOTS_ORANGES, orangesCount, 'Inconsisent products count across pages with filter OFF');\n+\t\t    \t\n+\t\t    \t/* \t(2) Turn ON filter, using showing only products of a specific category\n+\t\t    \t\tCheck number of pages, products count for each category\n+\t\t\t\t============================================================================ */\n+\t\t    \tce.categoryFilter = PEARS;\n+\t\t    \tce.updateFilter();\n+\t\t    \tSystem.assertEquals(EXPECTED_PAGES_PEARS_ONLY, ce.getNumberOfPages(), 'Inconsistent number of pages with filter ON');\n+\t\t    \torangesCount = pearsCount = 0;\n+\t\t    \tfor (Integer i=0; i<ce.getNumberOfPages(); i++) {\n+\t\t    \t\tSystem.assertNotEquals(0, ce.wrappers.size(), 'Empty pages detected when filter is ON');\n+\t\t    \t\tfor (PobControllerExt.Wrapper w:ce.wrappers) {\n+\t\t    \t\t\tif (w.product.Product_Category__c == PEARS) {\n+\t\t    \t\t\t\tpearsCount++;\n+\t\t    \t\t\t}\n+\t\t    \t\t\tif (w.product.Product_Category__c == ORANGES) {\n+\t\t    \t\t\t\torangesCount++;\n+\t\t    \t\t\t}\n+\t\t    \t\t}\n+\t\t    \t\tce.nextPage();\n+\t\t    \t} \n+\t\t    \tSystem.assertEquals(NUMBER_OF_LOTS_PEARS, pearsCount, 'Inconsisent products count across pages with filter ON');\n+\t\t    \tSystem.assertEquals(0, orangesCount, 'Oranges should have been filtered out');\n+\t\t    \t\n+\t\t    \t/* \t(3) Turn ON filter, using a category that has no records\n+\t\t    \t\tCheck number of pages, products count for each category\n+\t\t\t\t============================================================================ */\n+\t\t    \tce.categoryFilter = 'This category does not exist';\n+\t\t    \tce.updateFilter();\n+\t\t    \tSystem.assertEquals(0, ce.getNumberOfPages(), 'No pages should be found when filtering by a product category that does not exist');\n+\t\t    \tSystem.assertEquals(0, ce.wrappers.size(), 'Page should be empty when filtering by a category not found');\n+\t    \t\n+\t    \tTest.stopTest();\n+\t\t}\n+\t}\n+\t\n+\n+\t/** \n+    \tTEST PAGINATION (Positive case)\n+    \t======================================================================\n+    \tEnsure pagination works correctly when some products/lots are\n+    \tin the database. Checks:\n+    \t- default page is #1\n+    \t- number of items per page\n+    \t- number of pages\n+    \t- prev/next\n+    \t- first/last\n+    \t====================================================================== */\t\n+\tstatic testMethod void testPaginationWithProducts() {\n+\t\t\n+\t\t// Setup users\n+\t\tUser accountManager = TestDataFactory.createUser('Account Managers', 'aManager');\n+\t\tUser inventoryManager = TestDataFactory.createUser('Inventory Managers','iManager');\n+\t\t\n+\t\t// Prepare products\n+\t\tSystem.runAs(inventoryManager) {\n+\t\t\tList<Lot__c> lots = TestDataFactory.createLots(NUMBER_OF_LOTS);\n+\t\t\tinsert lots;\n+\t\t}\n+\t\t\n+\t\t// Create account, controller and start testing\n+\t\tSystem.runAs(accountManager) {\n+\t\t\t\n+\t\t\t// Test data\n+\t\t\tAccount myAccount = TestDataFactory.createAccount();\n+\t    \tinsert myAccount;\n+\t    \tOrder__c myOrder = TestDataFactory.createOrder(myAccount);\n+\t    \tinsert myOrder;\n+\t\t\t\n+\t\t\tTest.startTest();\n+\t\t\t\n+\t\t\t// Create controller    \t\n+\t\t\tApexPages.StandardController sc = new ApexPages.standardController(myOrder);\n+\t    \tPobControllerExt ce = new PobControllerExt(sc);\n+\t    \t\n+\t    \t// Default\n+\t    \tSystem.assertEquals(true, ce.getPrevDisabled(), 'Prev button should be disabled');\n+\t    \tSystem.assertEquals(false, ce.getNextDisabled(), 'Next button should be disabled');\n+\t    \tSystem.assertEquals(3, ce.getNumberOfPages(), '3 pages expected');\n+\t    \tSystem.assertEquals(1, ce.getCurrentPage(), 'Current page is expected to be 1st');\n+\t    \tSystem.assertEquals(5, ce.wrappers.size(), '5 items expected in the page');\n+\t    \t\n+\t\t\t// Next\n+\t\t\tce.nextPage();\n+\t\t\tSystem.assertEquals(false, ce.getPrevDisabled(), 'Prev button should be enabled');\n+\t    \tSystem.assertEquals(false, ce.getNextDisabled(), 'Next button should be enabled');\n+\t\t\tSystem.assertEquals(2, ce.getCurrentPage(), 'Unexpected current page');\n+\t    \tSystem.assertEquals(3, ce.getNumberOfPages(), '3 pages expected');\n+\t    \tSystem.assertEquals(5, ce.wrappers.size(), '5 items expected in the page');\n+\t    \t\n+\t\t\t// Previous\n+\t\t\tce.prevPage();\n+\t    \tSystem.assertEquals(true, ce.getPrevDisabled(), 'Prev button should be disabled');\n+\t    \tSystem.assertEquals(false, ce.getNextDisabled(), 'Next button should be disabled');\n+\t    \tSystem.assertEquals(3, ce.getNumberOfPages(), '3 pages expected');\n+\t    \tSystem.assertEquals(1, ce.getCurrentPage(), 'Current page is expected to be 1st');\n+\t    \tSystem.assertEquals(5, ce.wrappers.size(), '5 items expected in the page');\n+\t    \t\n+\t    \t// Last\n+\t    \tce.lastPage();\n+\t    \tSystem.assertEquals(false, ce.getPrevDisabled(), 'Prev button should be disabled');\n+\t    \tSystem.assertEquals(true, ce.getNextDisabled(), 'Next button should be disabled');\n+\t    \tSystem.assertEquals(3, ce.getNumberOfPages(), '3 pages expected');\n+\t    \tSystem.assertEquals(3, ce.getCurrentPage(), 'Current page is expected to be 3rds');\n+\t    \tSystem.assertEquals(2, ce.wrappers.size(), '2 items expected in the page');\n+\t    \t\n+\t    \t// First\n+\t    \tce.firstPage();\n+\t    \tSystem.assertEquals(true, ce.getPrevDisabled(), 'Prev button should be disabled');\n+\t    \tSystem.assertEquals(false, ce.getNextDisabled(), 'Next button should be disabled');\n+\t    \tSystem.assertEquals(3, ce.getNumberOfPages(), '3 pages expected');\n+\t    \tSystem.assertEquals(1, ce.getCurrentPage(), 'Current page is expected to be 1st');\n+\t    \tSystem.assertEquals(5, ce.wrappers.size(), '5 items expected in the page');\n+\t    \t\n+\t    \tTest.stopTest();\n+\t\t}\n+\t}\n+\n+\t/** \n+    \tTEST PAGINATION (Negative case, no products available)\n+    \t======================================================================\n+    \tEnsure pagination works correctly even if no products are available\n+    \tin the database.\n+    \t====================================================================== */\n+    static testMethod void testPaginationNoProducts() {\n+\t\tUser accountManager = TestDataFactory.createUser('Account Managers', 'aManager');\n+\t\tSystem.runAs(accountManager) {\n+    \t\tTest.startTest();\n+    \t\t\n+    \t\t// Prepare data\n+\t\t\tAccount myAccount = TestDataFactory.createAccount();\n+    \t\tinsert myAccount;\n+    \t\n+    \t\t// Create controller\n+    \t\tOrder__c myOrder = TestDataFactory.createOrder(myAccount);\n+\t\t\tApexPages.StandardController sc = new ApexPages.standardController(myOrder);\n+\t    \tPobControllerExt ce = new PobControllerExt(sc);\n+\t    \t\n+\t    \t// Check pagination buttons\n+\t    \tSystem.assertEquals(true, ce.getPrevDisabled(), 'Prev button should be disabled');\n+\t    \tSystem.assertEquals(true, ce.getNextDisabled(), 'Next button should be disabled');\n+\t    \tSystem.assertEquals(0, ce.getNumberOfPages(), 'No products, no pages expected');\n+\t    \tSystem.assertEquals(1, ce.getCurrentPage(), 'No products, 1 pages expected');\n+\t    \tTest.stopTest();\n+\t\t}\n+    }\n+    \n+    /** \n+    \tTEST PAGE HEADER CORRECTNESS\n+    \t======================================================================\n+    \tEnsure heading is as expected:\n+    \t(1) when creating new orders (label) \n+    \t(2) when updateing existing orders (order name)\n+    \t====================================================================== */\n+    static testMethod void testPageHeading() {\n+    \t\n+    \t// Setup users\n+\t\tUser accountManager = TestDataFactory.createUser('Account Managers', 'aManager');\n+\t\tUser inventoryManager = TestDataFactory.createUser('Inventory Managers','iManager');\n+\t\t\n+\t\tSystem.runAs(inventoryManager) {\n+\t\t\tList<Lot__c> lots = TestDataFactory.createLots(NUMBER_OF_LOTS);\n+    \t\tinsert lots;\n+\t\t}\n+\t\t\n+\t\tTest.startTest();\n+\t\t\n+\t\t// (1) Check heading on new orders\n+\t\tSystem.runAs(accountManager) {\n+\n+\t\t\t// Create transient order\n+\t\t\tAccount myAccount = TestDataFactory.createAccount();\n+    \t\tinsert myAccount;\t\n+\t\t\tOrder__c myOrder = TestDataFactory.createOrder(TEST_ORDER_BUDGET);\n+    \t\tmyOrder.Store__c = myAccount.Id;\n+    \t\t\n+    \t\t// Create controller to edit the new order\n+\t\t\tApexPages.StandardController sc = new ApexPages.standardController(myOrder);\n+\t    \tPobControllerExt ce = new PobControllerExt(sc);\n+\t    \tTest.setCurrentPage(Page.pob);\n+\t    \tSystem.assertEquals(Label.POB_Heading_New, ce.heading, 'Heading is incorrect when creating a new order');\n+\t\t}\n+\t\t\n+\t\t// (2) Check heading on existing orders\n+\t\tSystem.runAs(accountManager) {\n+\t\t\t\n+\t\t\t// Create persisted order\n+\t\t\tAccount myAccount = TestDataFactory.createAccount();\n+    \t\tinsert myAccount;\n+\t\t\tOrder__c myOrder = TestDataFactory.createOrder(TEST_ORDER_BUDGET);\n+    \t\tmyOrder.Store__c = myAccount.Id;\n+    \t\tinsert myOrder;\n+    \t\t\n+    \t\t// Create controller to edit the existing order\n+\t\t\tApexPages.StandardController sc = new ApexPages.standardController(myOrder);\n+\t    \tPobControllerExt ce = new PobControllerExt(sc);\n+\t    \tTest.setCurrentPage(Page.pob);\n+\t    \tSystem.assertEquals(myOrder.name, ce.heading, 'Unexpected heading on Purchase Order Builder');\n+\t\t}\n+\t\t\n+\t\tTest.stopTest();\n+    }\n+    \n+    /** \n+\t\tTEST LOAD AND UPDATE OF AN EXISTING ORDER\n+    \t======================================================================\n+    \tLoad a new order and ensure\n+    \t- (1) order and line items are loaded\n+    \t- (2) on save order and line items are updated \n+    \t====================================================================== */\n+\tstatic testMethod void testLoadAndEditExistingOrder() {\n+\t\t\n+\t\tUser accountManager = TestDataFactory.createUser('Account Managers', 'aManager');\n+\t\tUser inventoryManager = TestDataFactory.createUser('Inventory Managers','iManager');\n+\t\tSet<Id> existingLotIds = new Set<Id>();\n+\t\tList<Lot__c> lots;\n+\t\tOrder__c myOrder;\n+\t\t\n+\t\tSystem.runAs(inventoryManager) {\n+    \t\tlots = TestDataFactory.createLots(4);\n+    \t\tinsert lots;\n+    \t}\n+    \t\n+    \t// Setup account + order with line items\n+    \tSystem.runAs(accountManager) {\n+\t\t\tAccount myAccount = TestDataFactory.createAccount();\n+    \t\tinsert myAccount;\t\n+    \t\tmyOrder = TestDataFactory.createOrder(TEST_ORDER_BUDGET);\n+    \t\tmyOrder.Store__c = myAccount.Id;\n+    \t\tinsert myOrder;\n+    \t\t\n+    \t\t// Prepare 3 line items for this order\n+    \t\tLine_Item__c l1 = TestDataFactory.createLineItem(myOrder, lots[0], 1);\n+    \t\tLine_Item__c l2 = TestDataFactory.createLineItem(myOrder, lots[1], 5);\n+    \t\tLine_Item__c l4 = TestDataFactory.createLineItem(myOrder, lots[3], 1);\n+    \t\tinsert new List<Line_Item__c>{ l1, l2, l4 };\n+    \t\t\n+    \t}\n+    \t\n+    \t// Run tests\n+    \tSystem.runAs(accountManager) {\n+\t\t\tApexPages.StandardController sc = new ApexPages.standardController(myOrder);\n+\t    \tPobControllerExt ce = new PobControllerExt(sc);\n+\t    \t\n+\t    \t// Start test\n+\t    \tTest.setCurrentPage(Page.pob);\n+\t    \tTest.startTest();\n+\t    \t\n+\t    \t// (1) Test page load\n+\t    \tPobControllerExt.Wrapper w1 = ce.getWrapper(lots[0]);\n+\t    \tPobControllerExt.Wrapper w2 = ce.getWrapper(lots[1]);\n+\t    \tPobControllerExt.Wrapper w3 = ce.getWrapper(lots[2]);\n+\t    \tPobControllerExt.Wrapper w4 = ce.getWrapper(lots[3]);\n+\t    \tSystem.assertEquals(1, w1.units, 'Order was not loaded with the right number of units');\n+\t    \tSystem.assertNotEquals(null, w1.lineItem.Id, 'Order was not loaded with the line item');\n+\t    \tSystem.assertEquals(5, w2.units, 'Order was not loaded with the right number of units');\n+\t    \tSystem.assertNotEquals(null, w2.lineItem.Id, 'Order was not loaded with the line item');\n+\t    \tSystem.assertEquals(0, w3.units, 'This line item should be empty');\n+\t    \tSystem.assertEquals(1, w4.units, 'Order was not loaded with the right number of units');\n+\t    \tSystem.assertNotEquals(null, w4.lineItem.Id, 'Order was not loaded with the line item');\n+\t    \t\n+    \t\t\n+    \t\t// (2) edit and save\n+    \t\tce.po.Name = 'Updated order name';\n+    \t\tw1.units = 2;\n+    \t\tw2.units = 0;\n+    \t\tw3.units = 5;\n+    \t\t\n+    \t\t// Save\n+\t        PageReference nextPage = ce.save();\n+\t        System.assertEquals(sc.view().getUrl(), nextPage.getUrl(), 'Unexpected page reference');\n+\t\t\tList<Order__c> orders = [SELECT Id, Name FROM Order__c];\n+\t        List<Line_Item__c> lineItems = [SELECT Id, Order__c, Lot__c, Units__c FROM Line_Item__c];\n+\t        \n+\t        // ensure Order is created with related line items...\n+\t        System.assertEquals(1, orders.size(), 'Unexpected - number of orders created after save is inconsistent');\n+\t        System.assertEquals('Updated order name', orders[0].Name, 'Unexpected order name was expected to be updated');\n+\t        System.assertEquals(myOrder.Id, orders[0].Id, 'Unexpected - order ID has been changed');\n+\t        System.assertEquals(3, lineItems.size(), 'Unexpected - inconsistent number of line items');\n+\t        \n+\t        // Prepare results in a map by lot index\n+\t        Map<Integer, Line_Item__c> resultMap = new Map<Integer, Line_Item__c>();\n+\t        for (Line_Item__c li : lineItems) {\n+\t        \tSystem.assertEquals(myOrder.Id, li.Order__c, 'Unexpected - line item do not match order');\n+\t        \tfor (Integer i=0; i< lots.size(); i++) {\n+\t        \t\tif (li.Lot__c == lots[i].Id) {\n+\t        \t\t\tresultMap.put(i, li);\n+\t        \t\t}\n+\t        \t}\n+\t        }\n+\n+\t\t\t// Check new & updated values: units and record Ids \n+\t        System.assertEquals(2, resultMap.get(0).Units__c, 'Units should have been updated 1->2');\n+\t        System.assertEquals(w1.lineItem.id, resultMap.get(0).Id, 'Record should have been updated not recreated');\n+\t        System.assertEquals(5, resultMap.get(2).Units__c, 'Units should have been 5 (new record)');\n+\t        System.assertEquals(1, resultMap.get(3).Units__c, 'Units should have been 1 (no change)');\n+\t        System.assertEquals(w4.lineItem.id, resultMap.get(3).Id, 'Record should have been updated not recreated');\n+\n+\t    \tTest.stopTest();\n+    \t}\n+    }\n+\n+\t/** \n+\t\tTEST UNIT LASTS WHEN MOVING ACROSS PAGES\n+    \t======================================================================\n+    \tEnsure that selection works correctly in the controller,\n+    \talso when using pagination.\n+    \t====================================================================== */\n+    \n+    static testMethod void testUnitsLastWhenMovingAcrossPages() {\n+    \t\n+    \tUser accountManager = TestDataFactory.createUser('Account Managers', 'aManager');\n+\t\tUser inventoryManager = TestDataFactory.createUser('Inventory Managers','iManager');\n+\t\tList<Lot__c> lots;\n+    \t\n+    \tSystem.runAs(inventoryManager) {\n+    \t\tlots = TestDataFactory.createLots(10);\n+    \t\tinsert lots;\n+    \t}\n+    \t\n+    \tSystem.runAs(accountManager) {\n+    \t\tAccount myAccount = TestDataFactory.createAccount();\n+    \t\tinsert myAccount;\t\n+    \t\t\n+    \t\t// Transient order\n+    \t\tOrder__c myOrder = TestDataFactory.createOrder(TEST_ORDER_BUDGET);\n+    \t\tmyOrder.Store__c = myAccount.Id;\n+    \t\t\n+    \t\t// Create controllers\n+\t    \tApexPages.StandardController sc = new ApexPages.standardController(myOrder);\n+\t    \tPobControllerExt ce = new PobControllerExt(sc);\n+\t    \t\n+\t    \t// Start test\n+\t    \tTest.setCurrentPage(Page.pob);\n+\t    \tTest.startTest();\n+\t    \t\n+\t    \t// Select on the first page...\n+\t    \tce.wrappers[0].units = 10;\n+\t    \tce.wrappers[2].units = 15;\n+\t    \t\n+\t    \t// ...Move on the next page...\n+\t    \tce.nextPage();\n+\t    \tSystem.assertEquals(0, ce.wrappers[0].units, 'Units should be reloaded when moving pages');\n+\t\n+\t\t\t// ... Move back to the previous one and expect units to be still there  \t\n+\t    \tce.prevPage();\n+\t    \tSystem.assertEquals(10, ce.wrappers[0].units, 'Units should not be lost when moving across pages');\n+\t    \tSystem.assertEquals(15, ce.wrappers[2].units, 'Units should not be lost when moving across pages');\n+\t    \t\n+\t    \tTest.stopTest();\n+    \t}\n+    \t\n+    \t\n+    }\n+    \n+\t/** \n+\t\tTEST CREATION OF A NEW ORDER (Positive case)\n+    \t======================================================================\n+    \tCreate a new order and ensure\n+    \t- orders or line items are created \n+    \t- line items refer to the right lots and order\n+    \t- user is redirected to the order detail page \n+    \t====================================================================== */\n+    static testMethod void testCreateNewOrder() {\n+    \t\n+\t\tUser accountManager = TestDataFactory.createUser('Account Managers', 'aManager');\n+\t\tUser inventoryManager = TestDataFactory.createUser('Inventory Managers','iManager');\n+\t\tList<Lot__c> lots;\n+    \t\n+    \tSystem.runAs(inventoryManager) {\n+    \t\tlots = TestDataFactory.createLots(NUMBER_OF_LOTS);\n+    \t\tinsert lots;\n+    \t}\n+    \t\n+    \tSystem.runAs(accountManager) {\n+    \t\tAccount myAccount = TestDataFactory.createAccount();\n+    \t\tinsert myAccount;\t\n+    \t\t\n+    \t\t// Transient order\n+    \t\tOrder__c myOrder = TestDataFactory.createOrder(TEST_ORDER_BUDGET);\n+    \t\tmyOrder.Store__c = myAccount.Id;\n+    \t\t\n+    \t\t// Create controllers\n+\t    \tApexPages.StandardController sc = new ApexPages.standardController(myOrder);\n+\t    \tPobControllerExt ce = new PobControllerExt(sc);\n+\t    \t\n+\t    \t// Start test\n+\t    \tTest.setCurrentPage(Page.pob);\n+\t    \tTest.startTest();\n+\t\n+\t\t\t// Test heading and pagination controls  \t\n+\t    \tSystem.assertEquals(Label.POB_Heading_New, ce.heading, 'Heading is incorrect when creating a new order');\n+\t        System.assertEquals(true, ce.getPrevDisabled(), 'Prev button should be disabled');\n+\t        System.assertEquals(false, ce.getNextDisabled(), 'Prev button should be disabled');\n+\t        \n+\t\t\t// 1) Empty Selection: Check summary and selection\n+\t        System.assertEquals(0, ce.getUnits(), 'Summary error - Unexpected value in number of units');\n+\t        System.assertEquals(null, ce.getPricePerUnit(), 'Summary error - Unexpected value in price per unit');\n+\t        for (PobControllerExt.Wrapper w : ce.wrappersMap.values()) {\n+\t        \tSystem.assertEquals(0, w.units, 'Units should be 0 on an empty order');\n+\t        }\n+\t       \n+\t        // 2) Add a couple of products\n+\t        // check summary and selection\n+\t        ce.getWrapper(ce.wrappers[0].product).units = 2;\n+\t        ce.getWrapper(ce.wrappers[1].product).units = 3;\n+\t        ce.updateSelection();\n+\t        System.assertEquals(2, ce.wrappers[0].units, 'Selection error - Inconsistent number of units');\n+\t        System.assertEquals(3, ce.wrappers[1].units, 'Selection error - Inconsistent number of units');\n+\t        System.assertEquals(5, ce.getUnits(), 'Summary error - Unexpected value in number of units');\n+\t        System.assertEquals(TestDataFactory.TEST_LOT_PRICE, ce.getPricePerUnit(), 'Summary error - Unexpected value in price per unit');\n+\t        \n+\t        // Save\n+\t        PageReference nextPage = ce.save();\n+\t        System.assertNotEquals(null, nextPage, 'Unexpected page reference');\n+\t\t\tList<Order__c> orders = [SELECT Id FROM Order__c];\n+\t        List<Line_Item__c> lineItems = [SELECT Id, Order__c, Lot__c, Units__c FROM Line_Item__c];\n+\t        \n+\t        // 1) ensure Order is created with related line items...\n+\t        System.assertEquals(1, orders.size(), 'Unexpected - number of orders created after save is inconsistent');\n+\t        System.assertEquals(2, lineItems.size(), 'Unexpected - inconsistent number of line items');\n+\t        \n+\t        // 2) Check that line items refer to the right Order__c and Lot__c \n+\t        Boolean firstLotFound = false, secondLotFound = false;\n+\t        for (Line_Item__c li : lineItems) {\n+\t        \tSystem.assertEquals(orders[0].Id, li.Order__c, 'Unexpected - line item do not match order');\n+\t        \tif (li.Lot__c == ce.wrappers[0].product.Id) {\n+\t        \t\tfirstLotFound = true;\n+\t        \t}\n+\t        \tif (li.Lot__c == ce.wrappers[1].product.Id) {\n+\t        \t\tsecondLotFound = true;\n+\t        \t}\n+\t        }\n+\t        System.assertEquals(true, firstLotFound, 'Line items do not refer to product lots');\n+\t        System.assertEquals(true, secondLotFound, 'Line items do not refer to product lots');\n+\t        \n+\t        // End test\n+\t        Test.stopTest();\n+    \t} \n+    }\n+    \n+    \n+    /** \n+    \tTEST ORDER BUDGET VALIDATION\n+    \t======================================================================\n+    \t1) Ensure orders below 100k cannot be created\n+    \t2) Create a new order that is over budget and ensure\n+    \t- no orders or line items are created \n+    \t- the right error message is displayed \n+    \t- user is redirected stays on the same page to re-enter data\n+    \t====================================================================== \n+    */\n+    static testMethod void testBudgetValidation() {\n+    \t\n+    \tUser accountManager = TestDataFactory.createUser('Account Managers', 'aManager');\n+\t\tUser inventoryManager = TestDataFactory.createUser('Inventory Managers','iManager');\n+\t\tLot__c someApples = null, somePears = null;\n+\t\tOrder__c myOrder;\n+    \t\n+    \t// Prepare lots\n+    \tSystem.runAs(inventoryManager) {\n+    \t\tsomeApples = TestDataFactory.createLot(APPLES, 1000);\n+    \t\tsomePears = TestDataFactory.createLot(PEARS, 1);\n+    \t\tinsert new List<Lot__c> { someApples, somePears };\n+    \t}\n+    \t\n+    \t// Create accounts and order\n+    \tSystem.runAs(accountManager) {\n+\t\t    Account myAccount = TestDataFactory.createAccount();\n+\t    \tinsert myAccount;\n+\t    \t\n+\t    \t// 1) Order below 100k\n+\t    \tmyOrder = TestDataFactory.createOrder(10);\n+\t    \tDmlException expected = null;\n+\t    \ttry {\n+\t    \t\tinsert myOrder;\n+\t    \t} catch (DmlException e) {\n+\t    \t\texpected = e;\n+\t    \t}\n+\t    \tSystem.assertNotEquals(null, expected, 'Should not be able to create orders below 100k');\n+\t    \tSystem.assertEquals(0, [SELECT Id FROM Order__c].size(), 'No order should be created');\n+\t    \t\n+\t    \t\n+\t    \t// 2) Budget is 100k\n+\t    \tmyOrder = TestDataFactory.createOrder(100000);\n+\t    \tmyOrder.Store__c = myAccount.Id;\n+    \t}\n+    \t\n+    \t// Create controllers and start test\n+    \tSystem.runAs(accountManager) {\n+\t    \tApexPages.StandardController sc = new ApexPages.standardController(myOrder);\n+\t    \tPobControllerExt ce = new PobControllerExt(sc);\n+\t    \tTest.setCurrentPage(Page.pob);\n+\t    \tTest.startTest();\n+\t    \t\n+\t    \t\t// Set quantities & hit save\n+\t    \t\t// These quantities will make the order go over budget (100001k)\n+\t    \t\tce.getWrapper(someApples).units = 300;\n+\t    \t\tce.getWrapper(somePears).units = 1;\n+\t    \t\tce.updateSelection();\n+\t\t        PageReference nextPage = ce.save();\n+\t\t        \n+\t\t        // Verify results\n+\t\t        System.assertEquals(null, nextPage, 'Unexpected page reference, validation error expected here');\n+\t\t        ApexPages.currentPage().getParameters().put('hasError','true');  \n+\t\t    \tSystem.assertEquals(true, ApexPages.getMessages().size()>0, 'Unexpected - error messages expected');\n+\t\t    \tBoolean expectedMessageFound = false;\n+\t\t    \tfor (ApexPages.Message m : ApexPages.getMessages()) {\n+\t\t    \t\tif (m.getDetail().contains('Purchased exceeds budget')) {\n+\t\t    \t\t\texpectedMessageFound = true;\n+\t\t    \t\t}\n+\t\t    \t}\n+\t\t    \tSystem.assertEquals(true, expectedMessageFound, 'Unexpected error message');\n+\t\t        List<Order__c> orders = [SELECT Id FROM Order__c];\n+\t\t        List<Line_Item__c> lineItems = [SELECT Id, Order__c, Lot__c, Units__c FROM Line_Item__c];\n+\t\t        System.assertEquals(0, orders.size(), 'Transaction rollback expected here. No order shoud be created on errors');\n+\t\t        System.assertEquals(0, lineItems.size(), 'No line items should be created on errors');\n+\t\t        \n+\t    \tTest.stopTest();\n+    \t}\n+    }\n+    \n+\t/** \n+    \tTEST VALIDATION ON MISSING STORES\n+    \t====================================================================== \n+    \tCreate a new order that is not related to any store, ensure\n+    \t- no orders or line items are created \n+    \t- an error message is displayed\n+    \t- user is redirected stays on the same page to re-enter data\n+    \t====================================================================== */\n+    static testMethod void testMissingStoreValidation() {\n+    \t\n+    \tUser accountManager = TestDataFactory.createUser('Account Managers', 'aManager');\n+\t\tUser inventoryManager = TestDataFactory.createUser('Inventory Managers','iManager');\n+\t\tLot__c someApples = null, somePears = null;\n+\t\tOrder__c myOrder;\n+    \t\n+    \t// Prepare lots\n+    \tSystem.runAs(inventoryManager) {\n+    \t\tsomeApples = TestDataFactory.createLot(APPLES, 1000);\n+    \t\tsomePears = TestDataFactory.createLot(PEARS, 1);\n+    \t\tinsert new List<Lot__c> { someApples, somePears };\n+    \t}\n+    \t\n+    \t// Create accounts and order\n+    \tSystem.runAs(accountManager) {\n+\t\t    Account myAccount = TestDataFactory.createAccount();\n+\t    \tinsert myAccount;\n+\t    \t\n+\t    \t// Order with null store\n+\t    \tmyOrder = TestDataFactory.createOrder(100000);\n+\t    \tmyOrder.Store__c = null;\n+    \t}\n+    \t\n+    \t// Create controllers and start test\n+    \tSystem.runAs(accountManager) {\n+\t    \tApexPages.StandardController sc = new ApexPages.standardController(myOrder);\n+\t    \tPobControllerExt ce = new PobControllerExt(sc);\n+\t    \tTest.setCurrentPage(Page.pob);\n+\t    \tTest.startTest();\n+\t    \t\n+\t    \t\t// Set quantities & hit save\n+\t    \t\tce.getWrapper(someApples).units = 10;\n+\t    \t\tce.getWrapper(somePears).units = 1;\n+\t    \t\tce.updateSelection();\n+\t\t        PageReference nextPage = ce.save();\n+\t\t        \n+\t\t        // Verify results\n+\t\t        System.assertEquals(null, nextPage, 'Unexpected page reference, validation error expected here');\n+\t\t        ApexPages.currentPage().getParameters().put('hasError','true');  \n+\t\t    \tSystem.assertEquals(true, ApexPages.getMessages().size()>0, 'Unexpected - error messages expected');\n+\t\t        List<Order__c> orders = [SELECT Id FROM Order__c];\n+\t\t        List<Line_Item__c> lineItems = [SELECT Id, Order__c, Lot__c, Units__c FROM Line_Item__c];\n+\t\t        System.assertEquals(0, orders.size(), 'Transaction rollback expected here. No order shoud be created on errors');\n+\t\t        System.assertEquals(0, lineItems.size(), 'No line items should be created on errors');\n+\t\t        \n+\t    \tTest.stopTest();\n+    \t}\n+    }\n+    \n+    /** \n+    \tTEST FIELD EDITABILITY (New Orders)\n+    \t=========================================================================== \n+    \tEditability of the Name, Status, Budget fields in the Purchase Order \n+    \tBuilder page depents on the status of the order. \n+    \tNOTE: the editability of the Store field does not have to be tested \n+    \tas it's a non-reparentable relationship and editability is managed by\n+    \tthe <apex:inputField> tag \n+    \t=========================================================================== */\n+    static testMethod void testFieldsEditabilityOnNewOrder() {\n+    \t\n+    \tUser accountManager = TestDataFactory.createUser('Account Managers', 'aManager');\n+    \tSystem.runAs(accountManager) {\n+\n+\t\t\t// Setup data (transient order)\t\n+    \t\tAccount myAccount = TestDataFactory.createAccount();\n+    \t\tinsert myAccount;\t\n+    \t\tOrder__c myOrder = TestDataFactory.createOrder(TEST_ORDER_BUDGET);\n+    \t\tmyOrder.Store__c = myAccount.Id;\n+    \t\t\n+    \t\t// Create controllers\n+\t    \tApexPages.StandardController sc = new ApexPages.standardController(myOrder);\n+\t    \tPobControllerExt ce = new PobControllerExt(sc);\n+\t    \t\n+\t    \t// Start test\n+\t    \tTest.setCurrentPage(Page.pob);\n+\t    \tTest.startTest();\n+\t    \t\n+\t    \t\tce.po.Status__c = 'Draft';\n+\t    \t\tSystem.assertEquals(true, ce.getNameIsEditable() ,'All fields should be editable when creating a new order');\n+\t    \t\tSystem.assertEquals(true, ce.getBudgetIsEditable() ,'All fields should be editable when creating a new order');\n+\t    \t\tSystem.assertEquals(true, ce.getStatusIsEditable() ,'All fields should be editable when creating a new order');\n+\t    \t\tSystem.assertEquals(true, ce.getUnitsAreEditable() ,'All fields should be editable when creating a new order');\n+\t    \t\t\n+\t    \t\tce.po.Status__c = 'Open';\n+\t    \t\tSystem.assertEquals(true, ce.getNameIsEditable() ,'All fields should be editable when creating a new order');\n+\t    \t\tSystem.assertEquals(true, ce.getBudgetIsEditable() ,'All fields should be editable when creating a new order');\n+\t    \t\tSystem.assertEquals(true, ce.getStatusIsEditable() ,'All fields should be editable when creating a new order');\n+\t    \t\tSystem.assertEquals(true, ce.getUnitsAreEditable() ,'All fields should be editable when creating a new order');\n+\t    \t\t\n+\t    \t\tce.po.Status__c = 'Closed';\n+\t    \t\tSystem.assertEquals(true, ce.getNameIsEditable() ,'All fields should be editable when creating a new order');\n+\t    \t\tSystem.assertEquals(true, ce.getBudgetIsEditable() ,'All fields should be editable when creating a new order');\n+\t    \t\tSystem.assertEquals(true, ce.getStatusIsEditable() ,'All fields should be editable when creating a new order');\n+\t    \t\tSystem.assertEquals(true, ce.getUnitsAreEditable() ,'All fields should be editable when creating a new order');\n+\t    \t\t\n+\t    \tTest.stopTest();\n+    \t}\n+    }\n+\n+\t/** \n+    \tTEST FIELD EDITABILITY (Existing orders)\n+    \t=========================================================================== \n+    \tEditability of the Name, Status, Budget fields in the Purchase Order \n+    \tBuilder page depents on the status of the order. \n+    \tNOTE: the editability of the Store field does not have to be tested \n+    \tas it's a non-reparentable relationship and editability is managed by\n+    \tthe <apex:inputField> tag \n+    \t=========================================================================== */\n+    static testMethod void testFieldsEditabilityOnExistingOrders() {","path":"src/classes/PobControllerExtTest.cls","position":733,"original_position":733,"commit_id":"0526621cf37232b90915be49d86246f330faae34","original_commit_id":"0526621cf37232b90915be49d86246f330faae34","user":{"login":"eroispaziali","id":1273282,"avatar_url":"https://avatars.githubusercontent.com/u/1273282?v=3","gravatar_id":"","url":"https://api.github.com/users/eroispaziali","html_url":"https://github.com/eroispaziali","followers_url":"https://api.github.com/users/eroispaziali/followers","following_url":"https://api.github.com/users/eroispaziali/following{/other_user}","gists_url":"https://api.github.com/users/eroispaziali/gists{/gist_id}","starred_url":"https://api.github.com/users/eroispaziali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eroispaziali/subscriptions","organizations_url":"https://api.github.com/users/eroispaziali/orgs","repos_url":"https://api.github.com/users/eroispaziali/repos","events_url":"https://api.github.com/users/eroispaziali/events{/privacy}","received_events_url":"https://api.github.com/users/eroispaziali/received_events","type":"User","site_admin":false},"body":"Style issue: test methods should be annotated with IsTest for better readability","created_at":"2016-05-02T10:49:11Z","updated_at":"2016-05-02T10:49:11Z","html_url":"https://github.com/eroispaziali/my-awesome-app/pull/1#discussion_r61725330","pull_request_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/eroispaziali/my-awesome-app/pulls/comments/61725330"},"html":{"href":"https://github.com/eroispaziali/my-awesome-app/pull/1#discussion_r61725330"},"pull_request":{"href":"https://api.github.com/repos/eroispaziali/my-awesome-app/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/eroispaziali/my-awesome-app/pulls/1","id":68394285,"html_url":"https://github.com/eroispaziali/my-awesome-app/pull/1","diff_url":"https://github.com/eroispaziali/my-awesome-app/pull/1.diff","patch_url":"https://github.com/eroispaziali/my-awesome-app/pull/1.patch","issue_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/issues/1","number":1,"state":"open","locked":false,"title":"Big, chunky additions.","user":{"login":"eroispaziali","id":1273282,"avatar_url":"https://avatars.githubusercontent.com/u/1273282?v=3","gravatar_id":"","url":"https://api.github.com/users/eroispaziali","html_url":"https://github.com/eroispaziali","followers_url":"https://api.github.com/users/eroispaziali/followers","following_url":"https://api.github.com/users/eroispaziali/following{/other_user}","gists_url":"https://api.github.com/users/eroispaziali/gists{/gist_id}","starred_url":"https://api.github.com/users/eroispaziali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eroispaziali/subscriptions","organizations_url":"https://api.github.com/users/eroispaziali/orgs","repos_url":"https://api.github.com/users/eroispaziali/repos","events_url":"https://api.github.com/users/eroispaziali/events{/privacy}","received_events_url":"https://api.github.com/users/eroispaziali/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-29T16:00:10Z","updated_at":"2016-05-02T10:49:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"02fafe5850702ff330b444dece8ce62408780eba","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/pulls/1/commits","review_comments_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/pulls/1/comments","review_comment_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/issues/1/comments","statuses_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/statuses/0526621cf37232b90915be49d86246f330faae34","head":{"label":"eroispaziali:trunk","ref":"trunk","sha":"0526621cf37232b90915be49d86246f330faae34","user":{"login":"eroispaziali","id":1273282,"avatar_url":"https://avatars.githubusercontent.com/u/1273282?v=3","gravatar_id":"","url":"https://api.github.com/users/eroispaziali","html_url":"https://github.com/eroispaziali","followers_url":"https://api.github.com/users/eroispaziali/followers","following_url":"https://api.github.com/users/eroispaziali/following{/other_user}","gists_url":"https://api.github.com/users/eroispaziali/gists{/gist_id}","starred_url":"https://api.github.com/users/eroispaziali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eroispaziali/subscriptions","organizations_url":"https://api.github.com/users/eroispaziali/orgs","repos_url":"https://api.github.com/users/eroispaziali/repos","events_url":"https://api.github.com/users/eroispaziali/events{/privacy}","received_events_url":"https://api.github.com/users/eroispaziali/received_events","type":"User","site_admin":false},"repo":{"id":57395407,"name":"my-awesome-app","full_name":"eroispaziali/my-awesome-app","owner":{"login":"eroispaziali","id":1273282,"avatar_url":"https://avatars.githubusercontent.com/u/1273282?v=3","gravatar_id":"","url":"https://api.github.com/users/eroispaziali","html_url":"https://github.com/eroispaziali","followers_url":"https://api.github.com/users/eroispaziali/followers","following_url":"https://api.github.com/users/eroispaziali/following{/other_user}","gists_url":"https://api.github.com/users/eroispaziali/gists{/gist_id}","starred_url":"https://api.github.com/users/eroispaziali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eroispaziali/subscriptions","organizations_url":"https://api.github.com/users/eroispaziali/orgs","repos_url":"https://api.github.com/users/eroispaziali/repos","events_url":"https://api.github.com/users/eroispaziali/events{/privacy}","received_events_url":"https://api.github.com/users/eroispaziali/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eroispaziali/my-awesome-app","description":"Clayton demo app.","fork":false,"url":"https://api.github.com/repos/eroispaziali/my-awesome-app","forks_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/forks","keys_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/teams","hooks_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/hooks","issue_events_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/issues/events{/number}","events_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/events","assignees_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/assignees{/user}","branches_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/branches{/branch}","tags_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/tags","blobs_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/git/refs{/sha}","trees_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/statuses/{sha}","languages_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/languages","stargazers_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/stargazers","contributors_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/contributors","subscribers_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/subscribers","subscription_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/subscription","commits_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/commits{/sha}","git_commits_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/git/commits{/sha}","comments_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/comments{/number}","issue_comment_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/issues/comments{/number}","contents_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/contents/{+path}","compare_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/merges","archive_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/downloads","issues_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/issues{/number}","pulls_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/pulls{/number}","milestones_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/milestones{/number}","notifications_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/labels{/name}","releases_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/releases{/id}","deployments_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/deployments","created_at":"2016-04-29T15:41:45Z","updated_at":"2016-05-02T10:46:42Z","pushed_at":"2016-04-30T00:09:13Z","git_url":"git://github.com/eroispaziali/my-awesome-app.git","ssh_url":"git@github.com:eroispaziali/my-awesome-app.git","clone_url":"https://github.com/eroispaziali/my-awesome-app.git","svn_url":"https://github.com/eroispaziali/my-awesome-app","homepage":"","size":20,"stargazers_count":0,"watchers_count":0,"language":"Apex","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"trunk"}},"base":{"label":"eroispaziali:master","ref":"master","sha":"e9ba4a5bc8ef93b4b8b678d1fb8d92f8cc8c2d3d","user":{"login":"eroispaziali","id":1273282,"avatar_url":"https://avatars.githubusercontent.com/u/1273282?v=3","gravatar_id":"","url":"https://api.github.com/users/eroispaziali","html_url":"https://github.com/eroispaziali","followers_url":"https://api.github.com/users/eroispaziali/followers","following_url":"https://api.github.com/users/eroispaziali/following{/other_user}","gists_url":"https://api.github.com/users/eroispaziali/gists{/gist_id}","starred_url":"https://api.github.com/users/eroispaziali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eroispaziali/subscriptions","organizations_url":"https://api.github.com/users/eroispaziali/orgs","repos_url":"https://api.github.com/users/eroispaziali/repos","events_url":"https://api.github.com/users/eroispaziali/events{/privacy}","received_events_url":"https://api.github.com/users/eroispaziali/received_events","type":"User","site_admin":false},"repo":{"id":57395407,"name":"my-awesome-app","full_name":"eroispaziali/my-awesome-app","owner":{"login":"eroispaziali","id":1273282,"avatar_url":"https://avatars.githubusercontent.com/u/1273282?v=3","gravatar_id":"","url":"https://api.github.com/users/eroispaziali","html_url":"https://github.com/eroispaziali","followers_url":"https://api.github.com/users/eroispaziali/followers","following_url":"https://api.github.com/users/eroispaziali/following{/other_user}","gists_url":"https://api.github.com/users/eroispaziali/gists{/gist_id}","starred_url":"https://api.github.com/users/eroispaziali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eroispaziali/subscriptions","organizations_url":"https://api.github.com/users/eroispaziali/orgs","repos_url":"https://api.github.com/users/eroispaziali/repos","events_url":"https://api.github.com/users/eroispaziali/events{/privacy}","received_events_url":"https://api.github.com/users/eroispaziali/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eroispaziali/my-awesome-app","description":"Clayton demo app.","fork":false,"url":"https://api.github.com/repos/eroispaziali/my-awesome-app","forks_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/forks","keys_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/teams","hooks_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/hooks","issue_events_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/issues/events{/number}","events_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/events","assignees_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/assignees{/user}","branches_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/branches{/branch}","tags_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/tags","blobs_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/git/refs{/sha}","trees_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/statuses/{sha}","languages_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/languages","stargazers_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/stargazers","contributors_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/contributors","subscribers_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/subscribers","subscription_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/subscription","commits_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/commits{/sha}","git_commits_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/git/commits{/sha}","comments_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/comments{/number}","issue_comment_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/issues/comments{/number}","contents_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/contents/{+path}","compare_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/merges","archive_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/downloads","issues_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/issues{/number}","pulls_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/pulls{/number}","milestones_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/milestones{/number}","notifications_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/labels{/name}","releases_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/releases{/id}","deployments_url":"https://api.github.com/repos/eroispaziali/my-awesome-app/deployments","created_at":"2016-04-29T15:41:45Z","updated_at":"2016-05-02T10:46:42Z","pushed_at":"2016-04-30T00:09:13Z","git_url":"git://github.com/eroispaziali/my-awesome-app.git","ssh_url":"git@github.com:eroispaziali/my-awesome-app.git","clone_url":"https://github.com/eroispaziali/my-awesome-app.git","svn_url":"https://github.com/eroispaziali/my-awesome-app","homepage":"","size":20,"stargazers_count":0,"watchers_count":0,"language":"Apex","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/eroispaziali/my-awesome-app/pulls/1"},"html":{"href":"https://github.com/eroispaziali/my-awesome-app/pull/1"},"issue":{"href":"https://api.github.com/repos/eroispaziali/my-awesome-app/issues/1"},"comments":{"href":"https://api.github.com/repos/eroispaziali/my-awesome-app/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/eroispaziali/my-awesome-app/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/eroispaziali/my-awesome-app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eroispaziali/my-awesome-app/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/eroispaziali/my-awesome-app/statuses/0526621cf37232b90915be49d86246f330faae34"}}}}