diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-12-20 18:38:08 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-12-21 01:18:09 +0100 |
commit | e8f31cbe437ee969f4dd0490a0409b62b2fd045d (patch) | |
tree | 694203ae0423448b259c924c167ecb5584c36229 /documentapi | |
parent | 5d6f586ccff9880a40366d51f75db5234795c0fc (diff) |
GC deprecated junit assertThat.
Diffstat (limited to 'documentapi')
-rw-r--r-- | documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/RoutingPolicyRepositoryTest.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/RoutingPolicyRepositoryTest.java b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/RoutingPolicyRepositoryTest.java index 2bd7c965fdc..43687254498 100644 --- a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/RoutingPolicyRepositoryTest.java +++ b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/RoutingPolicyRepositoryTest.java @@ -1,19 +1,16 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.documentapi.messagebus.protocol; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class RoutingPolicyRepositoryTest { - @Rule - public ExpectedException expectedException = ExpectedException.none(); - @Test public void policy_creation_does_not_swallow_exception() { final RoutingPolicyRepository repo = new RoutingPolicyRepository(); @@ -22,10 +19,12 @@ public class RoutingPolicyRepositoryTest { when(factory.createPolicy(anyString())).thenThrow(new IllegalArgumentException("oh no!")); repo.putFactory("foo", factory); - expectedException.expectMessage("oh no!"); - expectedException.expect(IllegalArgumentException.class); - - repo.createPolicy("foo", "bar"); + try { + repo.createPolicy("foo", "bar"); + fail(); + } catch (IllegalArgumentException e) { + assertEquals("oh no!", e.getMessage()); + } } } |