### Question:
AddressBasedAuthorizer { public boolean isAuthorized(UscAddress sender) { return authorizedKeys.stream() .map(key -> key.getAddress()) .anyMatch(address -> Arrays.equals(address, sender.getBytes())); } AddressBasedAuthorizer(List<ECKey> authorizedKeys, MinimumRequiredCalculation requiredCalculation); boolean isAuthorized(UscAddress sender); boolean isAuthorized(Transaction tx); int getNumberOfAuthorizedKeys(); int getRequiredAuthorizedKeys();  }### Answer:
@Test public void isAuthorized() { AddressBasedAuthorizer auth = new AddressBasedAuthorizer(Arrays.asList( ECKey.fromPrivate(BigInteger.valueOf(100L)), ECKey.fromPrivate(BigInteger.valueOf(101L)), ECKey.fromPrivate(BigInteger.valueOf(102L)) ), AddressBasedAuthorizer.MinimumRequiredCalculation.MAJORITY); for (long n = 100L; n <= 102L; n++) { Transaction mockedTx = mock(Transaction.class); when(mockedTx.getSender()).thenReturn(new UscAddress(ECKey.fromPrivate(BigInteger.valueOf(n)).getAddress())); Assert.assertTrue(auth.isAuthorized(new UscAddress(ECKey.fromPrivate(BigInteger.valueOf(n)).getAddress()))); Assert.assertTrue(auth.isAuthorized(mockedTx)); } Assert.assertFalse(auth.isAuthorized(new UscAddress(ECKey.fromPrivate(BigInteger.valueOf(50L)).getAddress()))); Transaction mockedTx = mock(Transaction.class); when(mockedTx.getSender()).thenReturn(new UscAddress(ECKey.fromPrivate(BigInteger.valueOf(50L)).getAddress())); Assert.assertFalse(auth.isAuthorized(mockedTx)); }