# java.lang.AssertionError: Formatted notes should not be null

**URL:** https://talk.openelis-global.org/t/java-lang-assertionerror-formatted-notes-should-not-be-null/948
**Category:** Integration
**Tags:** gsoc2024
**Created:** [November 19, 2024, 8:55am UTC](https://talk.openelis-global.org/t/java-lang-assertionerror-formatted-notes-should-not-be-null/948 "2024-11-19T08:55:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Agaba\_Derrick\_Junior](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.openelis-global.org/agaba_derrick_junior/32/503_2.png) [@Agaba\_Derrick\_Junior](https://talk.openelis-global.org/u/Agaba_Derrick_Junior)
#### Post date: [November 19, 2024, 8:55am UTC](https://talk.openelis-global.org/t/java-lang-assertionerror-formatted-notes-should-not-be-null/948/1 "2024-11-19T08:55:27Z")

</div>

hello community,  
iam facing this [error](https://pastebin.com/7KBN0gLZ) while creating tests for [public void getNotesAsString\_shouldReturnFormattedNotes()](https://pastebin.com/cPN2qiQf)  
The error `java.lang.AssertionError: Formatted notes should not be null` indicates that the `getNotesAsString()` method is returning `null` when it shouldn’t. Based on the trace, this is [happening](https://pastebin.com/7KBN0gLZ)

any idea and suggestions would greatly help !

@rahul6603 @mherman22 @Moses_Mutesasira

---

<div class="post-metadata">

### Author: ![mherman22](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.openelis-global.org/mherman22/32/92_2.png) [@mherman22](https://talk.openelis-global.org/u/mherman22)
#### Post date: [November 19, 2024, 9:20am UTC](https://talk.openelis-global.org/t/java-lang-assertionerror-formatted-notes-should-not-be-null/948/2 "2024-11-19T09:20:15Z")

</div>

> [@Agaba\_Derrick\_Junior](#):
>
> getNotesAsString

Have you tried debugging the code? for example adding this line `System.out.println("persisted sample" + persistedSample)` below this line `Sample persistedSample = sampleService.getSampleByAccessionNumber(accessionNumber);`

---

<div class="post-metadata">

### Author: ![segujja\_joseph](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.openelis-global.org/segujja_joseph/32/78_2.png) [@segujja\_joseph](https://talk.openelis-global.org/u/segujja_joseph)
#### Post date: [November 21, 2024, 8:57am UTC](https://talk.openelis-global.org/t/java-lang-assertionerror-formatted-notes-should-not-be-null/948/3 "2024-11-21T08:57:17Z")

</div>

yes try to print it out in the console and see then take a look at the logic or data base see if its stored usually it might not be store and if thyou’re using different inherrent services to feed into what your testing you might as well do the same debug for those too to see which one is actually failing to insert data and why

---

<div class="post-metadata">

### Author: ![Agaba\_Derrick\_Junior](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.openelis-global.org/agaba_derrick_junior/32/503_2.png) [@Agaba\_Derrick\_Junior](https://talk.openelis-global.org/u/Agaba_Derrick_Junior)
#### Post date: [December 26, 2024, 2:09pm UTC](https://talk.openelis-global.org/t/java-lang-assertionerror-formatted-notes-should-not-be-null/948/4 "2024-12-26T14:09:10Z")

</div>

to be more specific, iam still facing this issue  
i have written this [method](https://pastebin.com/rmFU09Qf) and i have added some `System.out.println`to trace the errors in this [way](https://pastebin.com/98EdyG0z).  
but i keep getting this [error](https://pastebin.com/VKWyufiA) in evry test i have written  
somehow i reallythink its about retrieving the note from the Db i still cant figure out how to make this work logically !  
This is my whole [suite](https://pastebin.com/u5vKBd2M)  
@mherman22 @Moses_Mutesasira
