diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/OfficeIntegrationsTest b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/OfficeIntegrationsTest index bb004202c..f59d92ff0 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/OfficeIntegrationsTest +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/OfficeIntegrationsTest @@ -23,6 +23,7 @@ import com.jayway.restassured.specification.RequestSpecification; import com.jayway.restassured.specification.ResponseSpecification; import java.util.*; + public class OfficeIntegrationsTest { private ResponseSpecification statusOkResponseSpec; @@ -37,24 +38,24 @@ public class OfficeIntegrationsTest { } @Test - public void testCreateOffice() - { + public void testCreateOffice() { int random_array = {1997, 26, 12}; OfficeHelper oh = OfficeHelper // oh ---> Office Helper - .create(Utils.randomNameGenerator("", 5)) - .externalId(Utils.randomNameGenerator("offices-", 7)) - .nameDecorated(Utils.randomNameGenerator("", 8)) - .openingDate(random_array) - .hierarchy(".") - .build(); + .create(Utils.randomNameGenerator("", 5)) + .externalId(Utils.randomNameGenerator("offices-", 7)) + .nameDecorated(Utils.randomNameGenerator("", 8)) + .openingDate(random_array) + .hierarchy(".") + .build(); String JsonData = oh.toJSON(); final Long officeID = createOfficeID(JsonData, this.requestSpec, this.statusOkResponseSpec); Assert.assertNotNull(officeID); } + private Long createOffice(final String officeJSON, - final RequestSpecification requestSpec, - final ResponseSpecification responseSpec) { + final RequestSpecification requestSpec, + final ResponseSpecification responseSpec) { String officeId = String.valueOf(OfficeResourceHandler.createOffice(officeJSON, requestSpec, responseSpec)); if (officeId.equals("null")) { // Invalid JSON data parameters @@ -64,48 +65,48 @@ public class OfficeIntegrationsTest { return new Long(officeId); @Test - public void testCreateOfficeWithEmptyName() + public void testCreateOfficeWithEmptyName () { int random_array = {2000, 4, 8}; OfficeHelper oh = new OfficeHelper - .create(null) - .externalId(Utils.randomNameGenerator("",5)) - .nameDecorated(Utils.randomNameGenerator("offices-", 6)) - .openingDate(random_array) - .hierarchy(".") - .build(); + .create(null) + .externalId(Utils.randomNameGenerator("", 5)) + .nameDecorated(Utils.randomNameGenerator("offices-", 6)) + .openingDate(random_array) + .hierarchy(".") + .build(); String JsonData = oh.toJSON(); final Long officeID = createOfficeID(JsonData, this.requestSpec, this.statusOkResponseSpec); Assert.assertNull(officeID); } @Test - public void testCreateOfficeWithEmptyExternalId() + public void testCreateOfficeWithEmptyExternalId () { int random_array = {2005, 1, 1}; OfficeHelper oh = new OfficeHelper - .create(Utils.randomNameGenerator("", 3)) - .externalId(null) - .nameDecorated(Utils.randomNameGenerator("offices-",5)) - .openingDate(random_array) - .hierarchy(".") - .build(); + .create(Utils.randomNameGenerator("", 3)) + .externalId(null) + .nameDecorated(Utils.randomNameGenerator("offices-", 5)) + .openingDate(random_array) + .hierarchy(".") + .build(); String JsonData = oh.toJSON(); final Long OfficeID = createOfficeID(JsonData, this.requestSpec, this.statusOkResponseSpec); Assert.assertNotNull(OfficeID); } @Test - public void testCreateOfficeWithDuplicateName() + public void testCreateOfficeWithDuplicateName () { int random_array1 = {1998, 12, 10}; OfficeHelper oh1 = new OfficeHelper - .create(Utils.randomNameGenerator("", 7)) - .externalId(Utils.randomNameGenerator("Offices-", 4)) - .nameDecorated(Utils.randomNameGenerator("",10)) - .openingDate(random_array1) - .hierarchy(".") - .build(); + .create(Utils.randomNameGenerator("", 7)) + .externalId(Utils.randomNameGenerator("Offices-", 4)) + .nameDecorated(Utils.randomNameGenerator("", 10)) + .openingDate(random_array1) + .hierarchy(".") + .build(); String JsonData = oh1.toJSON(); final Long OfficeID1 = createOfficeID(JsonData, this.requestSpec, this.statusOkResponseSpec); Assert.assertNotNull(OfficeID); @@ -114,7 +115,7 @@ public class OfficeIntegrationsTest { OfficeHelper oh2 = new OfficeHelper .create(Utils.randomNameGenerator("", 7)) .externalId(Utils.randomNameGenerator(oh.getName())) - .nameDecorated(Utils.randomNameGenerator("",11)) + .nameDecorated(Utils.randomNameGenerator("", 11)) .openingDate(random_array2) .hierarchy(".") .build(); @@ -126,13 +127,13 @@ public class OfficeIntegrationsTest { } @Test - public void testCreateOfficeWithDuplicateExternalId() + public void testCreateOfficeWithDuplicateExternalId () { int random_array1 = {2003, 2, 2}; OfficeHelper oh1 = new OfficeHelper .create(Utils.randomNameGenerator("", 8)) .externalId(oh1.getExternalId()) - .nameDecorated(Utils.randomNameGenerator("",10)) + .nameDecorated(Utils.randomNameGenerator("", 10)) .openingDate(random_array1) .hierarchy(".") .build(); @@ -145,7 +146,7 @@ public class OfficeIntegrationsTest { OfficeHelper oh2 = new OfficeHelper .create(Utils.randomNameGenerator("", 9)) .externalId(Utils.randomNameGenerator("Offices-", 5)) - .nameDecorated(Utils.randomNameGenerator("",11)) + .nameDecorated(Utils.randomNameGenerator("", 11)) .openingDate(random_array2) .hierarchy(".") .build(); @@ -159,12 +160,12 @@ public class OfficeIntegrationsTest { } @Test - public void testCreateOfficeWithEmptyOpeningDate() + public void testCreateOfficeWithEmptyOpeningDate () { OfficeHelper oh = new OfficeHelper - .create(Utils.randomNameGenerator("",9)) - .externalId(Utils.randomNameGenerator("Offices-",4)) - .nameDecorated(Utils.randomNameGenerator("",3)) + .create(Utils.randomNameGenerator("", 9)) + .externalId(Utils.randomNameGenerator("Offices-", 4)) + .nameDecorated(Utils.randomNameGenerator("", 3)) .openingDate(null) .hierarchy(".") .build(); @@ -175,7 +176,7 @@ public class OfficeIntegrationsTest { } @Test - public void testNameUnknowForNow() + public void testNameUnknowForNow () { OfficeHelper oh = new OfficeHelper .create() @@ -187,5 +188,5 @@ public class OfficeIntegrationsTest { } -} + } }