diff --git a/pom.xml b/pom.xml index 512a114..eedf608 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ unlogged-sdk video.bug - 0.1.36 + 0.1.37 org.springframework.boot diff --git a/src/main/java/org/unlogged/demo/repository/CustomerProfileRepository.java b/src/main/java/org/unlogged/demo/repository/CustomerProfileRepository.java index 9a3922e..7a4ddc1 100644 --- a/src/main/java/org/unlogged/demo/repository/CustomerProfileRepository.java +++ b/src/main/java/org/unlogged/demo/repository/CustomerProfileRepository.java @@ -106,8 +106,4 @@ public List getInternationalCustomers() { "4678251601", "Hella, Iceland", referralCodes); return customerProfiles; } - - public void throwSomeException() { - String a = "a".split(" ")[12]; - } } diff --git a/src/main/java/org/unlogged/demo/service/CustomerService.java b/src/main/java/org/unlogged/demo/service/CustomerService.java index ebc7f89..b7d830d 100644 --- a/src/main/java/org/unlogged/demo/service/CustomerService.java +++ b/src/main/java/org/unlogged/demo/service/CustomerService.java @@ -76,7 +76,9 @@ public CustomerScoreCard isCustomerEligibleForPremium(long customerID) { public List filterEligbleCustomers(List customers, boolean asiaFlow) { List eligibleCustomers = new ArrayList<>(); - eligibleCustomers = customerProfileRepository.getAsianCustomers(); + if (asiaFlow) { + customers = customerProfileRepository.getAsianCustomers(); + } if (asiaFlow) { for (CustomerProfile customer : customers) { int bonus = 0; diff --git a/src/test/resources/unlogged/java.util.TreeMap.json b/src/test/resources/unlogged/java.util.TreeMap.json new file mode 100644 index 0000000..1737c73 --- /dev/null +++ b/src/test/resources/unlogged/java.util.TreeMap.json @@ -0,0 +1,28 @@ +{ + "classname" : "java.util.TreeMap", + "storedCandidateMap" : { }, + "declaredMockMap" : { + "java.util.TreeMap#get#(Ljava/lang/Object;)Ljava/lang/Object;" : [ { + "id" : "ccb05a27-9329-4d92-aef5-829acb250665", + "name" : "cpr1 - get mock profile", + "fieldTypeName" : "java.util.TreeMap", + "sourceClassName" : "org.unlogged.demo.repository.CustomerProfileRepository", + "fieldName" : "profileTreeMap", + "methodName" : "get", + "whenParameter" : [ { + "name" : "key", + "type" : "ANY_OF_TYPE", + "value" : "long" + } ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "{\"customerid\": 0, \"customername\": \"string\", \"dateofbirth\": \"string\", \"email\": \"string\", \"contactnumber\": \"string\", \"address\": \"string\", \"referralcodes\": [\"string\"]}", + "returnValueType" : "REAL", + "className" : "org.unlogged.demo.models.CustomerProfile" + }, + "methodExitType" : "NORMAL" + } ] + } ] + } +} \ No newline at end of file diff --git a/src/test/resources/unlogged/org.springframework.data.repository.CrudRepository.json b/src/test/resources/unlogged/org.springframework.data.repository.CrudRepository.json new file mode 100644 index 0000000..8990e78 --- /dev/null +++ b/src/test/resources/unlogged/org.springframework.data.repository.CrudRepository.json @@ -0,0 +1,28 @@ +{ + "classname" : "org.springframework.data.repository.CrudRepository", + "storedCandidateMap" : { }, + "declaredMockMap" : { + "org.springframework.data.repository.CrudRepository#save#(Ljava/lang/Object;)Ljava/lang/Object;" : [ { + "id" : "a26748e0-50b1-4b4e-81c4-4efe75ebf3e7", + "name" : "cr - save customer profile", + "fieldTypeName" : "org.springframework.data.repository.CrudRepository", + "sourceClassName" : "org.unlogged.demo.service.CustomerService", + "fieldName" : "repo", + "methodName" : "save", + "whenParameter" : [ { + "name" : "entity", + "type" : "ANY_OF_TYPE", + "value" : "org.unlogged.demo.models.CustomerProfile" + } ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "{\"customerid\": 0, \"customername\": \"string\", \"dateofbirth\": \"string\", \"email\": \"string\", \"contactnumber\": \"string\", \"address\": \"string\", \"referralcodes\": [\"string\"]}", + "returnValueType" : "REAL", + "className" : "org.unlogged.demo.models.CustomerProfile" + }, + "methodExitType" : "NORMAL" + } ] + } ] + } +} \ No newline at end of file diff --git a/src/test/resources/unlogged/org.unlogged.demo.controller.CustomerController.json b/src/test/resources/unlogged/org.unlogged.demo.controller.CustomerController.json new file mode 100644 index 0000000..7ee050f --- /dev/null +++ b/src/test/resources/unlogged/org.unlogged.demo.controller.CustomerController.json @@ -0,0 +1,206 @@ +{ + "classname" : "org.unlogged.demo.controller.CustomerController", + "storedCandidateMap" : { + "org.unlogged.demo.controller.CustomerController#saveCustomerProfile#(Lorg/unlogged/demo/models/CustomerProfileRequest;)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "lineNumbers" : [ 29 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "id" : "4a05383c-97f5-4cc4-bb79-c45f086020ea", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "474a3da8-36e4-4af1-90f4-abb4f5e86792", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "c3ea745d-aa05-44de-9f55-ddf7eb4a697e", + "name" : "save customer 0", + "description" : "should pass", + "methodArguments" : [ "{\"customerName\":\"string\",\"dateOfBirth\":\"string\",\"email\":\"string\",\"primaryNumber\":\"string\",\"address\":\"string\",\"codes\":[\"string\"]}" ], + "returnValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "returnValueClassname" : "org.unlogged.demo.models.CustomerProfile", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703576622614, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : 542951060, + "probSerializedValue" : "eyJjdXN0b21lcmlkIjowLCJjdXN0b21lcm5hbWUiOiJzdHJpbmciLCJkYXRlb2ZiaXJ0aCI6InN0cmluZyIsImVtYWlsIjoic3RyaW5nIiwiY29udGFjdG51bWJlciI6InN0cmluZyIsImFkZHJlc3MiOiJzdHJpbmciLCJyZWZlcnJhbGNvZGVzIjpbInN0cmluZyJdfQ==", + "mockIds" : [ "cf87ae24-a734-4b87-9302-71b4e40e3bfa" ], + "exception" : false, + "method" : { + "name" : "saveCustomerProfile", + "signature" : "(Lorg/unlogged/demo/models/CustomerProfileRequest;)Lorg/unlogged/demo/models/CustomerProfile;", + "className" : "org.unlogged.demo.controller.CustomerController", + "methodHash" : -916697858 + } + } ], + "org.unlogged.demo.controller.CustomerController#generateNeReferralCode#(J)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "lineNumbers" : [ 39 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"code-1\",\"code-2\"]}", + "id" : "060da5e3-9a81-4fce-a1f2-3730804d415e", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "310e7b9f-9ded-4826-93cb-650879e1231d", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "c6a9813a-f2e8-4c4f-8353-6521b6923acf", + "name" : "add referral code for customer", + "description" : "should pass", + "methodArguments" : [ "0" ], + "returnValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"code-1\",\"code-2\"]}", + "returnValueClassname" : "org.unlogged.demo.models.CustomerProfile", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703576748845, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : 453595400, + "probSerializedValue" : "eyJjdXN0b21lcmlkIjowLCJjdXN0b21lcm5hbWUiOiJzdHJpbmciLCJkYXRlb2ZiaXJ0aCI6InN0cmluZyIsImVtYWlsIjoic3RyaW5nIiwiY29udGFjdG51bWJlciI6InN0cmluZyIsImFkZHJlc3MiOiJzdHJpbmciLCJyZWZlcnJhbGNvZGVzIjpbImNvZGUtMSIsImNvZGUtMiJdfQ==", + "mockIds" : [ "077b0593-8e95-4132-a552-ad171ba1633c" ], + "exception" : false, + "method" : { + "name" : "generateNeReferralCode", + "signature" : "(J)Lorg/unlogged/demo/models/CustomerProfile;", + "className" : "org.unlogged.demo.controller.CustomerController", + "methodHash" : -732548036 + } + } ], + "org.unlogged.demo.controller.CustomerController#isCustomerEligibleForLoyaltyProgram#(J)Lorg/unlogged/demo/models/CustomerScoreCard;" : [ { + "lineNumbers" : [ 43 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "{\"customerProfile\":{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]},\"score\":50,\"isEligible\":true}", + "id" : "536a3182-478d-4cd9-9961-e6d02fb112ab", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "8f8e78cb-d278-4ebb-8a21-b9e8ee169018", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "64249160-5a61-49e2-98c4-148b09d8cbc5", + "name" : "customer 0 should be eligible", + "description" : "should pass", + "methodArguments" : [ "0" ], + "returnValue" : "{\"customerProfile\":{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]},\"score\":50,\"isEligible\":true}", + "returnValueClassname" : "org.unlogged.demo.models.CustomerScoreCard", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703576805039, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : 1276962101, + "probSerializedValue" : "eyJjdXN0b21lclByb2ZpbGUiOnsiY3VzdG9tZXJpZCI6MCwiY3VzdG9tZXJuYW1lIjoic3RyaW5nIiwiZGF0ZW9mYmlydGgiOiJzdHJpbmciLCJlbWFpbCI6InN0cmluZyIsImNvbnRhY3RudW1iZXIiOiJzdHJpbmciLCJhZGRyZXNzIjoic3RyaW5nIiwicmVmZXJyYWxjb2RlcyI6WyJzdHJpbmciXX0sInNjb3JlIjo1MCwiaXNFbGlnaWJsZSI6dHJ1ZX0=", + "mockIds" : [ "38710293-7956-4ce0-8144-615e24946868" ], + "exception" : false, + "method" : { + "name" : "isCustomerEligibleForLoyaltyProgram", + "signature" : "(J)Lorg/unlogged/demo/models/CustomerScoreCard;", + "className" : "org.unlogged.demo.controller.CustomerController", + "methodHash" : -2119348806 + } + } ], + "org.unlogged.demo.controller.CustomerController#getCustomerProfile#(J)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "lineNumbers" : [ 22, 23 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "id" : "aa736739-d85d-457e-839a-be746e5b865c", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "7541e425-b46e-4a3f-a70a-3b20f4188110", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "6a657506-707a-4876-bfe3-b68f0eed72f6", + "name" : "get customer - 0", + "description" : "get customer 0 - should pass", + "methodArguments" : [ "0" ], + "returnValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "returnValueClassname" : "org.unlogged.demo.models.CustomerProfile", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703576526978, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : 575125164, + "probSerializedValue" : "eyJjdXN0b21lcmlkIjowLCJjdXN0b21lcm5hbWUiOiJzdHJpbmciLCJkYXRlb2ZiaXJ0aCI6InN0cmluZyIsImVtYWlsIjoic3RyaW5nIiwiY29udGFjdG51bWJlciI6InN0cmluZyIsImFkZHJlc3MiOiJzdHJpbmciLCJyZWZlcnJhbGNvZGVzIjpbInN0cmluZyJdfQ==", + "mockIds" : [ "9f0cdb81-0b43-40cd-9db6-157ae17a44fb" ], + "exception" : false, + "method" : { + "name" : "getCustomerProfile", + "signature" : "(J)Lorg/unlogged/demo/models/CustomerProfile;", + "className" : "org.unlogged.demo.controller.CustomerController", + "methodHash" : 1335237380 + } + } ], + "org.unlogged.demo.controller.CustomerController#removeCustomerProfile#(J)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "lineNumbers" : [ 34 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "id" : "e1fdb2b4-9331-464e-ae75-3b4481d8d836", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "63f07c94-0ce0-4d87-a154-8b89489cd5d4", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "ea9c623d-a918-4756-92ca-51e0447dff8e", + "name" : "remove customer 0", + "description" : "should pass", + "methodArguments" : [ "0" ], + "returnValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "returnValueClassname" : "org.unlogged.demo.models.CustomerProfile", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703576671889, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : 278379461, + "probSerializedValue" : "eyJjdXN0b21lcmlkIjowLCJjdXN0b21lcm5hbWUiOiJzdHJpbmciLCJkYXRlb2ZiaXJ0aCI6InN0cmluZyIsImVtYWlsIjoic3RyaW5nIiwiY29udGFjdG51bWJlciI6InN0cmluZyIsImFkZHJlc3MiOiJzdHJpbmciLCJyZWZlcnJhbGNvZGVzIjpbInN0cmluZyJdfQ==", + "mockIds" : [ "4afb5b6f-4229-45dd-b383-a071fce7b9b2" ], + "exception" : false, + "method" : { + "name" : "removeCustomerProfile", + "signature" : "(J)Lorg/unlogged/demo/models/CustomerProfile;", + "className" : "org.unlogged.demo.controller.CustomerController", + "methodHash" : 851606882 + } + } ] + }, + "declaredMockMap" : { } +} \ No newline at end of file diff --git a/src/test/resources/unlogged/org.unlogged.demo.controller.FutureController.json b/src/test/resources/unlogged/org.unlogged.demo.controller.FutureController.json new file mode 100644 index 0000000..41945b0 --- /dev/null +++ b/src/test/resources/unlogged/org.unlogged.demo.controller.FutureController.json @@ -0,0 +1,46 @@ +{ + "classname" : "org.unlogged.demo.controller.FutureController", + "storedCandidateMap" : { + "org.unlogged.demo.controller.FutureController#getFutureResultOptional#(Ljava/lang/String;)Ljava/lang/String;" : [ { + "lineNumbers" : [ 21, 22 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "\"string\"", + "id" : "049cde15-8ab6-4642-936b-6094ae2a1de6", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "fb613ff0-61f2-4db1-a971-ac9165fd415e", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "28c9f0e8-93ba-4dd7-aefc-ec83b61fc6c7", + "name" : "fc - optional case", + "description" : "optional case - should pass", + "methodArguments" : [ "\"string\"" ], + "returnValue" : "\"string\"", + "returnValueClassname" : "java.lang.Object", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703578982359, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : -283565333, + "probSerializedValue" : "InN0cmluZyI=", + "mockIds" : [ "737f11ba-f132-4d64-b9ba-23c857f16e9b" ], + "exception" : false, + "method" : { + "name" : "getFutureResultOptional", + "signature" : "(Ljava/lang/String;)Ljava/lang/String;", + "className" : "org.unlogged.demo.controller.FutureController", + "methodHash" : -1498505688 + } + } ] + }, + "declaredMockMap" : { } +} \ No newline at end of file diff --git a/src/test/resources/unlogged/org.unlogged.demo.controller.ProtoController.json b/src/test/resources/unlogged/org.unlogged.demo.controller.ProtoController.json new file mode 100644 index 0000000..e01b536 --- /dev/null +++ b/src/test/resources/unlogged/org.unlogged.demo.controller.ProtoController.json @@ -0,0 +1,46 @@ +{ + "classname" : "org.unlogged.demo.controller.ProtoController", + "storedCandidateMap" : { + "org.unlogged.demo.controller.ProtoController#getAddressbook#()Lorg/unlogged/demo/protos/generated/AddressBook;" : [ { + "lineNumbers" : [ 42, 43, 44, 45 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "{\"memoizedHashCode\":0,\"memoizedSize\":-1,\"unknownFields\":{\"fields\":{}},\"people_\":[{\"memoizedHashCode\":0,\"memoizedSize\":-1,\"unknownFields\":{\"fields\":{}},\"bitField0_\":1,\"name_\":\"Amg\",\"id_\":0,\"email_\":\"\",\"phones_\":[],\"memoizedIsInitialized\":1}],\"memoizedIsInitialized\":1}", + "id" : "5191b6cc-6f25-4600-8a2c-b981f13db29e", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "2944a6ee-cf29-497a-9869-a14251912645", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "31eaed49-a11c-497f-8fcb-a8ddd36aad15", + "name" : "get default address book", + "description" : "should pass", + "methodArguments" : [ ], + "returnValue" : "{\"memoizedHashCode\":0,\"memoizedSize\":-1,\"unknownFields\":{\"fields\":{}},\"people_\":[{\"memoizedHashCode\":0,\"memoizedSize\":-1,\"unknownFields\":{\"fields\":{}},\"bitField0_\":1,\"name_\":\"Amg\",\"id_\":0,\"email_\":\"\",\"phones_\":[],\"memoizedIsInitialized\":1}],\"memoizedIsInitialized\":1}", + "returnValueClassname" : "org.unlogged.demo.protos.generated.AddressBook", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703579022799, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : -230218422, + "probSerializedValue" : "eyJtZW1vaXplZEhhc2hDb2RlIjowLCJtZW1vaXplZFNpemUiOi0xLCJ1bmtub3duRmllbGRzIjp7ImZpZWxkcyI6e319LCJwZW9wbGVfIjpbeyJtZW1vaXplZEhhc2hDb2RlIjowLCJtZW1vaXplZFNpemUiOi0xLCJ1bmtub3duRmllbGRzIjp7ImZpZWxkcyI6e319LCJiaXRGaWVsZDBfIjoxLCJuYW1lXyI6IkFtZyIsImlkXyI6MCwiZW1haWxfIjoiIiwicGhvbmVzXyI6W10sIm1lbW9pemVkSXNJbml0aWFsaXplZCI6MX1dLCJtZW1vaXplZElzSW5pdGlhbGl6ZWQiOjF9", + "mockIds" : [ ], + "exception" : false, + "method" : { + "name" : "getAddressbook", + "signature" : "()Lorg/unlogged/demo/protos/generated/AddressBook;", + "className" : "org.unlogged.demo.controller.ProtoController", + "methodHash" : 753748090 + } + } ] + }, + "declaredMockMap" : { } +} \ No newline at end of file diff --git a/src/test/resources/unlogged/org.unlogged.demo.controller.StudentController.json b/src/test/resources/unlogged/org.unlogged.demo.controller.StudentController.json new file mode 100644 index 0000000..a8a88f7 --- /dev/null +++ b/src/test/resources/unlogged/org.unlogged.demo.controller.StudentController.json @@ -0,0 +1,206 @@ +{ + "classname" : "org.unlogged.demo.controller.StudentController", + "storedCandidateMap" : { + "org.unlogged.demo.controller.StudentController#getAllStudents#()Ljava/util/Collection;" : [ { + "lineNumbers" : [ 24 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "[{\"id\":\"string\",\"name\":\"string\",\"gender\":\"MALE\",\"grade\":0}]", + "id" : "fafa6fe1-2472-4d2f-9562-925850ef850b", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "943b1b70-b748-4c5e-8eb9-26a5ad978990", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "0e2aaa76-239f-45b3-beac-62d8bec1ffce", + "name" : "get all students default - should pass", + "description" : "should pass", + "methodArguments" : [ ], + "returnValue" : "[{\"id\":\"string\",\"name\":\"string\",\"gender\":\"MALE\",\"grade\":0}]", + "returnValueClassname" : "java.util.List", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703579158364, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : -264764287, + "probSerializedValue" : "W3siaWQiOiJzdHJpbmciLCJuYW1lIjoic3RyaW5nIiwiZ2VuZGVyIjoiTUFMRSIsImdyYWRlIjowfV0=", + "mockIds" : [ "6a9930cf-3be7-4422-b999-625bee212f59" ], + "exception" : false, + "method" : { + "name" : "getAllStudents", + "signature" : "()Ljava/util/Collection;", + "className" : "org.unlogged.demo.controller.StudentController", + "methodHash" : 1983134265 + } + } ], + "org.unlogged.demo.controller.StudentController#getById#(Ljava/lang/String;)Ljava/util/Optional;" : [ { + "lineNumbers" : [ 30 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "{\"id\":\"string\",\"name\":\"string\",\"gender\":\"MALE\",\"grade\":0}", + "id" : "79ed7c80-f889-48c0-b841-0d0b55f46f1d", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "814c2fc2-b346-47b2-b8e8-918981c959e9", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "edb36779-989f-428a-bf1b-6ed6b0e53a8c", + "name" : "get default student - should pass", + "description" : "should pass", + "methodArguments" : [ "\"string\"" ], + "returnValue" : "{\"id\":\"string\",\"name\":\"string\",\"gender\":\"MALE\",\"grade\":0}", + "returnValueClassname" : "java.util.Optional", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703579238954, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : 276338891, + "probSerializedValue" : "eyJpZCI6InN0cmluZyIsIm5hbWUiOiJzdHJpbmciLCJnZW5kZXIiOiJNQUxFIiwiZ3JhZGUiOjB9", + "mockIds" : [ "a92a9f27-f765-4aca-b968-ac72123c2252" ], + "exception" : false, + "method" : { + "name" : "getById", + "signature" : "(Ljava/lang/String;)Ljava/util/Optional;", + "className" : "org.unlogged.demo.controller.StudentController", + "methodHash" : -1382304313 + } + } ], + "org.unlogged.demo.controller.StudentController#createStudent#(Lorg/unlogged/demo/models/Student;)Z" : [ { + "lineNumbers" : [ 35 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "1", + "id" : "a593d5a4-10ac-424e-bf26-42f70374ec57", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "c9b6bdf5-d68f-4169-b35e-83cb790a9bd5", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "73721093-a324-43bc-be80-c1e1a07b93bd", + "name" : "test createStudent returns expected value when", + "description" : "assert that the response value matches expected value", + "methodArguments" : [ "{\"id\":\"string\",\"name\":\"string\",\"gender\":\"MALE\",\"grade\":0}" ], + "returnValue" : "1", + "returnValueClassname" : "Z", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703579284225, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : 456450152, + "probSerializedValue" : "", + "mockIds" : [ "1f524592-0193-4c76-9e17-cd43b32d93db" ], + "exception" : false, + "method" : { + "name" : "createStudent", + "signature" : "(Lorg/unlogged/demo/models/Student;)Z", + "className" : "org.unlogged.demo.controller.StudentController", + "methodHash" : -657663158 + } + } ], + "org.unlogged.demo.controller.StudentController#updateStudent#(Ljava/lang/String;Lorg/unlogged/demo/models/Student;)Z" : [ { + "lineNumbers" : [ 40 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "1", + "id" : "462785e7-5562-4633-8133-ed6a645e2c25", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "c45d1d2a-160e-45ef-bd34-984d0e39deef", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "ced24aa5-9c00-4db5-a7a1-741338bde329", + "name" : "update default student profile", + "description" : "should pass", + "methodArguments" : [ "\"string\"", "{\"id\":\"string\",\"name\":\"string\",\"gender\":\"MALE\",\"grade\":0}" ], + "returnValue" : "1", + "returnValueClassname" : "Z", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703579363261, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : -69716350, + "probSerializedValue" : "", + "mockIds" : [ "0c1e9eb7-5781-46cc-8509-a5f7f377cf86" ], + "exception" : false, + "method" : { + "name" : "updateStudent", + "signature" : "(Ljava/lang/String;Lorg/unlogged/demo/models/Student;)Z", + "className" : "org.unlogged.demo.controller.StudentController", + "methodHash" : -2081891490 + } + } ], + "org.unlogged.demo.controller.StudentController#deleteStudent#(Ljava/lang/String;)Z" : [ { + "lineNumbers" : [ 45 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "1", + "id" : "89a5402e-6edd-4e1c-9d74-f27a51597703", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "a2ae6e6e-1b75-496f-ab3c-cb499cd31222", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "813483c1-3805-4125-aa18-b62beffb4cd3", + "name" : "delete default student", + "description" : "should pass", + "methodArguments" : [ "\"string\"" ], + "returnValue" : "1", + "returnValueClassname" : "Z", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703579414434, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : -610235950, + "probSerializedValue" : "", + "mockIds" : [ "59fd7f96-5de6-4899-b956-7eebeb1565ff" ], + "exception" : false, + "method" : { + "name" : "deleteStudent", + "signature" : "(Ljava/lang/String;)Z", + "className" : "org.unlogged.demo.controller.StudentController", + "methodHash" : 586626156 + } + } ] + }, + "declaredMockMap" : { } +} \ No newline at end of file diff --git a/src/test/resources/unlogged/org.unlogged.demo.repository.CustomerProfileRepository.json b/src/test/resources/unlogged/org.unlogged.demo.repository.CustomerProfileRepository.json new file mode 100644 index 0000000..4c8d640 --- /dev/null +++ b/src/test/resources/unlogged/org.unlogged.demo.repository.CustomerProfileRepository.json @@ -0,0 +1,312 @@ +{ + "classname" : "org.unlogged.demo.repository.CustomerProfileRepository", + "storedCandidateMap" : { + "org.unlogged.demo.repository.CustomerProfileRepository#fetchCustomerProfile#(J)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "lineNumbers" : [ 18 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "id" : "2ce21ddb-ae10-462d-9f13-186c95fe33aa", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "5198ae99-bd22-452e-a471-6e238e5bad5c", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "5650e2da-d003-4f26-9f54-9cbbc7645be0", + "name" : "Get default profile", + "description" : "should pass", + "methodArguments" : [ "0" ], + "returnValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "returnValueClassname" : "java.lang.Object", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703579517538, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : 1831532062, + "probSerializedValue" : "eyJjdXN0b21lcmlkIjowLCJjdXN0b21lcm5hbWUiOiJzdHJpbmciLCJkYXRlb2ZiaXJ0aCI6InN0cmluZyIsImVtYWlsIjoic3RyaW5nIiwiY29udGFjdG51bWJlciI6InN0cmluZyIsImFkZHJlc3MiOiJzdHJpbmciLCJyZWZlcnJhbGNvZGVzIjpbInN0cmluZyJdfQ==", + "mockIds" : [ "ccb05a27-9329-4d92-aef5-829acb250665" ], + "exception" : false, + "method" : { + "name" : "fetchCustomerProfile", + "signature" : "(J)Lorg/unlogged/demo/models/CustomerProfile;", + "className" : "org.unlogged.demo.repository.CustomerProfileRepository", + "methodHash" : -1856724079 + } + } ], + "org.unlogged.demo.repository.CustomerProfileRepository#removeCustomer#(J)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "lineNumbers" : [ 33, 34, 35 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "id" : "a642dfa8-1f4d-4545-aa00-c124fd712e66", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "e78e4276-650a-44b2-bcba-ba511dba7c13", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "4f6f513b-6bc4-42db-812d-79c253eb5c7f", + "name" : "Default remove case", + "description" : "should pass", + "methodArguments" : [ "0" ], + "returnValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "returnValueClassname" : "org.unlogged.demo.models.CustomerProfile", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703579631514, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : -3624408, + "probSerializedValue" : "eyJjdXN0b21lcmlkIjowLCJjdXN0b21lcm5hbWUiOiJzdHJpbmciLCJkYXRlb2ZiaXJ0aCI6InN0cmluZyIsImVtYWlsIjoic3RyaW5nIiwiY29udGFjdG51bWJlciI6InN0cmluZyIsImFkZHJlc3MiOiJzdHJpbmciLCJyZWZlcnJhbGNvZGVzIjpbInN0cmluZyJdfQ==", + "mockIds" : [ "ccb05a27-9329-4d92-aef5-829acb250665" ], + "exception" : false, + "method" : { + "name" : "removeCustomer", + "signature" : "(J)Lorg/unlogged/demo/models/CustomerProfile;", + "className" : "org.unlogged.demo.repository.CustomerProfileRepository", + "methodHash" : -2059597971 + } + } ], + "org.unlogged.demo.repository.CustomerProfileRepository#getInternationalCustomers#()Ljava/util/List;" : [ { + "lineNumbers" : [ 84, 85, 86, 87, 88, 89, 90, 91, 92, 94, 97, 99, 100, 101, 102, 104, 107 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "[{\"customerid\":1,\"customername\":\"John doe\",\"dateofbirth\":\"1998-9-25\",\"email\":\"john.doe@gmail.com\",\"contactnumber\":\"9825672456\",\"address\":\"304 Alanis Parkway, Boylemouth, Virginia\",\"referralcodes\":[\"VtYxq8m0Op0M\",\"LyJMqECNr3vn\",\"650wm3aKyOwx\",\"8LJILw5hfuPH\",\"jMGOEhv8hOMU\",\"7Ffb8QoG4gLG\"]}]", + "id" : "e19023cb-8fab-4900-a0aa-c44fe7d0350f", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "b6323a6a-c57f-4917-956e-f7f5ddff9046", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "4f81c24b-92ce-4c39-aa30-ba4ad4158144", + "name" : "default international customers list", + "description" : "should pass", + "methodArguments" : [ ], + "returnValue" : "[{\"customerid\":1,\"customername\":\"John doe\",\"dateofbirth\":\"1998-9-25\",\"email\":\"john.doe@gmail.com\",\"contactnumber\":\"9825672456\",\"address\":\"304 Alanis Parkway, Boylemouth, Virginia\",\"referralcodes\":[\"VtYxq8m0Op0M\",\"LyJMqECNr3vn\",\"650wm3aKyOwx\",\"8LJILw5hfuPH\",\"jMGOEhv8hOMU\",\"7Ffb8QoG4gLG\"]}]", + "returnValueClassname" : "java.util.ArrayList", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703579679151, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : -403018305, + "probSerializedValue" : "W3siY3VzdG9tZXJpZCI6MSwiY3VzdG9tZXJuYW1lIjoiSm9obiBkb2UiLCJkYXRlb2ZiaXJ0aCI6IjE5OTgtOS0yNSIsImVtYWlsIjoiam9obi5kb2VAZ21haWwuY29tIiwiY29udGFjdG51bWJlciI6Ijk4MjU2NzI0NTYiLCJhZGRyZXNzIjoiMzA0IEFsYW5pcyBQYXJrd2F5LCBCb3lsZW1vdXRoLCBWaXJnaW5pYSIsInJlZmVycmFsY29kZXMiOlsiVnRZeHE4bTBPcDBNIiwiTHlKTXFFQ05yM3ZuIiwiNjUwd20zYUt5T3d4IiwiOExKSUx3NWhmdVBIIiwiak1HT0VodjhoT01VIiwiN0ZmYjhRb0c0Z0xHIl19XQ==", + "mockIds" : [ ], + "exception" : false, + "method" : { + "name" : "getInternationalCustomers", + "signature" : "()Ljava/util/List;", + "className" : "org.unlogged.demo.repository.CustomerProfileRepository", + "methodHash" : -833180765 + } + } ], + "org.unlogged.demo.repository.CustomerProfileRepository#getAsianCustomers#()Ljava/util/List;" : [ { + "lineNumbers" : [ 40, 42, 43, 44, 45, 46, 47, 49, 52, 54, 55, 56, 57, 58, 59, 60, 62, 65, 67, 68, 69, 70, 71, 72, 73, 75, 78, 80 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "[{\"customerid\":3,\"customername\":\"aman\",\"dateofbirth\":\"20-2-1996\",\"email\":\"aman876@gmail.com\",\"contactnumber\":\"9527861967\",\"address\":\"Gujarat, India\",\"referralcodes\":[\"VtYxq8m0Op0M\",\"LyJMqECNr3vn\",\"650wm3aKyOwx\",\"8LJILw5hfuPH\",\"jMGOEhv8hOMU\"]},{\"customerid\":4,\"customername\":\"toro\",\"dateofbirth\":\"14-4-1993\",\"email\":\"toro.nani@gmail.com\",\"contactnumber\":\"5670926480\",\"address\":\"Kyoto, Japan\",\"referralcodes\":[\"VtYxq8m0Op0M\",\"LyJMqECNr3vn\",\"650wm3aKyOwx\",\"8LJILw5hfuPH\",\"jMGOEhv8hOMU\",\"7Ffb8QoG4gLG\"]},{\"customerid\":5,\"customername\":\"ashok\",\"dateofbirth\":\"14-4-1993\",\"email\":\"ashok.shah@gmail.com\",\"contactnumber\":\"5670926480\",\"address\":\"Kathmandu, Nepal\",\"referralcodes\":[\"VtYxq8m0Op0M\",\"LyJMqECNr3vn\",\"650wm3aKyOwx\",\"8LJILw5hfuPH\",\"jMGOEhv8hOMU\",\"7Ffb8QoG4gLG\"]}]", + "id" : "bc8333ed-0ce7-41dc-a284-4d7bb881ca0b", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "2b2953ca-5ca3-40f6-a994-9ffd27f34b92", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "d3b062dc-dd17-4e58-8968-428784b66366", + "name" : "Static asian customers list", + "description" : "should pass", + "methodArguments" : [ ], + "returnValue" : "[{\"customerid\":3,\"customername\":\"aman\",\"dateofbirth\":\"20-2-1996\",\"email\":\"aman876@gmail.com\",\"contactnumber\":\"9527861967\",\"address\":\"Gujarat, India\",\"referralcodes\":[\"VtYxq8m0Op0M\",\"LyJMqECNr3vn\",\"650wm3aKyOwx\",\"8LJILw5hfuPH\",\"jMGOEhv8hOMU\"]},{\"customerid\":4,\"customername\":\"toro\",\"dateofbirth\":\"14-4-1993\",\"email\":\"toro.nani@gmail.com\",\"contactnumber\":\"5670926480\",\"address\":\"Kyoto, Japan\",\"referralcodes\":[\"VtYxq8m0Op0M\",\"LyJMqECNr3vn\",\"650wm3aKyOwx\",\"8LJILw5hfuPH\",\"jMGOEhv8hOMU\",\"7Ffb8QoG4gLG\"]},{\"customerid\":5,\"customername\":\"ashok\",\"dateofbirth\":\"14-4-1993\",\"email\":\"ashok.shah@gmail.com\",\"contactnumber\":\"5670926480\",\"address\":\"Kathmandu, Nepal\",\"referralcodes\":[\"VtYxq8m0Op0M\",\"LyJMqECNr3vn\",\"650wm3aKyOwx\",\"8LJILw5hfuPH\",\"jMGOEhv8hOMU\",\"7Ffb8QoG4gLG\"]}]", + "returnValueClassname" : "java.util.ArrayList", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703579654728, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : 381836330, + "probSerializedValue" : "W3siY3VzdG9tZXJpZCI6MywiY3VzdG9tZXJuYW1lIjoiYW1hbiIsImRhdGVvZmJpcnRoIjoiMjAtMi0xOTk2IiwiZW1haWwiOiJhbWFuODc2QGdtYWlsLmNvbSIsImNvbnRhY3RudW1iZXIiOiI5NTI3ODYxOTY3IiwiYWRkcmVzcyI6Ikd1amFyYXQsIEluZGlhIiwicmVmZXJyYWxjb2RlcyI6WyJWdFl4cThtME9wME0iLCJMeUpNcUVDTnIzdm4iLCI2NTB3bTNhS3lPd3giLCI4TEpJTHc1aGZ1UEgiLCJqTUdPRWh2OGhPTVUiXX0seyJjdXN0b21lcmlkIjo0LCJjdXN0b21lcm5hbWUiOiJ0b3JvIiwiZGF0ZW9mYmlydGgiOiIxNC00LTE5OTMiLCJlbWFpbCI6InRvcm8ubmFuaUBnbWFpbC5jb20iLCJjb250YWN0bnVtYmVyIjoiNTY3MDkyNjQ4MCIsImFkZHJlc3MiOiJLeW90bywgSmFwYW4iLCJyZWZlcnJhbGNvZGVzIjpbIlZ0WXhxOG0wT3AwTSIsIkx5Sk1xRUNOcjN2biIsIjY1MHdtM2FLeU93eCIsIjhMSklMdzVoZnVQSCIsImpNR09FaHY4aE9NVSIsIjdGZmI4UW9HNGdMRyJdfSx7ImN1c3RvbWVyaWQiOjUsImN1c3RvbWVybmFtZSI6ImFzaG9rIiwiZGF0ZW9mYmlydGgiOiIxNC00LTE5OTMiLCJlbWFpbCI6ImFzaG9rLnNoYWhAZ21haWwuY29tIiwiY29udGFjdG51bWJlciI6IjU2NzA5MjY0ODAiLCJhZGRyZXNzIjoiS2F0aG1hbmR1LCBOZXBhbCIsInJlZmVycmFsY29kZXMiOlsiVnRZeHE4bTBPcDBNIiwiTHlKTXFFQ05yM3ZuIiwiNjUwd20zYUt5T3d4IiwiOExKSUx3NWhmdVBIIiwiak1HT0VodjhoT01VIiwiN0ZmYjhRb0c0Z0xHIl19XQ==", + "mockIds" : [ ], + "exception" : false, + "method" : { + "name" : "getAsianCustomers", + "signature" : "()Ljava/util/List;", + "className" : "org.unlogged.demo.repository.CustomerProfileRepository", + "methodHash" : 79493219 + } + } ], + "org.unlogged.demo.repository.CustomerProfileRepository#save#(Lorg/unlogged/demo/models/CustomerProfileRequest;)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "lineNumbers" : [ 22, 23, 24 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "{\"customerid\":1,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "id" : "75ba0b4a-4ba4-4563-9d45-bfe0aecca972", + "assertionType" : "NOT_NULL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "fb87cb02-3f0d-4d77-b112-b4fcbeb797be", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "c989f149-63e3-4eb0-8955-feb6e6b9083d", + "name" : "Saved profile should not be null", + "description" : "should pass", + "methodArguments" : [ "{\"customerName\":\"string\",\"dateOfBirth\":\"string\",\"email\":\"string\",\"primaryNumber\":\"string\",\"address\":\"string\",\"codes\":[\"string\"]}" ], + "returnValue" : "{\"customerid\":1,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "returnValueClassname" : "org.unlogged.demo.models.CustomerProfile", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703579566795, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : -527755777, + "probSerializedValue" : "eyJjdXN0b21lcmlkIjoxLCJjdXN0b21lcm5hbWUiOiJzdHJpbmciLCJkYXRlb2ZiaXJ0aCI6InN0cmluZyIsImVtYWlsIjoic3RyaW5nIiwiY29udGFjdG51bWJlciI6InN0cmluZyIsImFkZHJlc3MiOiJzdHJpbmciLCJyZWZlcnJhbGNvZGVzIjpbInN0cmluZyJdfQ==", + "mockIds" : [ ], + "exception" : false, + "method" : { + "name" : "save", + "signature" : "(Lorg/unlogged/demo/models/CustomerProfileRequest;)Lorg/unlogged/demo/models/CustomerProfile;", + "className" : "org.unlogged.demo.repository.CustomerProfileRepository", + "methodHash" : 1877578235 + } + } ] + }, + "declaredMockMap" : { + "org.unlogged.demo.repository.CustomerProfileRepository#fetchCustomerProfile#(J)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "id" : "a56f90c6-4eb9-48da-a8a0-f0d6e2fd0f9e", + "name" : "cr - default profile fetch", + "fieldTypeName" : "org.unlogged.demo.repository.CustomerProfileRepository", + "sourceClassName" : "org.unlogged.demo.service.CustomerService", + "fieldName" : "customerProfileRepository", + "methodName" : "fetchCustomerProfile", + "whenParameter" : [ { + "name" : "customerID", + "type" : "ANY_OF_TYPE", + "value" : "long" + } ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "{\"customerid\": 0, \"customername\": \"string\", \"dateofbirth\": \"string\", \"email\": \"string\", \"contactnumber\": \"string\", \"address\": \"string\", \"referralcodes\": [\"string\"]}", + "returnValueType" : "REAL", + "className" : "org.unlogged.demo.models.CustomerProfile" + }, + "methodExitType" : "NORMAL" + } ] + }, { + "id" : "6536bcda-c910-4313-b7a4-254d0a0302f3", + "name" : "cr - highscore profile fetch", + "fieldTypeName" : "org.unlogged.demo.repository.CustomerProfileRepository", + "sourceClassName" : "org.unlogged.demo.service.CustomerService", + "fieldName" : "customerProfileRepository", + "methodName" : "fetchCustomerProfile", + "whenParameter" : [ { + "name" : "customerID", + "type" : "ANY_OF_TYPE", + "value" : "long" + } ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "{\n \"customerid\" : 0,\n \"customername\" : \"string\",\n \"dateofbirth\" : \"string\",\n \"email\" : \"string\",\n \"contactnumber\" : \"string\",\n \"address\" : \"Ohio\",\n \"referralcodes\" : [ \"string\", \"string\", \"string\", \"string\" ,\"string\", \"string\" ]\n}", + "returnValueType" : "REAL", + "className" : "org.unlogged.demo.models.CustomerProfile" + }, + "methodExitType" : "NORMAL" + } ] + } ], + "org.unlogged.demo.repository.CustomerProfileRepository#removeCustomer#(J)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "id" : "f07fd213-3dbd-49dd-b81e-1eae6f43c764", + "name" : "cr - remove profile mock", + "fieldTypeName" : "org.unlogged.demo.repository.CustomerProfileRepository", + "sourceClassName" : "org.unlogged.demo.service.CustomerService", + "fieldName" : "customerProfileRepository", + "methodName" : "removeCustomer", + "whenParameter" : [ { + "name" : "customerID", + "type" : "ANY_OF_TYPE", + "value" : "long" + } ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "{\"customerid\": 0, \"customername\": \"string\", \"dateofbirth\": \"string\", \"email\": \"string\", \"contactnumber\": \"string\", \"address\": \"string\", \"referralcodes\": [\"string\"]}", + "returnValueType" : "REAL", + "className" : "org.unlogged.demo.models.CustomerProfile" + }, + "methodExitType" : "NORMAL" + } ] + } ], + "org.unlogged.demo.repository.CustomerProfileRepository#save#(Lorg/unlogged/demo/models/CustomerProfile;)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "id" : "dac1f43c-e764-4805-b969-765929a4c064", + "name" : "cr - save profile ref", + "fieldTypeName" : "org.unlogged.demo.repository.CustomerProfileRepository", + "sourceClassName" : "org.unlogged.demo.service.CustomerService", + "fieldName" : "customerProfileRepository", + "methodName" : "save", + "whenParameter" : [ { + "name" : "profile", + "type" : "ANY_OF_TYPE", + "value" : "org.unlogged.demo.models.CustomerProfile" + } ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "{\"customerid\": 0, \"customername\": \"string\", \"dateofbirth\": \"string\", \"email\": \"string\", \"contactnumber\": \"string\", \"address\": \"string\", \"referralcodes\": [\"string\"]}", + "returnValueType" : "REAL", + "className" : "org.unlogged.demo.models.CustomerProfile" + }, + "methodExitType" : "NORMAL" + } ] + } ], + "org.unlogged.demo.repository.CustomerProfileRepository#getAsianCustomers#()Ljava/util/List;" : [ { + "id" : "07559b06-dbe6-4dbd-a85f-cc5e605f3b73", + "name" : "cr1 - mock asian customers", + "fieldTypeName" : "org.unlogged.demo.repository.CustomerProfileRepository", + "sourceClassName" : "org.unlogged.demo.service.CustomerService", + "fieldName" : "customerProfileRepository", + "methodName" : "getAsianCustomers", + "whenParameter" : [ ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "[ {\n \"customerid\" : 0,\n \"customername\" : \"string\",\n \"dateofbirth\" : \"string\",\n \"email\" : \"string\",\n \"contactnumber\" : \"string\",\n \"address\" : \"Nepal\",\n \"referralcodes\" : [ \"string\" ]\n} ]", + "returnValueType" : "REAL", + "className" : "java.util.List" + }, + "methodExitType" : "NORMAL" + } ] + } ] + } +} \ No newline at end of file diff --git a/src/test/resources/unlogged/org.unlogged.demo.service.CustomerService.json b/src/test/resources/unlogged/org.unlogged.demo.service.CustomerService.json index 07570d9..66a5215 100644 --- a/src/test/resources/unlogged/org.unlogged.demo.service.CustomerService.json +++ b/src/test/resources/unlogged/org.unlogged.demo.service.CustomerService.json @@ -1,53 +1,435 @@ { "classname" : "org.unlogged.demo.service.CustomerService", "storedCandidateMap" : { - "org.unlogged.demo.service.CustomerService#isCustomerEligibleForPremium#(J)Lorg/unlogged/demo/models/CustomerScoreCard;" : [ { - "lineNumbers" : [ 60, 61, 62, 63, 66, 70, 71, 74 ], + "org.unlogged.demo.service.CustomerService#filterEligbleCustomers#(Ljava/util/List;Z)Ljava/util/List;" : [ { + "lineNumbers" : [ 78, 79, 80, 82, 83, 84, 85, 86, 107, 109, 110, 113, 131 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "[]", + "id" : "c4ebc3a8-947f-45d8-891e-7575b4ef7584", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "9c6e533c-6687-4d03-b8ad-9fbc31a28688", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "6a99c8e5-5ac6-481b-b0f6-cb0467452588", + "name" : "asia flow - non eligible", + "description" : "should pass", + "methodArguments" : [ "[{\"customerid\":1,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}]", "1" ], + "returnValue" : "[]", + "returnValueClassname" : "java.util.ArrayList", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703580704105, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : -1909132349, + "probSerializedValue" : "W10=", + "mockIds" : [ "07559b06-dbe6-4dbd-a85f-cc5e605f3b73" ], + "exception" : false, + "method" : { + "name" : "filterEligbleCustomers", + "signature" : "(Ljava/util/List;Z)Ljava/util/List;", + "className" : "org.unlogged.demo.service.CustomerService", + "methodHash" : -1451434435 + } + }, { + "lineNumbers" : [ 78, 79, 80, 82, 83, 84, 85, 86, 91, 92, 94, 97, 109, 110, 111, 113, 102, 131 ], "testAssertions" : { "subAssertions" : [ { "subAssertions" : [ ], "expression" : "SELF", - "expectedValue" : "4", - "id" : "0b2ed829-2f5a-409f-8f22-43de34112d6a", + "expectedValue" : "[{\"customerid\":3,\"customername\":\"aman\",\"dateofbirth\":\"20-2-1996\",\"email\":\"aman876@gmail.com\",\"contactnumber\":\"9527861967\",\"address\":\"Gujarat, India\",\"referralcodes\":[\"VtYxq8m0Op0M\",\"LyJMqECNr3vn\",\"650wm3aKyOwx\",\"8LJILw5hfuPH\",\"jMGOEhv8hOMU\"]}]", + "id" : "091de0b8-fd44-4bed-89ab-ae5b6c2ed0ab", "assertionType" : "EQUAL", - "key" : "/score" - }, { + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "4ff34a45-fa22-49a2-be2e-57dd1d994982", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "c8ab4a49-aaf6-49ad-a472-1593410cf163", + "name" : "Asia flow - eligible", + "description" : "should pass", + "methodArguments" : [ "[{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}]", "1" ], + "returnValue" : "[{\"customerid\":3,\"customername\":\"aman\",\"dateofbirth\":\"20-2-1996\",\"email\":\"aman876@gmail.com\",\"contactnumber\":\"9527861967\",\"address\":\"Gujarat, India\",\"referralcodes\":[\"VtYxq8m0Op0M\",\"LyJMqECNr3vn\",\"650wm3aKyOwx\",\"8LJILw5hfuPH\",\"jMGOEhv8hOMU\"]}]", + "returnValueClassname" : "java.util.ArrayList", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703580598627, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : -134157859, + "probSerializedValue" : "W3siY3VzdG9tZXJpZCI6MywiY3VzdG9tZXJuYW1lIjoiYW1hbiIsImRhdGVvZmJpcnRoIjoiMjAtMi0xOTk2IiwiZW1haWwiOiJhbWFuODc2QGdtYWlsLmNvbSIsImNvbnRhY3RudW1iZXIiOiI5NTI3ODYxOTY3IiwiYWRkcmVzcyI6Ikd1amFyYXQsIEluZGlhIiwicmVmZXJyYWxjb2RlcyI6WyJWdFl4cThtME9wME0iLCJMeUpNcUVDTnIzdm4iLCI2NTB3bTNhS3lPd3giLCI4TEpJTHc1aGZ1UEgiLCJqTUdPRWh2OGhPTVUiXX1d", + "mockIds" : [ ], + "exception" : false, + "method" : { + "name" : "filterEligbleCustomers", + "signature" : "(Ljava/util/List;Z)Ljava/util/List;", + "className" : "org.unlogged.demo.service.CustomerService", + "methodHash" : 0 + } + } ], + "org.unlogged.demo.service.CustomerService#saveNewCustomer#(Lorg/unlogged/demo/models/CustomerProfileRequest;)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "lineNumbers" : [ 32, 33, 34, 35, 36 ], + "testAssertions" : { + "subAssertions" : [ { "subAssertions" : [ ], "expression" : "SELF", - "expectedValue" : "\"Ohio\"", - "id" : "5c114b2a-43d8-4c68-9037-b70fa3a59cb7", + "expectedValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "id" : "cc0d1912-84e0-41ed-b8d8-9e6a6f418d27", "assertionType" : "EQUAL", - "key" : "/customerProfile/address" + "key" : "/" } ], "expression" : "SELF", "expectedValue" : null, - "id" : "c7b8a74b-b3ed-4f2b-97ed-fe95626feeda", + "id" : "ce189a4e-2845-4117-9379-7dcfc5e7f1a8", "assertionType" : "ALLOF", "key" : null }, - "candidateId" : "d299ed6c-3fcc-493d-ad3a-f46391ca0e0b", - "name" : "test isCustomerEligibleForPremium returns expected value when", - "description" : "assert that the response value matches expected value", + "candidateId" : "0ebbfe49-c4cc-4fde-bc52-bb28131805e0", + "name" : "Save default customer profile", + "description" : "should pass", + "methodArguments" : [ "{\"customerName\":\"string\",\"dateOfBirth\":\"string\",\"email\":\"string\",\"primaryNumber\":\"string\",\"address\":\"string\",\"codes\":[\"string\"]}" ], + "returnValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "returnValueClassname" : "java.lang.Object", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703579927597, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : -394181719, + "probSerializedValue" : "eyJjdXN0b21lcmlkIjowLCJjdXN0b21lcm5hbWUiOiJzdHJpbmciLCJkYXRlb2ZiaXJ0aCI6InN0cmluZyIsImVtYWlsIjoic3RyaW5nIiwiY29udGFjdG51bWJlciI6InN0cmluZyIsImFkZHJlc3MiOiJzdHJpbmciLCJyZWZlcnJhbGNvZGVzIjpbInN0cmluZyJdfQ==", + "mockIds" : [ "a26748e0-50b1-4b4e-81c4-4efe75ebf3e7" ], + "exception" : false, + "method" : { + "name" : "saveNewCustomer", + "signature" : "(Lorg/unlogged/demo/models/CustomerProfileRequest;)Lorg/unlogged/demo/models/CustomerProfile;", + "className" : "org.unlogged.demo.service.CustomerService", + "methodHash" : 0 + } + } ], + "org.unlogged.demo.service.CustomerService#removeCustomer#(J)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "lineNumbers" : [ 40 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "id" : "c87eab73-6d7c-4c1d-9126-f32e79f627af", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "cc589d88-7786-4894-90ca-7f1bb6580d4e", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "1935d9aa-2559-4395-800e-0312aab67526", + "name" : "Remove Customer profile", + "description" : "should pass", "methodArguments" : [ "0" ], - "returnValue" : "{\"customerProfile\":{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"Ohio\",\"referralcodes\":[\"string\"]},\"score\":4,\"isEligible\":false}", + "returnValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "returnValueClassname" : "org.unlogged.demo.models.CustomerProfile", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703579981209, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : -291893058, + "probSerializedValue" : "eyJjdXN0b21lcmlkIjowLCJjdXN0b21lcm5hbWUiOiJzdHJpbmciLCJkYXRlb2ZiaXJ0aCI6InN0cmluZyIsImVtYWlsIjoic3RyaW5nIiwiY29udGFjdG51bWJlciI6InN0cmluZyIsImFkZHJlc3MiOiJzdHJpbmciLCJyZWZlcnJhbGNvZGVzIjpbInN0cmluZyJdfQ==", + "mockIds" : [ "f07fd213-3dbd-49dd-b81e-1eae6f43c764" ], + "exception" : false, + "method" : { + "name" : "removeCustomer", + "signature" : "(J)Lorg/unlogged/demo/models/CustomerProfile;", + "className" : "org.unlogged.demo.service.CustomerService", + "methodHash" : 1853009988 + } + } ], + "org.unlogged.demo.service.CustomerService#generateReferralForCustomer#(J)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "lineNumbers" : [ 44, 45, 46, 47 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SIZE", + "expectedValue" : "2", + "id" : "83cf4144-aa38-4e2f-a149-a562f7e2106e", + "assertionType" : "EQUAL", + "key" : "/referralcodes" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "83ba865d-7bb1-4c27-b11c-c71b1ad25bb6", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "ceab9394-28dd-4ef5-9d90-b88f76669429", + "name" : "Generate and add referral code to default customer", + "description" : "Size of codes should be 2", + "methodArguments" : [ "0" ], + "returnValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\",\"hzqbhjyykh\"]}", + "returnValueClassname" : "org.unlogged.demo.models.CustomerProfile", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703580068173, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : -1167926984, + "probSerializedValue" : "eyJjdXN0b21lcmlkIjowLCJjdXN0b21lcm5hbWUiOiJzdHJpbmciLCJkYXRlb2ZiaXJ0aCI6InN0cmluZyIsImVtYWlsIjoic3RyaW5nIiwiY29udGFjdG51bWJlciI6InN0cmluZyIsImFkZHJlc3MiOiJzdHJpbmciLCJyZWZlcnJhbGNvZGVzIjpbInN0cmluZyIsImh6cWJoanl5a2giXX0=", + "mockIds" : [ "dac1f43c-e764-4805-b969-765929a4c064", "a56f90c6-4eb9-48da-a8a0-f0d6e2fd0f9e" ], + "exception" : false, + "method" : { + "name" : "generateReferralForCustomer", + "signature" : "(J)Lorg/unlogged/demo/models/CustomerProfile;", + "className" : "org.unlogged.demo.service.CustomerService", + "methodHash" : -878386236 + } + } ], + "org.unlogged.demo.service.CustomerService#fetchCustomerProfile#(J)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "lineNumbers" : [ 27, 28 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "id" : "da66da25-34db-4d60-93a2-720985b98422", + "assertionType" : "EQUAL", + "key" : "/" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "d2cd59f4-cbeb-4050-829e-6184c8a18bd6", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "67a89961-7b21-46a6-9d36-aed23eff0b3d", + "name" : "Fetch default customer", + "description" : "should pass", + "methodArguments" : [ "0" ], + "returnValue" : "{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]}", + "returnValueClassname" : "org.unlogged.demo.models.CustomerProfile", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703579853288, + "candidateStatus" : "PASSING" + }, + "sessionIdentifier" : 407949802, + "probSerializedValue" : "eyJjdXN0b21lcmlkIjowLCJjdXN0b21lcm5hbWUiOiJzdHJpbmciLCJkYXRlb2ZiaXJ0aCI6InN0cmluZyIsImVtYWlsIjoic3RyaW5nIiwiY29udGFjdG51bWJlciI6InN0cmluZyIsImFkZHJlc3MiOiJzdHJpbmciLCJyZWZlcnJhbGNvZGVzIjpbInN0cmluZyJdfQ==", + "mockIds" : [ "a56f90c6-4eb9-48da-a8a0-f0d6e2fd0f9e" ], + "exception" : false, + "method" : { + "name" : "fetchCustomerProfile", + "signature" : "(J)Lorg/unlogged/demo/models/CustomerProfile;", + "className" : "org.unlogged.demo.service.CustomerService", + "methodHash" : 845208909 + } + } ], + "org.unlogged.demo.service.CustomerService#isCustomerEligibleForPremium#(J)Lorg/unlogged/demo/models/CustomerScoreCard;" : [ { + "lineNumbers" : [ 60, 61, 62, 63, 64, 65, 68, 70, 71, 74 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "false", + "id" : "7b8e0ec0-7669-41fe-abf0-f10c5babcf98", + "assertionType" : "EQUAL", + "key" : "/isEligible" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "9e7a5df6-7403-4947-8c9c-7e3d67b090de", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "0e1643df-a73f-4d0f-8d19-3e7d6f969631", + "name" : "Not eligible for premium case", + "description" : "should not be eligible", + "methodArguments" : [ "0" ], + "returnValue" : "{\"customerProfile\":{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\"]},\"score\":3,\"isEligible\":false}", "returnValueClassname" : "org.unlogged.demo.models.CustomerScoreCard", "metadata" : { - "recordedBy" : "artpar", - "hostMachineName" : "artpar", - "timestamp" : 1699430855809, + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703580169744, "candidateStatus" : "PASSING" }, - "sessionIdentifier" : -1181128734, - "probSerializedValue" : "eyJjdXN0b21lclByb2ZpbGUiOnsiY3VzdG9tZXJpZCI6MCwiY3VzdG9tZXJuYW1lIjoic3RyaW5nIiwiZGF0ZW9mYmlydGgiOiJzdHJpbmciLCJlbWFpbCI6InN0cmluZyIsImNvbnRhY3RudW1iZXIiOiJzdHJpbmciLCJhZGRyZXNzIjoiT2hpbyIsInJlZmVycmFsY29kZXMiOlsic3RyaW5nIl19LCJzY29yZSI6NCwiaXNFbGlnaWJsZSI6ZmFsc2V9", - "mockIds" : [ "df4e0194-d722-48be-b2d5-51c97f9af24e" ], + "sessionIdentifier" : 1445715982, + "probSerializedValue" : "eyJjdXN0b21lclByb2ZpbGUiOnsiY3VzdG9tZXJpZCI6MCwiY3VzdG9tZXJuYW1lIjoic3RyaW5nIiwiZGF0ZW9mYmlydGgiOiJzdHJpbmciLCJlbWFpbCI6InN0cmluZyIsImNvbnRhY3RudW1iZXIiOiJzdHJpbmciLCJhZGRyZXNzIjoic3RyaW5nIiwicmVmZXJyYWxjb2RlcyI6WyJzdHJpbmciXX0sInNjb3JlIjozLCJpc0VsaWdpYmxlIjpmYWxzZX0=", + "mockIds" : [ "a56f90c6-4eb9-48da-a8a0-f0d6e2fd0f9e" ], + "exception" : false, "method" : { "name" : "isCustomerEligibleForPremium", "signature" : "(J)Lorg/unlogged/demo/models/CustomerScoreCard;", "className" : "org.unlogged.demo.service.CustomerService", - "methodHash" : -538349156 + "methodHash" : -2054062351 + } + }, { + "lineNumbers" : [ 60, 61, 62, 63, 64, 65, 68, 70, 71, 74 ], + "testAssertions" : { + "subAssertions" : [ { + "subAssertions" : [ ], + "expression" : "SELF", + "expectedValue" : "true", + "id" : "ebd1d0e9-45f3-4a39-8461-df5b5317b8e6", + "assertionType" : "EQUAL", + "key" : "/isEligible" + } ], + "expression" : "SELF", + "expectedValue" : null, + "id" : "a47bbe16-b594-416a-97da-c29e24e8465a", + "assertionType" : "ALLOF", + "key" : null + }, + "candidateId" : "1930d59a-35e2-4eea-aac9-a5fdee6c8bf7", + "name" : "should be eligible case", + "description" : "should be eligible", + "methodArguments" : [ "1" ], + "returnValue" : "{\"customerProfile\":{\"customerid\":0,\"customername\":\"string\",\"dateofbirth\":\"string\",\"email\":\"string\",\"contactnumber\":\"string\",\"address\":\"string\",\"referralcodes\":[\"string\",\"string\",\"string\",\"string\",\"string\"]},\"score\":15,\"isEligible\":false}", + "returnValueClassname" : "org.unlogged.demo.models.CustomerScoreCard", + "metadata" : { + "recordedBy" : "testerfresher", + "hostMachineName" : "testerfresher", + "timestamp" : 1703580377057, + "candidateStatus" : "PASSING" }, - "exception" : false + "sessionIdentifier" : -1640161629, + "probSerializedValue" : "eyJjdXN0b21lclByb2ZpbGUiOnsiY3VzdG9tZXJpZCI6MCwiY3VzdG9tZXJuYW1lIjoic3RyaW5nIiwiZGF0ZW9mYmlydGgiOiJzdHJpbmciLCJlbWFpbCI6InN0cmluZyIsImNvbnRhY3RudW1iZXIiOiJzdHJpbmciLCJhZGRyZXNzIjoic3RyaW5nIiwicmVmZXJyYWxjb2RlcyI6WyJzdHJpbmciLCJzdHJpbmciLCJzdHJpbmciLCJzdHJpbmciLCJzdHJpbmciXX0sInNjb3JlIjoxNSwiaXNFbGlnaWJsZSI6ZmFsc2V9", + "mockIds" : [ "6536bcda-c910-4313-b7a4-254d0a0302f3" ], + "exception" : false, + "method" : { + "name" : "isCustomerEligibleForPremium", + "signature" : "(J)Lorg/unlogged/demo/models/CustomerScoreCard;", + "className" : "org.unlogged.demo.service.CustomerService", + "methodHash" : -2054062351 + } } ] }, - "declaredMockMap" : { } + "declaredMockMap" : { + "org.unlogged.demo.service.CustomerService#saveNewCustomer#(Lorg/unlogged/demo/models/CustomerProfileRequest;)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "id" : "cf87ae24-a734-4b87-9302-71b4e40e3bfa", + "name" : "cs - save customer 0 mock", + "fieldTypeName" : "org.unlogged.demo.service.CustomerService", + "sourceClassName" : "org.unlogged.demo.controller.CustomerController", + "fieldName" : "customerService", + "methodName" : "saveNewCustomer", + "whenParameter" : [ { + "name" : "saveRequest", + "type" : "ANY_OF_TYPE", + "value" : "org.unlogged.demo.models.CustomerProfileRequest" + } ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "{\"customerid\": 0, \"customername\": \"string\", \"dateofbirth\": \"string\", \"email\": \"string\", \"contactnumber\": \"string\", \"address\": \"string\", \"referralcodes\": [\"string\"]}", + "returnValueType" : "REAL", + "className" : "org.unlogged.demo.models.CustomerProfile" + }, + "methodExitType" : "NORMAL" + } ] + } ], + "org.unlogged.demo.service.CustomerService#removeCustomer#(J)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "id" : "4afb5b6f-4229-45dd-b383-a071fce7b9b2", + "name" : "cs - remove customer 0", + "fieldTypeName" : "org.unlogged.demo.service.CustomerService", + "sourceClassName" : "org.unlogged.demo.controller.CustomerController", + "fieldName" : "customerService", + "methodName" : "removeCustomer", + "whenParameter" : [ { + "name" : "customerID", + "type" : "ANY_OF_TYPE", + "value" : "long" + } ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "{\"customerid\": 0, \"customername\": \"string\", \"dateofbirth\": \"string\", \"email\": \"string\", \"contactnumber\": \"string\", \"address\": \"string\", \"referralcodes\": [\"string\"]}", + "returnValueType" : "REAL", + "className" : "org.unlogged.demo.models.CustomerProfile" + }, + "methodExitType" : "NORMAL" + } ] + } ], + "org.unlogged.demo.service.CustomerService#generateReferralForCustomer#(J)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "id" : "077b0593-8e95-4132-a552-ad171ba1633c", + "name" : "cs - generate code for customer 0", + "fieldTypeName" : "org.unlogged.demo.service.CustomerService", + "sourceClassName" : "org.unlogged.demo.controller.CustomerController", + "fieldName" : "customerService", + "methodName" : "generateReferralForCustomer", + "whenParameter" : [ { + "name" : "customerID", + "type" : "ANY_OF_TYPE", + "value" : "long" + } ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "{\n \"customerid\" : 0,\n \"customername\" : \"string\",\n \"dateofbirth\" : \"string\",\n \"email\" : \"string\",\n \"contactnumber\" : \"string\",\n \"address\" : \"string\",\n \"referralcodes\" : [ \"code-1\", \"code-2\" ]\n}", + "returnValueType" : "REAL", + "className" : "org.unlogged.demo.models.CustomerProfile" + }, + "methodExitType" : "NORMAL" + } ] + } ], + "org.unlogged.demo.service.CustomerService#fetchCustomerProfile#(J)Lorg/unlogged/demo/models/CustomerProfile;" : [ { + "id" : "9f0cdb81-0b43-40cd-9db6-157ae17a44fb", + "name" : "cs - customer 0 mock", + "fieldTypeName" : "org.unlogged.demo.service.CustomerService", + "sourceClassName" : "org.unlogged.demo.controller.CustomerController", + "fieldName" : "customerService", + "methodName" : "fetchCustomerProfile", + "whenParameter" : [ { + "name" : "id", + "type" : "ANY_OF_TYPE", + "value" : "long" + } ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "{\"customerid\": 0, \"customername\": \"string\", \"dateofbirth\": \"string\", \"email\": \"string\", \"contactnumber\": \"string\", \"address\": \"string\", \"referralcodes\": [\"string\"]}", + "returnValueType" : "REAL", + "className" : "org.unlogged.demo.models.CustomerProfile" + }, + "methodExitType" : "NORMAL" + } ] + } ], + "org.unlogged.demo.service.CustomerService#isCustomerEligibleForPremium#(J)Lorg/unlogged/demo/models/CustomerScoreCard;" : [ { + "id" : "38710293-7956-4ce0-8144-615e24946868", + "name" : "cs - customer 0 should be eligible", + "fieldTypeName" : "org.unlogged.demo.service.CustomerService", + "sourceClassName" : "org.unlogged.demo.controller.CustomerController", + "fieldName" : "customerService", + "methodName" : "isCustomerEligibleForPremium", + "whenParameter" : [ { + "name" : "customerID", + "type" : "ANY_OF_TYPE", + "value" : "long" + } ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "{\n \"customerProfile\" : {\n \"customerid\" : 0,\n \"customername\" : \"string\",\n \"dateofbirth\" : \"string\",\n \"email\" : \"string\",\n \"contactnumber\" : \"string\",\n \"address\" : \"string\",\n \"referralcodes\" : [ \"string\" ]\n },\n \"score\" : 50,\n \"isEligible\" : true\n}", + "returnValueType" : "REAL", + "className" : "org.unlogged.demo.models.CustomerScoreCard" + }, + "methodExitType" : "NORMAL" + } ] + } ] + } } \ No newline at end of file diff --git a/src/test/resources/unlogged/org.unlogged.demo.service.DeliveryUnitService.json b/src/test/resources/unlogged/org.unlogged.demo.service.DeliveryUnitService.json deleted file mode 100644 index dfcdd2a..0000000 --- a/src/test/resources/unlogged/org.unlogged.demo.service.DeliveryUnitService.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "classname" : "org.unlogged.demo.service.DeliveryUnitService", - "storedCandidateMap" : { - "org.unlogged.demo.service.DeliveryUnitService#getAllDeliveryUnits#()Ljava/util/List;" : [ { - "lineNumbers" : [ 35, 36, 37 ], - "testAssertions" : { - "subAssertions" : [ { - "subAssertions" : [ ], - "expression" : "SELF", - "expectedValue" : "[{\"id\":\"BLR001\",\"unitName\":\"BloreUniversity001\",\"available\":true,\"location\":\"bangalore\"},{\"id\":\"BLR002\",\"unitName\":\"Yeshwanthpura001\",\"available\":false,\"location\":\"bangalore\"},{\"id\":\"BLR003\",\"unitName\":\"Rajarajeshwari001\",\"available\":true,\"location\":\"bangalore\"},{\"id\":\"BLR004\",\"unitName\":\"Vijaynagar001\",\"available\":false,\"location\":\"bangalore\"}]", - "id" : "69732c0e-548d-4388-8aa2-8370b1f0d0a5", - "assertionType" : "EQUAL", - "key" : "/" - } ], - "expression" : "SELF", - "expectedValue" : null, - "id" : "d0e4b818-eb2f-45a1-8888-bfe811033c63", - "assertionType" : "ALLOF", - "key" : null - }, - "candidateId" : "fb28aec0-9f39-43c6-b4a9-d568917a8909", - "name" : "redis case", - "description" : "assert that the response value matches expected value", - "methodArguments" : [ ], - "returnValue" : "[{\"id\":\"BLR001\",\"unitName\":\"BloreUniversity001\",\"available\":true,\"location\":\"bangalore\"},{\"id\":\"BLR002\",\"unitName\":\"Yeshwanthpura001\",\"available\":false,\"location\":\"bangalore\"},{\"id\":\"BLR003\",\"unitName\":\"Rajarajeshwari001\",\"available\":true,\"location\":\"bangalore\"},{\"id\":\"BLR004\",\"unitName\":\"Vijaynagar001\",\"available\":false,\"location\":\"bangalore\"}]", - "returnValueClassname" : "java.util.ArrayList", - "metadata" : { - "recordedBy" : "testerfresher", - "hostMachineName" : "testerfresher", - "timestamp" : 1699592225452, - "candidateStatus" : "PASSING" - }, - "sessionIdentifier" : -1956915022, - "probSerializedValue" : "W3siaWQiOiJCTFIwMDEiLCJ1bml0TmFtZSI6IkJsb3JlVW5pdmVyc2l0eTAwMSIsImF2YWlsYWJsZSI6dHJ1ZSwibG9jYXRpb24iOiJiYW5nYWxvcmUifSx7ImlkIjoiQkxSMDAyIiwidW5pdE5hbWUiOiJZZXNod2FudGhwdXJhMDAxIiwiYXZhaWxhYmxlIjpmYWxzZSwibG9jYXRpb24iOiJiYW5nYWxvcmUifSx7ImlkIjoiQkxSMDAzIiwidW5pdE5hbWUiOiJSYWphcmFqZXNod2FyaTAwMSIsImF2YWlsYWJsZSI6dHJ1ZSwibG9jYXRpb24iOiJiYW5nYWxvcmUifSx7ImlkIjoiQkxSMDA0IiwidW5pdE5hbWUiOiJWaWpheW5hZ2FyMDAxIiwiYXZhaWxhYmxlIjpmYWxzZSwibG9jYXRpb24iOiJiYW5nYWxvcmUifV0=", - "mockIds" : [ ], - "method" : { - "name" : "getAllDeliveryUnits", - "signature" : "()Ljava/util/List;", - "className" : "org.unlogged.demo.service.DeliveryUnitService", - "methodHash" : 462341776 - }, - "exception" : false - } ] - }, - "declaredMockMap" : { } -} \ No newline at end of file diff --git a/src/test/resources/unlogged/org.unlogged.demo.service.FutureService.json b/src/test/resources/unlogged/org.unlogged.demo.service.FutureService.json new file mode 100644 index 0000000..ec99564 --- /dev/null +++ b/src/test/resources/unlogged/org.unlogged.demo.service.FutureService.json @@ -0,0 +1,28 @@ +{ + "classname" : "org.unlogged.demo.service.FutureService", + "storedCandidateMap" : { }, + "declaredMockMap" : { + "org.unlogged.demo.service.FutureService#doSomethingOptional#(Ljava/lang/String;)Ljava/util/Optional;" : [ { + "id" : "737f11ba-f132-4d64-b9ba-23c857f16e9b", + "name" : "fc - string optional response", + "fieldTypeName" : "org.unlogged.demo.service.FutureService", + "sourceClassName" : "org.unlogged.demo.controller.FutureController", + "fieldName" : "futureService", + "methodName" : "doSomethingOptional", + "whenParameter" : [ { + "name" : "optional", + "type" : "ANY_OF_TYPE", + "value" : "java.lang.String" + } ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "\"string\"", + "returnValueType" : "REAL", + "className" : "java.util.Optional" + }, + "methodExitType" : "NORMAL" + } ] + } ] + } +} \ No newline at end of file diff --git a/src/test/resources/unlogged/org.unlogged.demo.service.StudentService.json b/src/test/resources/unlogged/org.unlogged.demo.service.StudentService.json new file mode 100644 index 0000000..be7877d --- /dev/null +++ b/src/test/resources/unlogged/org.unlogged.demo.service.StudentService.json @@ -0,0 +1,112 @@ +{ + "classname" : "org.unlogged.demo.service.StudentService", + "storedCandidateMap" : { }, + "declaredMockMap" : { + "org.unlogged.demo.service.StudentService#updateStudent#(Lorg/unlogged/demo/models/Student;)Z" : [ { + "id" : "0c1e9eb7-5781-46cc-8509-a5f7f377cf86", + "name" : "ss - update student", + "fieldTypeName" : "org.unlogged.demo.service.StudentService", + "sourceClassName" : "org.unlogged.demo.controller.StudentController", + "fieldName" : "studentService", + "methodName" : "updateStudent", + "whenParameter" : [ { + "name" : "student", + "type" : "ANY_OF_TYPE", + "value" : "org.unlogged.demo.models.Student" + } ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "true", + "returnValueType" : "REAL", + "className" : "boolean" + }, + "methodExitType" : "NORMAL" + } ] + } ], + "org.unlogged.demo.service.StudentService#getStudent#(Ljava/lang/String;)Ljava/util/Optional;" : [ { + "id" : "a92a9f27-f765-4aca-b968-ac72123c2252", + "name" : "ss - get default student", + "fieldTypeName" : "org.unlogged.demo.service.StudentService", + "sourceClassName" : "org.unlogged.demo.controller.StudentController", + "fieldName" : "studentService", + "methodName" : "getStudent", + "whenParameter" : [ { + "name" : "id", + "type" : "ANY_OF_TYPE", + "value" : "java.lang.String" + } ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "{\"id\": \"string\", \"name\": \"string\", \"gender\": \"MALE\", \"grade\": 0}", + "returnValueType" : "REAL", + "className" : "java.util.Optional" + }, + "methodExitType" : "NORMAL" + } ] + } ], + "org.unlogged.demo.service.StudentService#deleteStudent#(Ljava/lang/String;)Z" : [ { + "id" : "59fd7f96-5de6-4899-b956-7eebeb1565ff", + "name" : "ss - delete student", + "fieldTypeName" : "org.unlogged.demo.service.StudentService", + "sourceClassName" : "org.unlogged.demo.controller.StudentController", + "fieldName" : "studentService", + "methodName" : "deleteStudent", + "whenParameter" : [ { + "name" : "id", + "type" : "ANY_OF_TYPE", + "value" : "java.lang.String" + } ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "true", + "returnValueType" : "REAL", + "className" : "boolean" + }, + "methodExitType" : "NORMAL" + } ] + } ], + "org.unlogged.demo.service.StudentService#findAll#()Ljava/util/List;" : [ { + "id" : "6a9930cf-3be7-4422-b999-625bee212f59", + "name" : "ss - default student list", + "fieldTypeName" : "org.unlogged.demo.service.StudentService", + "sourceClassName" : "org.unlogged.demo.controller.StudentController", + "fieldName" : "studentService", + "methodName" : "findAll", + "whenParameter" : [ ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "[{\n \"id\" : \"string\",\n \"name\" : \"string\",\n \"gender\" : \"MALE\",\n \"grade\" : 0\n}]", + "returnValueType" : "REAL", + "className" : "java.util.Collection" + }, + "methodExitType" : "NORMAL" + } ] + } ], + "org.unlogged.demo.service.StudentService#createStudent#(Lorg/unlogged/demo/models/Student;)Z" : [ { + "id" : "1f524592-0193-4c76-9e17-cd43b32d93db", + "name" : "ss - create student", + "fieldTypeName" : "org.unlogged.demo.service.StudentService", + "sourceClassName" : "org.unlogged.demo.controller.StudentController", + "fieldName" : "studentService", + "methodName" : "createStudent", + "whenParameter" : [ { + "name" : "student", + "type" : "ANY_OF_TYPE", + "value" : "org.unlogged.demo.models.Student" + } ], + "thenParameter" : [ { + "returnParameter" : { + "declaredMocks" : [ ], + "value" : "true", + "returnValueType" : "REAL", + "className" : "boolean" + }, + "methodExitType" : "NORMAL" + } ] + } ] + } +} \ No newline at end of file