-
- thrown.expect(PAPException.class);
- engine.copyPolicy(pdpPolicy, newGroup);
- fail("Expecting an exception.");
+ assertThatExceptionOfType(PAPException.class).isThrownBy(() ->
+ engine.copyPolicy(pdpPolicy, newGroup)
+ );
+
+ assertThatExceptionOfType(PAPException.class).isThrownBy(() ->
+ engine.removePolicy(null, group)
+ );
+
+ assertThatExceptionOfType(PAPException.class).isThrownBy(() ->
+ engine.copyPolicy(null, null)
+ );
+
+ //
+ // Change the mockito to take a different path
+ //
+ assertThatExceptionOfType(PAPException.class).isThrownBy(() ->
+ setupConnection(HttpServletResponse.SC_FOUND, "localhost:5678")
+ );
+
+ assertThatExceptionOfType(PAPException.class).isThrownBy(() ->
+ setupConnection(200, "localhost:5678")
+ );
+
+ assertThatExceptionOfType(PAPException.class).isThrownBy(() ->
+ setupConnection(350, "localhost:5678")
+ );
+
+ assertThatExceptionOfType(PAPException.class).isThrownBy(() ->
+ setupConnection(500, "localhost:5678")
+ );
+
+ assertThatExceptionOfType(PAPException.class).isThrownBy(() ->
+ setupConnection(350, null)
+ );