ew00github / HTTPCatClone

Recreation of http.cat
0 stars 0 forks source link

Created a new endpoint "/statusGroup/{status}" #14

Closed ew00github closed 11 months ago

ew00github commented 11 months ago

Created a new endpoint "/statusGroup/{status}" that allows user to view all status codes within a range of 99 codes. Ex. All codes 100-199, 200-299, etc., where the {status} value must be 100, 200, 300, 400, or 500, otherwise a bad request error will be returned.

ew00github commented 11 months ago

I'm sorry but I'm going to need some help here. I made a bunch of unit tests, should have 100% coverage of the statusGroup endpoint's lines. The integration test however, has been kicking my butt for the past few days. I've never used Mockito before or MockMvc, but I tried and it seemed to work for the unit tests, but I keep getting a NullPointerException at Line 161 in the statusGroupEndpointTests.java file. The service seems fine leading up to that line but suddenly becomes null with the mockMvc.perform() method, and I'm completely stumped on what is causing it. It might be something simple but I think I need a fresh pair of eyes on it. Feel free to critique my unit tests too and I can fix them with the next commit.

BradRammel commented 11 months ago

I'm sorry but I'm going to need some help here. I made a bunch of unit tests, should have 100% coverage of the statusGroup endpoint's lines. The integration test however, has been kicking my butt for the past few days. I've never used Mockito before or MockMvc, but I tried and it seemed to work for the unit tests, but I keep getting a NullPointerException at Line 161 in the statusGroupEndpointTests.java file. The service seems fine leading up to that line but suddenly becomes null with the mockMvc.perform() method, and I'm completely stumped on what is causing it. It might be something simple but I think I need a fresh pair of eyes on it. Feel free to critique my unit tests too and I can fix them with the next commit.

I'm going to create a separate branch and push it up to show you how to structure things a little different

ew00github commented 11 months ago

That example branch helped a lot, I knew mine was messy but wow I didn't expect it could be simplified that much. Also, for future branches should I add tests to the existing test classes then?

BradRammel commented 11 months ago

That example branch helped a lot, I knew mine was messy but wow I didn't expect it could be simplified that much. Also, for future branches should I add tests to the existing test classes then?

I'll leave this up to you. It's not really necessary but it's good practice