public void log(final Class<?> callingClass, final String methodName, final LogLevel level, final StringBuilder msg) { if (null == msg) { return; } log(callingClass, methodName, level, msg.toString()); }
public void log(final Class<?> callingClass, final String methodName, final LogLevel level, final Throwable t) { getLogger().log(callingClass, methodName, level, t); }
@Override public void endOfTurnProcessing() { getLogger().methodBegin(getClass(), "endOfTurnProcessing()"); checkForDishonoredEnemies(); checkForBrokenEnemies(); // refreshCrippledUnits should happen after checkForDishonoredEnemies, since checkForDishoneredEnemies // wants to examine the units that were considered crippled at the *beginning* of the turn and were attacked. refreshCrippledUnits(); getLogger().methodEnd(getClass(), "endOfTurnProcessing()"); }
/** * Constructor - initializes a new instance of the Princess bot. * @param name The display name. * @param host The host address to which to connect. * @param port The port on the host where to connect. * @param verbosity The verbosity of the bot's reporting and logging. */ public Princess(final String name, final String host, final int port, final LogLevel verbosity) { super(name, host, port); getLogger().setLogLevel(LOGGING_CATEGORY, verbosity); setBehaviorSettings(BehaviorSettingsFactory.getInstance(getLogger()) .DEFAULT_BEHAVIOR); fireControlState = new FireControlState(); pathRankerState = new PathRankerState(); // Start-up precog now, so that it can instantiate its game instance, // and it will stay up-to date. precognition = new Precognition(this); precogThread = new Thread(precognition, "Princess-precognition (" + getName() + ")"); precogThread.start(); }
@Before public void setUp() { mockPathRanker = Mockito.mock(BasicPathRanker.class); MoralUtil mockMoralUtil = Mockito.mock(MoralUtil.class); MMLogger fakeLogger = new FakeLogger(); mockPrincess = Mockito.mock(Princess.class); Mockito.doNothing().when(mockPrincess).log(Mockito.any(Class.class), Mockito.anyString(), Mockito.any(LogLevel.class), Mockito.anyString()); Mockito.when(mockPrincess.getPathRanker(PathRankerType.Basic)).thenReturn(mockPathRanker); Mockito.when(mockPrincess.getPathRanker(Mockito.any(Entity.class))).thenReturn(mockPathRanker); Mockito.when(mockPrincess.getMoralUtil()).thenReturn(mockMoralUtil); Mockito.when(mockPrincess.getLogger()).thenReturn(fakeLogger); }
@Before public void setUp() { final BehaviorSettings mockBehavior = Mockito.mock(BehaviorSettings.class); Mockito.when(mockBehavior.getFallShameValue()).thenReturn(BehaviorSettings.FALL_SHAME_VALUES[5]); Mockito.when(mockBehavior.getBraveryValue()).thenReturn(BehaviorSettings.BRAVERY[5]); Mockito.when(mockBehavior.getHyperAggressionValue()).thenReturn(BehaviorSettings.HYPER_AGGRESSION_VALUES[5]); Mockito.when(mockBehavior.getHerdMentalityValue()).thenReturn(BehaviorSettings.HERD_MENTALITY_VALUES[5]); Mockito.when(mockBehavior.getSelfPreservationValue()).thenReturn(BehaviorSettings.SELF_PRESERVATION_VALUES[5]); mockFireControl = Mockito.mock(FireControl.class); final IHonorUtil mockHonorUtil = Mockito.mock(IHonorUtil.class); Mockito.when(mockHonorUtil.isEnemyBroken(Mockito.anyInt(), Mockito.anyInt(), Mockito.anyBoolean())) .thenReturn(false); final List<Targetable> testAdditionalTargets = new ArrayList<>(); mockFireControlState = Mockito.mock(FireControlState.class); Mockito.when(mockFireControlState.getAdditionalTargets()).thenReturn(testAdditionalTargets); final Map<MovePath.Key, Double> testSuccessProbabilities = new HashMap<>(); mockPathRankerState = Mockito.mock(PathRankerState.class); Mockito.when(mockPathRankerState.getPathSuccessProbabilities()).thenReturn(testSuccessProbabilities); mockPrincess = Mockito.mock(Princess.class); Mockito.when(mockPrincess.getBehaviorSettings()).thenReturn(mockBehavior); Mockito.when(mockPrincess.getFireControl(FireControlType.Basic)).thenReturn(mockFireControl); Mockito.when(mockPrincess.getHomeEdge(Mockito.any(Entity.class))).thenReturn(CardinalEdge.NORTH); Mockito.when(mockPrincess.getHonorUtil()).thenReturn(mockHonorUtil); Mockito.when(mockPrincess.getLogger()).thenReturn(fakeLogger); Mockito.when(mockPrincess.getFireControlState()).thenReturn(mockFireControlState); Mockito.when(mockPrincess.getPathRankerState()).thenReturn(mockPathRankerState); }
mockPrincess = Mockito.mock(Princess.class); Mockito.when(mockPrincess.getFireControl(FireControlType.Basic)).thenReturn(mockFireControl); Mockito.when(mockPrincess.getLogger()).thenReturn(fakeLogger);
final MMLogger fakeLogger = new FakeLogger(); mockPrincess = Mockito.mock(Princess.class); Mockito.when(mockPrincess.getLogger()).thenReturn(fakeLogger);
MMLogger fakeLogger = new FakeLogger(); Princess mockPrincess = Mockito.mock(Princess.class); Mockito.when(mockPrincess.getLogger()).thenReturn(fakeLogger);
if (getLogger().getLogLevel(LOGGING_CATEGORY).toInt() > LogLevel.WARNING.toInt()) { sendChat("deploying unit " + getEntity(entityNum).getChassis(), LogLevel.INFO);