- @Test
- public void testTallyHo() throws CadiException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
- AuthzTransOnlyFilter aTF = new AuthzTransOnlyFilter(authzEnvMock);
- LogTarget log = mock(LogTarget.class);
- Metric met = new Metric();
- met.total = 199.33F;
- met.entries = 15;
- met.buckets = new float[] {199.33F,99.33F};
- Class c = aTF.getClass();
- Class[] cArg = new Class[1];
- cArg[0] = AuthzTrans.class; //Steps to test a protected method
- StringBuilder sb = new StringBuilder("AuditTrail\n");
- when(authzTransMock.auditTrail(anyInt(),(StringBuilder)any(),anyInt(),anyInt())).thenReturn(met);
- when(authzTransMock.info()).thenReturn(log);
- doNothing().when(log).log((StringBuilder)any());
- Method tallyHoMethod = c.getDeclaredMethod("tallyHo", cArg);
- tallyHoMethod.setAccessible(true);
- tallyHoMethod.invoke(aTF,authzTransMock);
- }
+ @Test
+ public void testTallyHo() throws CadiException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ AuthzTransOnlyFilter aTF = new AuthzTransOnlyFilter(authzEnvMock);
+ LogTarget log = mock(LogTarget.class);
+ Metric met = new Metric();
+ met.total = 199.33F;
+ met.entries = 15;
+ met.buckets = new float[] {199.33F,99.33F};
+ Class c = aTF.getClass();
+ Class[] cArg = new Class[1];
+ cArg[0] = AuthzTrans.class; //Steps to test a protected method
+ StringBuilder sb = new StringBuilder("AuditTrail\n");
+ when(authzTransMock.auditTrail(anyInt(),(StringBuilder)any(),anyInt(),anyInt())).thenReturn(met);
+ when(authzTransMock.info()).thenReturn(log);
+ doNothing().when(log).log((StringBuilder)any());
+ Method tallyHoMethod = c.getDeclaredMethod("tallyHo", cArg);
+ tallyHoMethod.setAccessible(true);
+ tallyHoMethod.invoke(aTF,authzTransMock);
+ }