package com.rcarrillocruz.android.openstackdroid;

import android.app.Application;

public class OpenstackdroidApplication extends Application {
	private String token;

	@Override
	public void onCreate() {
		// TODO Auto-generated method stub
		super.onCreate();
	}
	@Override
	public void onTerminate() {
		// TODO Auto-generated method stub
		super.onTerminate();
	}
	public String getToken() {
		return token;
	}
	public void setToken(String token) {
		this.token = token;
	}

}

package com.rcarrillocruz.android.openstackdroid;

import android.app.Application;

public class OpenstackdroidApplication extends Application {
	private String token;
	private String computeEndpoint;
	private String volumeEndpoint;
	private String identityEndpoint;
	private String imageEndpoint;

	@Override
	public void onCreate() {
		// TODO Auto-generated method stub
		super.onCreate();
	}
	@Override
	public void onTerminate() {
		// TODO Auto-generated method stub
		super.onTerminate();
	}
	public String getToken() {
		return token;
	}
	public void setToken(String token) {
		this.token = token;
	}
	public String getComputeEndpoint() {
		return computeEndpoint;
	}
	public void setComputeEndpoint(String computeEndpoint) {
		this.computeEndpoint = computeEndpoint;
	}
	public String getVolumeEndpoint() {
		return volumeEndpoint;
	}
	public void setVolumeEndpoint(String volumeEndpoint) {
		this.volumeEndpoint = volumeEndpoint;
	}
	public String getIdentityEndpoint() {
		return identityEndpoint;
	}
	public void setIdentityEndpoint(String identityEndpoint) {
		this.identityEndpoint = identityEndpoint;
	}
	public String getImageEndpoint() {
		return imageEndpoint;
	}
	public void setImageEndpoint(String imageEndpoint) {
		this.imageEndpoint = imageEndpoint;
	}

}

Add endpoints variables to reuse values among fragments


package water.api;

import hex.SplitFrame;
import water.Key;
import water.fvec.Frame;

public class SplitFrameV2 extends JobV2<SplitFrame, SplitFrameV2> {
  @API(help="dataset")
  public Key<Frame> dataset;

  @API(help="Split ratios - resulting number of split is ratios.length+1", json=true)
  public double[] ratios;

  @API(help="Destination keys for each output frame split.")
  public Key[] destKeys;

  @Override public SplitFrame createImpl() { return new SplitFrame(Key.make(), null); }
}

package water.api;

import hex.SplitFrame;
import water.Key;
import water.fvec.Frame;

public class SplitFrameV2 extends JobV2<SplitFrame, SplitFrameV2> {
  @API(help="dataset")
  public KeyV1.FrameKeyV1 dataset;

  @API(help="Split ratios - resulting number of split is ratios.length+1", json=true)
  public double[] ratios;

  @API(help="Destination keys for each output frame split.")
  public KeyV1[] destKeys;

  @Override public SplitFrame createImpl() { return new SplitFrame(Key.make(), null); }
}

Fix a schema warning in split frame


package uk.ac.ebi.quickgo.annotation.service.statistics;

import java.util.ArrayList;
import java.util.List;
import org.junit.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
import static org.mockito.Mockito.*;

/**
 * Test the operation of the RequiredStatisticsWithGeneProduct class.
 * @author Tony Wardell
 * Date: 22/12/2017
 * Time: 11:05
 * Created with IntelliJ IDEA.
 */
public class RequiredStatisticsWithGeneProductTest {

    private StatisticsTypeConfigurer configurer = mock(StatisticsTypeConfigurer.class);

    @Test
    public void isConstructedProperly() {
        List<RequiredStatisticType> requiredStatisticTypes = new ArrayList<>();
        when(configurer.getConfiguredStatsTypes(anyList())).thenReturn(requiredStatisticTypes);

        RequiredStatisticsWithGeneProduct withGeneProduct = new RequiredStatisticsWithGeneProduct(configurer);
        assertThat(withGeneProduct.getStatsTypes(), hasSize(8));
    }
}

package uk.ac.ebi.quickgo.annotation.service.statistics;

import java.util.ArrayList;
import java.util.List;
import org.junit.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
import static org.mockito.Mockito.*;

/**
 * Test the operation of the RequiredStatisticsWithGeneProduct class.
 * @author Tony Wardell
 * Date: 22/12/2017
 * Time: 11:05
 * Created with IntelliJ IDEA.
 */
public class RequiredStatisticsWithGeneProductTest {

    private StatisticsTypeConfigurer configurer = mock(StatisticsTypeConfigurer.class);

    @Test
    public void isConstructedProperly() {
        List<RequiredStatisticType> requiredStatisticTypes = new ArrayList<>();
        when(configurer.getConfiguredStatsTypes(anyList())).thenReturn(requiredStatisticTypes);

        RequiredStatisticsWithGeneProduct withGeneProduct = new RequiredStatisticsWithGeneProduct(configurer);
        assertThat(withGeneProduct.getStatsTypes(), hasSize(7));
    }
}

Fix test, the expected number was wrong.


package utils;

public class Benchmark {
	public static long getTime() {
		return System.nanoTime();
	}

	public static long getMemory() {
		return Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
	}

	public static void printTime(String description, long startTime, long endTime) {
		long elapsedTime = endTime - startTime;
		double elapsedTimeSecs = elapsedTime/Math.pow(10,9);
		double elapsedTimeMins = elapsedTimeSecs/60;
		System.out.println("# TIME # " + description + ": " + elapsedTime + " ns (" + elapsedTimeSecs + " s) (" + elapsedTimeMins + " mins)");
	}

	public static void printMemory(String description, long startMemory, long endMemory) {
		long usedMemory = endMemory - startMemory;
		double usedMemoryMega = usedMemory/(1024L * 1024L);
		System.out.println("# MEMORY # " + description + ": " + usedMemory + " B (" + usedMemoryMega + " MB)");
	}
}

package utils;

public class Benchmark {
	public static long getTime() {
		return System.nanoTime();
	}

	public static long getMemory() {
		return Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
	}

	public static void printTime(String description, long startTime, long endTime) {
		long elapsedTime = endTime - startTime;
		double elapsedTimeSecs = elapsedTime/Math.pow(10,9);
		double elapsedTimeMins = elapsedTimeSecs/60;
		System.out.println("# TIME # " + description + ": " + elapsedTime + " ns (" + elapsedTimeSecs + " s) (" + elapsedTimeMins + " mins)");
	}

	public static void printMemory(String description, long startMemory, long endMemory) {
		long usedMemory = endMemory - startMemory;
		double usedMemoryMega = ((double) usedMemory/(double) (1024L * 1024L));
		System.out.println("# MEMORY # " + description + ": " + usedMemory + " B (" + usedMemoryMega + " MB)");
	}
}

Change integral division to double division.


package org.fundacionjala.automation.scenario.steps.tablet.editMeeting;

import org.fundacionjala.automation.framework.utils.api.managers.MeetingAPIManager;
import org.fundacionjala.automation.framework.utils.api.objects.admin.Meeting;
import org.fundacionjala.automation.framework.utils.common.PropertiesReader;
import org.fundacionjala.automation.framework.utils.common.RMGenerator;

import cucumber.api.java.en.Given;

public class EditMeetingGivenSteps {

    @Given("^I had a created meeting with \"([^\"]*)\" organizer, with \"([^\"]*)\" subject in the \"([^\"]*)\" room$")
    public void IHadAMeetingCreated(String organizer, String subject,
	    String room) throws Throwable {

	String startDate = RMGenerator.getIsoTime(0);
	String endDate = RMGenerator.getIsoTime(1);
	String roomEmail = room + "@" + PropertiesReader.getExchangeDomain();
       Meeting meeting = new Meeting(organizer, subject, startDate, endDate,
	       room, roomEmail, roomEmail, PropertiesReader.getExchangeInviteUser());
       MeetingAPIManager.postRequest(room, meeting);
    }
}

package org.fundacionjala.automation.scenario.steps.tablet.editMeeting;

import org.fundacionjala.automation.framework.utils.api.managers.MeetingAPIManager;
import org.fundacionjala.automation.framework.utils.api.objects.admin.Meeting;
import org.fundacionjala.automation.framework.utils.common.PropertiesReader;
import org.fundacionjala.automation.framework.utils.common.RMGenerator;

import cucumber.api.java.en.Given;

public class EditMeetingGivenSteps {

    @Given("^I had a created meeting with \"([^\"]*)\" organizer, with \"([^\"]*)\" subject in the \"([^\"]*)\" room$")
    public void IHadAMeetingCreated(String organizer, String subject,
	    String room) throws Throwable {

	String startDate = RMGenerator.getIsoTime(0);
	String endDate = RMGenerator.getIsoTime(1);
	String roomEmail = room + "@" + PropertiesReader.getExchangeDomain();
       Meeting meeting = new Meeting(organizer, subject, startDate, endDate,
	       room, roomEmail, roomEmail, PropertiesReader.getExchangeInviteMail());
       MeetingAPIManager.postRequest(room, meeting);
    }
}

FIx scenario: Step editMeetingSteps change the attendee value in create meeting with api


package seedu.task.model.task;

import seedu.task.commons.exceptions.IllegalValueException;

/**
 * Represents a Task's name in the task manager.
 * Guarantees: immutable; is valid as declared in {@link #isValidName(String)}
 */
public class TaskName {

    public static final String MESSAGE_NAME_CONSTRAINTS = "Task names should be spaces or alphanumeric characters";
    public static final String NAME_VALIDATION_REGEX = "[\\p{Alnum} ]+";

    public final String fullName;

    /**
     * Validates given name.
     *
     * @throws IllegalValueException if given name string is invalid.
     */
    public TaskName(String name) throws IllegalValueException {
        assert name != null;
        name = name.trim();
        if (!isValidName(name)) {
            throw new IllegalValueException(MESSAGE_NAME_CONSTRAINTS);
        }
        this.fullName = name;
    }

    /**
     * Returns true if a given string is a valid task name.
     */
    public static boolean isValidName(String test) {
        return test.matches(NAME_VALIDATION_REGEX);
    }

    @Override
    public String toString() {
        return fullName;
    }

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof TaskName // instanceof handles nulls
                && this.fullName.equals(((TaskName) other).fullName)); // state check
    }

    @Override
    public int hashCode() {
        return fullName.hashCode();
    }

}

package seedu.task.model.task;

import seedu.task.commons.exceptions.IllegalValueException;

/**
 * Represents a Task's name in the task manager.
 * Guarantees: immutable; is valid as declared in {@link #isValidName(String)}
 */
public class TaskName {

    public static final String MESSAGE_NAME_CONSTRAINTS = "Task names should be spaces or alphanumeric characters";
    public static final String NAME_VALIDATION_REGEX = "[\\p{Alnum} ]+";

    public final String fullName;

    /**
     * Validates given name.
     *
     * @throws IllegalValueException if given name string is invalid.
     */
    public TaskName(String name) throws IllegalValueException {
        assert name != null ;
        if (name != null)
            name = name.trim();
        if (name == null || !isValidName(name)) {
            throw new IllegalValueException(MESSAGE_NAME_CONSTRAINTS);
        }
        this.fullName = name;
    }

    /**
     * Returns true if a given string is a valid task name.
     */
    public static boolean isValidName(String test) {
        return test.matches(NAME_VALIDATION_REGEX);
    }

    @Override
    public String toString() {
        return fullName;
    }

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof TaskName // instanceof handles nulls
                && this.fullName.equals(((TaskName) other).fullName)); // state check
    }

    @Override
    public int hashCode() {
        return fullName.hashCode();
    }

}

Fix nullPointerException on "edit" command


package coderefactory.net.popmovies;

import android.app.Activity;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import java.util.List;

public class MovieAdapter extends ArrayAdapter<Movie> {

    public MovieAdapter(final Activity context, final List<Movie> movies) {
        super(context, 0, movies);
    }

    @NonNull
    @Override
    public View getView(final int position, final View convertView, final ViewGroup parent) {
        final View rootView;
        if (convertView == null) {
            rootView = LayoutInflater.from(getContext()).inflate(R.layout.list_item_movie, parent, false);
        } else {
            rootView = convertView;
        }
        final Movie movie = getItem(position);

        final TextView titleView = (TextView) rootView.findViewById(R.id.movie_title);
        titleView.setText(movie.getTitle());

        final TextView releaseView = (TextView) rootView.findViewById(R.id.movie_released);
        releaseView.setText(String.valueOf(movie.getReleased()));

        return rootView;
    }
}

package coderefactory.net.popmovies;

import android.app.Activity;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import java.util.List;

public class MovieAdapter extends ArrayAdapter<Movie> {

    private ViewHolder viewHolder;

    public MovieAdapter(final Activity context, final List<Movie> movies) {
        super(context, 0, movies);
    }

    @NonNull
    @Override
    public View getView(final int position, final View convertView, final ViewGroup parent) {
        final View itemView;
        if (convertView == null) {
            itemView = LayoutInflater.from(getContext()).inflate(R.layout.list_item_movie, parent, false);
            viewHolder = new ViewHolder(itemView);
            itemView.setTag(viewHolder);
        } else {
            itemView = convertView;
            viewHolder = (ViewHolder) convertView.getTag();
        }

        populateView(position);

        return itemView;
    }

    private void populateView(final int position) {
        final Movie movie = getItem(position);

        viewHolder.titleView.setText(movie.getTitle());
        viewHolder.releaseView.setText(String.valueOf(movie.getReleased()));
    }

    private static class ViewHolder {
        private final TextView titleView;
        private final TextView releaseView;

        private ViewHolder(final View itemView) {
            titleView = (TextView) itemView.findViewById(R.id.movie_title);
            releaseView = (TextView) itemView.findViewById(R.id.movie_released);
        }
    }
}

Introduce ViewHolder pattern into ArrayAdapter


package io.undertow.server.handlers;

import java.util.Date;

import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.util.DateUtils;
import io.undertow.util.Headers;

/**
 * Class that adds the Date: header to a HTTP response.
 *
 * The current date string is cached, and is updated every second in a racey
 * manner (i.e. it is possible for two thread to update it at once).
 *
 * @author Stuart Douglas
 */
public class DateHandler implements HttpHandler {

    private final HttpHandler next;
    private volatile String cachedDateString;
    private volatile long nextUpdateTime = -1;

    public DateHandler(final HttpHandler next) {
        this.next = next;
    }

    @Override
    public void handleRequest(final HttpServerExchange exchange) throws Exception {
        long time = System.currentTimeMillis();
        if(time < nextUpdateTime) {
            exchange.getResponseHeaders().put(Headers.DATE, cachedDateString);
        } else {
            nextUpdateTime = time + 1000;
            String dateString = DateUtils.toDateString(new Date(time));
            cachedDateString = dateString;
            exchange.getResponseHeaders().put(Headers.DATE, dateString);
        }
        next.handleRequest(exchange);
    }

}

package io.undertow.server.handlers;

import java.util.Date;

import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.util.DateUtils;
import io.undertow.util.Headers;

/**
 * Class that adds the Date: header to a HTTP response.
 *
 * The current date string is cached, and is updated every second in a racey
 * manner (i.e. it is possible for two thread to update it at once).
 *
 * @author Stuart Douglas
 */
public class DateHandler implements HttpHandler {

    private final HttpHandler next;
    private volatile String cachedDateString;
    private volatile long nextUpdateTime = -1;

    public DateHandler(final HttpHandler next) {
        this.next = next;
    }

    @Override
    public void handleRequest(final HttpServerExchange exchange) throws Exception {
        long time = System.currentTimeMillis();
        if(time < nextUpdateTime) {
            exchange.getResponseHeaders().put(Headers.DATE, cachedDateString);
        } else {
            String dateString = DateUtils.toDateString(new Date(time));
            cachedDateString = dateString;
            nextUpdateTime = time + 1000;
            exchange.getResponseHeaders().put(Headers.DATE, dateString);
        }
        next.handleRequest(exchange);
    }

}

Change order that fields are updated


/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.trino.cli;

public final class Help
{
    private Help() {}

    public static String getHelpText()
    {
        return "" +
                "Supported commands:\n" +
                "QUIT\n" +
                "CLEAR\n" +
                "EXPLAIN [ ( option [, ...] ) ] <query>\n" +
                "    options: FORMAT { TEXT | GRAPHVIZ | JSON }\n" +
                "             TYPE { LOGICAL | DISTRIBUTED | VALIDATE | IO }\n" +
                "DESCRIBE <table>\n" +
                "SHOW COLUMNS FROM <table>\n" +
                "SHOW FUNCTIONS\n" +
                "SHOW CATALOGS [LIKE <pattern>]\n" +
                "SHOW SCHEMAS [FROM <catalog>] [LIKE <pattern>]\n" +
                "SHOW TABLES [FROM <schema>] [LIKE <pattern>]\n" +
                "USE [<catalog>.]<schema>\n" +
                "";
    }
}

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.trino.cli;

public final class Help
{
    private Help() {}

    public static String getHelpText()
    {
        return "" +
                "Supported commands:\n" +
                "QUIT\n" +
                "EXIT\n" +
                "CLEAR\n" +
                "EXPLAIN [ ( option [, ...] ) ] <query>\n" +
                "    options: FORMAT { TEXT | GRAPHVIZ | JSON }\n" +
                "             TYPE { LOGICAL | DISTRIBUTED | VALIDATE | IO }\n" +
                "DESCRIBE <table>\n" +
                "SHOW COLUMNS FROM <table>\n" +
                "SHOW FUNCTIONS\n" +
                "SHOW CATALOGS [LIKE <pattern>]\n" +
                "SHOW SCHEMAS [FROM <catalog>] [LIKE <pattern>]\n" +
                "SHOW TABLES [FROM <schema>] [LIKE <pattern>]\n" +
                "USE [<catalog>.]<schema>\n" +
                "";
    }
}

Add exit command to the help text


package io.qala.datagen;

public class Vocabulary {
    /** Can be globally overwritten for your particular project. */
    public static String SPECIAL_SYMBOLS = "!@#$%^&*()_+{}[]'\"|:?><~`§\\,";

    static char[] specialSymbols() {
        return SPECIAL_SYMBOLS.toCharArray();
    }
}

package io.qala.datagen;

public class Vocabulary {
    /** Can be globally overwritten for your particular project. */
    public static String SPECIAL_SYMBOLS = "!@#$%^&*()_+{}[]'\"|:?><~`§\\,/;.";

    static char[] specialSymbols() {
        return SPECIAL_SYMBOLS.toCharArray();
    }
}

Add couple of special symbols to vocabulary


package shared;
/**
 *
 */

/**
 *
 * @author David Lecoconnier david.lecoconnier@gmail.com
 * @author Jean-Luc Amitousa-Mankoy jeanluc.amitousa.mankoy@gmail.com
 * @version 1.0
 */
public class Constants {

	/**
	 * Socket port for objects transmission
	 */
	public static int SOCKET_OBJECT_PORT = 2000;

	/**
	 * Socket port for commands transmission
	 */
	public static int SOCKET_INSTRUCTION_PORT = 2001;

}

package shared;
/**
 *
 */

/**
 *
 * @author David Lecoconnier david.lecoconnier@gmail.com
 * @author Jean-Luc Amitousa-Mankoy jeanluc.amitousa.mankoy@gmail.com
 * @version 1.0
 */
public class Constants {

	/**
	 * Socket port for objects transmission
	 */
	public static int SOCKET_OBJECT_PORT = 2000;

	/**
	 * Socket port for commands transmission
	 */
	public static int SOCKET_COMMAND_PORT = 2001;

}

Change name to improve comprehension


package me.jjm_223.pt;

import me.jjm_223.pt.listeners.EggClick;
import me.jjm_223.pt.listeners.EggHit;
import me.jjm_223.pt.listeners.ItemDespawn;
import me.jjm_223.pt.utils.DataStorage;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;

/**
 * Main class for PetTransportation.
 */
public class PetTransportation extends JavaPlugin {

    private DataStorage storage;

    @Override
    public void onEnable() {
        //Register relevant events.
        PluginManager pm = getServer().getPluginManager();
        pm.registerEvents(new EggHit(this), this);
        pm.registerEvents(new EggClick(this), this);
        pm.registerEvents(new ItemDespawn(this), this);

        storage = new DataStorage(this);
    }

    @Override
    public void onDisable() {
        try {
            storage.save();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public DataStorage getStorage()
    {
        return this.storage;
    }
}

package me.jjm_223.pt;

import me.jjm_223.pt.listeners.EggClick;
import me.jjm_223.pt.listeners.EggHit;
import me.jjm_223.pt.listeners.ItemDespawn;
import me.jjm_223.pt.utils.DataStorage;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;

/**
 * Main class for PetTransportation.
 */
public class PetTransportation extends JavaPlugin {

    private DataStorage storage;

    @Override
    public void onEnable() {
        storage = new DataStorage(this);

        PluginManager pm = getServer().getPluginManager();
        pm.registerEvents(new EggHit(this), this);
        pm.registerEvents(new EggClick(this), this);
        pm.registerEvents(new ItemDespawn(this), this);
    }

    @Override
    public void onDisable() {
        try {
            storage.save();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public DataStorage getStorage()
    {
        return this.storage;
    }
}

Fix NPE on item despawn or destroy.


package appstore;

import static org.junit.Assert.*;

import org.junit.Ignore;
import org.junit.Test;

public class TestThisWillFailAbunch {
    @Test
    public void aFailingTest() {
         assertTrue("I expected this to pass!", true);
    }

    @Ignore
    @Test
    public void aFailingTest2() {
         assertTrue("I expected this to pass!", true);
    }

    @Ignore
    @Test
    public void aFailingTest3() {
         assertTrue("I expected this to pass!", false);
    }

    //@Ignore
    @Test
    public void aFailingTest4() {
        doSomething();
    }

    @Ignore
    @Test
    public void aNewFailingTest31() {
         assertTrue("I expected this to pass!", true);
    }

    @Test
    public void aNotherNewFailingTest4() {
         assertTrue("I expected this to pass!", true);
    }

    @Test
    public void aFailingTest5() {
        doSomething();
    }

    @Test
    public void aFailingTest6() {
         assertTrue("I expected this to pass!", false);
    }

    @Test
    public void aPassingTest3() {
         assertTrue("Success!", true);
    }

    @Test
    public void aPassingTest4() {
         assertTrue("Success!", true);
    }

    private void doSomething() {
        interesting();
    }
    private void interesting() {
        RubeGoldburgMachine machine = new RubeGoldburgMachine();
        machine.processPayment();
    }

    private class RubeGoldburgMachine {
        void processPayment() {
            throw new IllegalStateException("bad payment code");
        }
    }
}

package appstore;

import static org.junit.Assert.*;

import org.junit.Ignore;
import org.junit.Test;

public class TestThisWillFailAbunch {
    @Test
    public void aFailingTest() {
         assertTrue("I expected this to pass!", true);
    }

    @Ignore
    @Test
    public void aFailingTest2() {
         assertTrue("I expected this to pass!", true);
    }

    @Ignore
    @Test
    public void aFailingTest3() {
         assertTrue("I expected this to pass!", false);
    }

    //@Ignore
    @Test
    public void aFailingTest4() {
        assertTrue("I expected this to pass!", true);
    }

    @Ignore
    @Test
    public void aNewFailingTest31() {
         assertTrue("I expected this to pass!", true);
    }

    @Test
    public void aNotherNewFailingTest4() {
         assertTrue("I expected this to pass!", true);
    }

    @Test
    public void aFailingTest5() {
        assertTrue("I expected this to pass!", true);
    }

    @Test
    public void aFailingTest6() {
         assertTrue("I expected this to pass!", false);
    }

    @Test
    public void aPassingTest3() {
         assertTrue("Success!", true);
    }

    @Test
    public void aPassingTest4() {
         assertTrue("Success!", true);
    }

    private void doSomething() {
        interesting();
    }
    private void interesting() {
        RubeGoldburgMachine machine = new RubeGoldburgMachine();
        machine.processPayment();
    }

    private class RubeGoldburgMachine {
        void processPayment() {
            throw new IllegalStateException("bad payment code");
        }
    }
}

Fix payment processor test failures


package seedu.geekeep.model.task;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

public class TitleTest {

    @Test
    public void isValidTitle() {
        // invalid name
        assertFalse(Title.isValidTitle("")); // empty string
        assertFalse(Title.isValidTitle(" ")); // spaces only
        assertFalse(Title.isValidTitle("^")); // only non-alphanumeric characters
        assertFalse(Title.isValidTitle("peter*")); // contains non-alphanumeric characters

        // valid name
        assertTrue(Title.isValidTitle("peter jack")); // alphabets only
        assertTrue(Title.isValidTitle("12345")); // numbers only
        assertTrue(Title.isValidTitle("peter the 2nd")); // alphanumeric characters
        assertTrue(Title.isValidTitle("Capital Tan")); // with capital letters
        assertTrue(Title.isValidTitle("David Roger Jackson Ray Jr 2nd")); // long names
    }
}

package seedu.geekeep.model.task;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

public class TitleTest {

    @Test
    public void isValidTitle() {
        // invalid title
        assertFalse(Title.isValidTitle("")); // empty string
        assertFalse(Title.isValidTitle(" ")); // spaces only
        assertFalse(Title.isValidTitle("^")); // only non-alphanumeric characters
        assertFalse(Title.isValidTitle("peter*")); // contains non-alphanumeric characters

        // valid title
        assertTrue(Title.isValidTitle("peter jack")); // alphabets only
        assertTrue(Title.isValidTitle("12345")); // numbers only
        assertTrue(Title.isValidTitle("peter the 2nd")); // alphanumeric characters
        assertTrue(Title.isValidTitle("Capital Tan")); // with capital letters
        assertTrue(Title.isValidTitle("David Roger Jackson Ray Jr 2nd")); // long names
    }
}

Rename "[in]valid name" to "[in]valid title"


/**
 * Copyright (c) 2012-2012 Malhar, Inc.
 * All rights reserved.
 */
package com.malhartech.util;

import java.io.Serializable;

public class Pair<F, S> implements Serializable {
  private static final long serialVersionUID = 731157267102567944L;

  private F first;
  private S second;

  public Pair(F first, S second) {
      this.first = first;
      this.second = second;
  }

  public void setFirst(F first) {
      this.first = first;
  }

  public void setSecond(S second) {
      this.second = second;
  }

  public F getFirst() {
      return first;
  }

  public S getSecond() {
      return second;
  }

  @Override
  public String toString() {
    return "[" + first + "," + second + "]";
  }

}

/**
 * Copyright (c) 2012-2012 Malhar, Inc.
 * All rights reserved.
 */
package com.malhartech.util;

import java.io.Serializable;

public class Pair<F, S> implements Serializable
{
  private static final long serialVersionUID = 731157267102567944L;
  public final F first;
  public final S second;

  @Override
  public int hashCode()
  {
    int hash = 7;
    hash = 41 * hash + (this.first != null ? this.first.hashCode() : 0);
    hash = 41 * hash + (this.second != null ? this.second.hashCode() : 0);
    return hash;
  }

  @Override
  public boolean equals(Object obj)
  {
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    @SuppressWarnings("unchecked")
    final Pair<F, S> other = (Pair<F, S>)obj;
    if (this.first != other.first && (this.first == null || !this.first.equals(other.first))) {
      return false;
    }
    if (this.second != other.second && (this.second == null || !this.second.equals(other.second))) {
      return false;
    }
    return true;
  }

  public Pair(F first, S second)
  {
    this.first = first;
    this.second = second;
  }

  public F getFirst()
  {
    return first;
  }

  public S getSecond()
  {
    return second;
  }

  @Override
  public String toString()
  {
    return "[" + first + "," + second + "]";
  }

}

Introduce hashcode and equals property.


/*
Copyright 2011-2015 Stefano Cappa

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package gui.kcomponent;

import gui.image.ImageLoader;

import javax.swing.JFrame;

import update.Version;

/**
 *	Classe che crea un JFrame personalizzato con icona, dimensione preferita, titolo,
 *	posizione e soprattutto lo sfondo, richiamando il PanelPersonalizzato.
 */
public class KFrame extends JFrame{
	private static final long serialVersionUID = 6729366260424934194L;
	private static final String NOME = "BYAManager - " +  Version.VERSION + " - by Stefano Cappa";

	public KFrame() {
		setTitle(NOME);
		setIconImage(ImageLoader.getInstance().getIconaBya());
		getLayeredPane().setOpaque(false);
		getRootPane().setOpaque(false);

		this.setContentPane(new KPanel());
	}
}

/*
Copyright 2011-2015 Stefano Cappa

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package gui.kcomponent;

import gui.image.ImageLoader;

import javax.swing.JFrame;

import update.Version;

/**
 *	Classe che crea un JFrame personalizzato con icona, dimensione preferita, titolo,
 *	posizione e soprattutto lo sfondo, richiamando il PanelPersonalizzato.
 */
public class KFrame extends JFrame{
	private static final long serialVersionUID = 6729366260424934194L;
	private static final String NOME = "BYAManager - " +  "0.5.6" + " - by Stefano Cappa";

	public KFrame() {
		setTitle(NOME);
		setIconImage(ImageLoader.getInstance().getIconaBya());
		getLayeredPane().setOpaque(false);
		getRootPane().setOpaque(false);

		this.setContentPane(new KPanel());
	}
}

Fix versione nel Frame della gui


package mazegenerator;

import java.util.ArrayList;
import java.util.Arrays;
import util.MathUtil;

/**
 *
 * @author mallory
 */
public class MazeGenerator {

    public static void main(String[] args) throws Exception {
//        byte value = 0;
//        for(; value < 33; value++){
//            MazeTile tile = new MazeTile(value);
//            System.out.println(tile + " " + value);
//            System.out.println();
//        }
//        MazeTile[][] maze = new MazeTile[2][2];
//        maze[0][0] = new MazeTile(true,false,true,false);
//        maze[0][1] = new MazeTile(false,true,true,false);
//        maze[1][0] = new MazeTile(true,false,false,true);
//        maze[1][1] = new MazeTile(false,true,false,true);
        Maze maze = new Maze(47, 11, 1,1);
        //Test
        maze.generate();

        System.out.print(maze.toString());
    }

}

package mazegenerator;

import java.util.ArrayList;
import java.util.Arrays;
import util.MathUtil;

/**
 *
 * @author mallory
 */
public class MazeGenerator {

    public static void main(String[] args) throws Exception {
//        byte value = 0;
//        for(; value < 33; value++){
//            MazeTile tile = new MazeTile(value);
//            System.out.println(tile + " " + value);
//            System.out.println();
//        }
//        MazeTile[][] maze = new MazeTile[2][2];
//        maze[0][0] = new MazeTile(true,false,true,false);
//        maze[0][1] = new MazeTile(false,true,true,false);
//        maze[1][0] = new MazeTile(true,false,false,true);
//        maze[1][1] = new MazeTile(false,true,false,true);
        Maze maze = new Maze(47, 11, 1,1);
        //Test
        //Test 2
        maze.generate();

        System.out.print(maze.toString());
    }

}

Test Commit. Attempt to fix username.


package cn.hjmao.dao.minor;

import org.testng.annotations.Test;

import static org.testng.Assert.*;

/**
 * Created by hjmao on 3/24/16.
 */
public class MainTest {

  @Test
  public void testAdd() throws Exception {
    int a = 3;
    int b = 4;
    assertEquals(Main.add(a, b), a + b);
  }
}

package cn.hjmao.dao.minor;

import org.testng.annotations.Test;

import static org.testng.Assert.*;

/**
 * Created by hjmao on 3/24/16.
 */
public class MainTest {

  @Test
  public void testConstruct() throws Exception {
    assertNotNull(new Main());
  }

  @Test
  public void testAdd() throws Exception {
    int a = 3;
    int b = 4;
    assertEquals(Main.add(a, b), a + b);
  }
}

Make test coverage to 100%.


package org.apache.cordova.firebase;

import com.google.firebase.messaging.RemoteMessage;

import java.util.ArrayList;
import java.util.List;

public class FirebasePluginMessageReceiverManager {
    private static List<FirebasePluginMessageReceiver> receivers = new ArrayList<>();

    public static void register(FirebasePluginMessageReceiver receiver){
        receivers.add(receiver);
    }

    public static boolean onMessageReceived(RemoteMessage remoteMessage){
        boolean handled = false;
        for(FirebasePluginMessageReceiver receiver : receivers){
            boolean wasHandled = receiver.onMessageReceived(remoteMessage);
            if(wasHandled){
                handled = true;
            }
        }
        return handled;
    }
}

package org.apache.cordova.firebase;

import com.google.firebase.messaging.RemoteMessage;

import java.util.ArrayList;
import java.util.List;

public class FirebasePluginMessageReceiverManager {
    private static List<FirebasePluginMessageReceiver> receivers = new ArrayList<FirebasePluginMessageReceiver>();

    public static void register(FirebasePluginMessageReceiver receiver){
        receivers.add(receiver);
    }

    public static boolean onMessageReceived(RemoteMessage remoteMessage){
        boolean handled = false;
        for(FirebasePluginMessageReceiver receiver : receivers){
            boolean wasHandled = receiver.onMessageReceived(remoteMessage);
            if(wasHandled){
                handled = true;
            }
        }
        return handled;
    }
}

Replace <> operator to make code compatible with JDK 1.6


package de.swm.nis.logicaldecoding;

import org.springframework.stereotype.Component;

@Component
public class VersionHelper {

	public String determineVersion() {
		return "LogicalDeoding v.1.0.1-SNAPSHOT";
	}

}

package de.swm.nis.logicaldecoding;

import java.io.IOException;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.stereotype.Component;

@Component
public class VersionHelper {

	@Autowired
	ApplicationContext ctx;

	private static final Logger log = LoggerFactory.getLogger(RefreshCacheService.class);

	public String determineVersion() {
		return "LogicalDecoding v("+ determineMavenVersion() + ") - git: "+determineGitVersion();
	}

	public String determineGitVersion() {
		String gitVersion = "";
		Resource resource = ctx.getResource("classpath:git.properties");
		try {
			Properties gitProperties = PropertiesLoaderUtils.loadProperties(resource);
			gitVersion = (String) gitProperties.get("git.commit.id.describe");
		} catch (IOException e) {
			log.warn("IOException while determining git version", e);
		}
		return gitVersion;
	}

	public String determineMavenVersion() {
		String mavenVersion = "";
		Resource resource = ctx.getResource("classpath:META-INF/MANIFEST.MF");
		try {
			Properties mavenProperties = PropertiesLoaderUtils.loadProperties(resource);
			mavenVersion = (String) mavenProperties.get("Implementation-Version");
		} catch (IOException e) {
			log.warn("IOException while determining maven version", e);
		}
		return mavenVersion;
	}

}

Determine Version and hash of Build on startup


package seedu.address.logic.commands;

/**
 * Lists all persons in the address book to the user.
 */
public class ListCommand extends Command {

    public static final String COMMAND_WORD = "list";

    public static final String MESSAGE_SUCCESS = "Listed all tasks";

    public ListCommand() {}

    @Override
    public CommandResult execute() {
        model.updateFilteredListToShowAll();
        return new CommandResult(MESSAGE_SUCCESS);
    }
}

package seedu.address.logic.commands;

/**
 * Lists all persons in the address book to the user.
 */
public class ListCommand extends Command {

    public static final String COMMAND_WORD = "listall";

    public static final String MESSAGE_SUCCESS = "Listed all tasks";

    public ListCommand() {}

    @Override
    public CommandResult execute() {
        model.updateFilteredListToShowAll();
        return new CommandResult(MESSAGE_SUCCESS);
    }
}

Update list command to use the keyword list all


package org.kohsuke.github;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * Content of reactions.
 *
 * @author Kohsuke Kawaguchi
 * @see API documentation
 * @see GHReaction
 */
public enum ReactionContent {
    PLUS_ONE("+1"), MINUS_ONE("-1"), LAUGH("laugh"), CONFUSED("confused"), HEART("heart"), HOORAY("hooray");

    private final String content;

    ReactionContent(String content) {
        this.content = content;
    }

    /**
     * Gets content.
     *
     * @return the content
     */
    @JsonValue
    public String getContent() {
        return content;
    }

    /**
     * For content reaction content.
     *
     * @param content
     *            the content
     * @return the reaction content
     */
    @JsonCreator
    public static ReactionContent forContent(String content) {
        for (ReactionContent c : ReactionContent.values()) {
            if (c.getContent().equals(content))
                return c;
        }
        return null;
    }
}

package org.kohsuke.github;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * Content of reactions.
 *
 * @author Kohsuke Kawaguchi
 * @see API documentation
 * @see GHReaction
 */
public enum ReactionContent {
    PLUS_ONE("+1"),
    MINUS_ONE("-1"),
    LAUGH("laugh"),
    CONFUSED("confused"),
    HEART("heart"),
    HOORAY("hooray"),
    ROCKET("rocket"),
    EYES("eyes");

    private final String content;

    ReactionContent(String content) {
        this.content = content;
    }

    /**
     * Gets content.
     *
     * @return the content
     */
    @JsonValue
    public String getContent() {
        return content;
    }

    /**
     * For content reaction content.
     *
     * @param content
     *            the content
     * @return the reaction content
     */
    @JsonCreator
    public static ReactionContent forContent(String content) {
        for (ReactionContent c : ReactionContent.values()) {
            if (c.getContent().equals(content))
                return c;
        }
        return null;
    }
}

Add support for rocket and eyes reactions.


package rabbit;

public class CommandCreator {

    public String createCommand(String userCommand) {
        String[] tokens =  userCommand.split("\\s+");

        switch(tokens[0]) {
            case "availability":
                return "nmap -sV " + tokens[1];
            case "security":
                switch (tokens[1]) {
                    case "tls":
                        return "nmap --script ssl-enum-ciphers -p 443 " + tokens[2];
                    case "ecrypt2lvl":
                        return "nmap --script ssl-enum-ciphers -p 443" + tokens[2];
                    case "open_ports":
                        return "nmap " + tokens[2];
                    default :
                        return null;
                }
            default :
                return null;
        }
    }
}

package rabbit;

public class CommandCreator {

    public String createCommand(String userCommand) {
        String[] tokens =  userCommand.split("\\s+");

        switch(tokens[0]) {
            case "security":
                switch (tokens[1]) {
                    case "tls":
                        return "nmap --script ssl-enum-ciphers -p 443 " + tokens[2];
                    case "ecrypt2lvl":
                        return "nmap --script ssl-enum-ciphers -p 443" + tokens[2];
                    case "open_ports":
                        return "nmap " + tokens[2];
                    default :
                        return null;
                }
            default :
                return null;
        }
    }
}

Remove check for "availability" command because this case is treated separately.


/**
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
 */
package com.codeup.auth.filters;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

public class AuthenticationFilter implements Filter {
    private String redirectTo;

    public void doFilter(
        ServletRequest req,
        ServletResponse resp,
        FilterChain chain
    ) throws ServletException, IOException {
        HttpServletRequest request = (HttpServletRequest) req;
        HttpSession session = request.getSession(false);

        if (session == null || session.getAttribute("user") == null) {
            ((HttpServletResponse) resp).sendRedirect(redirectTo);
        } else {
            chain.doFilter(req, resp);
        }
    }

    public void destroy() {
    }

    public void init(FilterConfig config) throws ServletException {
        redirectTo = config.getInitParameter("redirectTo");
    }
}

/**
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
 */
package com.codeup.auth.filters;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

public class AuthenticationFilter implements Filter {
    private String redirectTo;

    public void doFilter(
        ServletRequest request,
        ServletResponse response,
        FilterChain chain
    ) throws ServletException, IOException {
        HttpSession session = ((HttpServletRequest) request).getSession(false);

        if (session == null || session.getAttribute("user") == null) {
            ((HttpServletResponse) response).sendRedirect(redirectTo);
        } else {
            chain.doFilter(request, response);
        }
    }

    public void destroy() {
    }

    public void init(FilterConfig config) throws ServletException {
        redirectTo = config.getInitParameter("redirectTo");
    }
}

Fix naming in authentication filter.


package SimpleWriteAndRead;

import com.continuuity.api.data.*;
import com.continuuity.api.flow.flowlet.*;
import com.continuuity.api.flow.flowlet.builders.*;

public class ReaderFlowlet extends AbstractComputeFlowlet {

  @Override
  public void configure(StreamsConfigurator configurator) {
    TupleSchema in = new TupleSchemaBuilder().
        add("key", byte[].class).
        create();
    configurator.getDefaultTupleInputStream().setSchema(in);
  }

  @Override
  public void process(Tuple tuple, TupleContext tupleContext, OutputCollector outputCollector) {
    if (Common.debug)
      System.out.println(this.getClass().getSimpleName() + ": Received tuple " + tuple);

    // perform inline read of key
    byte [] key = tuple.get("key");
    Read read = new Read(key);
    ReadOperationExecutor executor =
      getFlowletLaunchContext().getReadExecutor();
    byte [] value = executor.execute(read).getKeyResult();

    if (Common.debug)
      System.out.println(this.getClass().getSimpleName() + ": Read value (" +
          new String(value) + ") for key (" + new String(key) + ")");

  }
}

package SimpleWriteAndRead;

import com.continuuity.api.data.*;
import com.continuuity.api.flow.flowlet.*;
import com.continuuity.api.flow.flowlet.builders.*;

public class ReaderFlowlet extends AbstractComputeFlowlet {

  @Override
  public void configure(StreamsConfigurator configurator) {
    TupleSchema in = new TupleSchemaBuilder().
        add("key", byte[].class).
        create();
    configurator.getDefaultTupleInputStream().setSchema(in);
  }

  @Override
  public void process(Tuple tuple, TupleContext tupleContext, OutputCollector outputCollector) {
    if (Common.debug)
      System.out.println(this.getClass().getSimpleName() + ": Received tuple " + tuple);

    // perform inline read of key
    byte [] key = tuple.get("key");
    ReadKey read = new ReadKey(key);
    ReadOperationExecutor executor =
      getFlowletLaunchContext().getReadExecutor();
    byte [] value = executor.execute(read);

    if (Common.debug)
      System.out.println(this.getClass().getSimpleName() + ": Read value (" +
          new String(value) + ") for key (" + new String(key) + ")");

  }
}

Change read-write flow to use ReadKey


package co.phoenixlab.discord.api;

/**
 * Contains various useful API URLs and paths
 */
public class ApiConst {

    /**
     * Utility class
     */
    private ApiConst() {
    }

    /**
     * The base URL from which Discord runs
     */
    public static final String BASE_URL = "https://discordapp.com/";
    /**
     * Base API path
     */
    public static final String API_BASE_PATH = BASE_URL + "api";
    /**
     * WebSocket gateway
     */
    public static final String WEBSOCKET_GATEWAY = API_BASE_PATH + "/gateway";
    /**
     * The endpoint for accessing user information
     */
    public static final String USERS_ENDPOINT = API_BASE_PATH + "/users/";
    /**
     * The endpoint for logging in
     */
    public static final String LOGIN_ENDPOINT = API_BASE_PATH + "/auth/login";
    /**
     * The endpoint for logging out
     */
    public static final String LOGOUT_ENDPOINT = API_BASE_PATH + "/auth/logout";
    /**
     * The endpoint for accessing server information
     */
    public static final String SERVERS_ENDPOINT = API_BASE_PATH + "/guilds/";
    /**
     * The endpoint for accessing channel information
     */
    public static final String CHANNELS_ENDPOINT = API_BASE_PATH + "/channels/";
    /**
     * The endpoint for accepting invites
     */
    public static final String INVITE_ENDPOINT = API_BASE_PATH + "/invite/";
    /**
     * The format string for avatar URLs
     */
    public static final String AVATAR_URL_PATTERN = "https://cdn.discordapp.com/avatars/%1$s/%2$s.jpg";

}

package co.phoenixlab.discord.api;

/**
 * Contains various useful API URLs and paths
 */
public class ApiConst {

    /**
     * Utility class
     */
    private ApiConst() {
    }

    /**
     * The base URL from which Discord runs
     */
    public static final String BASE_URL = "https://discordapp.com/";
    /**
     * Base API path
     */
    public static final String API_BASE_PATH = BASE_URL + "api";
    /**
     * WebSocket gateway
     */
    public static final String WEBSOCKET_GATEWAY = API_BASE_PATH + "/gateway";
    /**
     * The endpoint for accessing user information
     */
    public static final String USERS_ENDPOINT = API_BASE_PATH + "/users/";
    /**
     * The endpoint for logging in
     */
    public static final String LOGIN_ENDPOINT = API_BASE_PATH + "/auth/login";
    /**
     * The endpoint for logging out
     */
    public static final String LOGOUT_ENDPOINT = API_BASE_PATH + "/auth/logout";
    /**
     * The endpoint for accessing server information
     */
    public static final String SERVERS_ENDPOINT = API_BASE_PATH + "/guilds/";
    /**
     * The endpoint for accessing channel information
     */
    public static final String CHANNELS_ENDPOINT = API_BASE_PATH + "/channels/";
    /**
     * The endpoint for accepting invites
     */
    public static final String INVITE_ENDPOINT = API_BASE_PATH + "/invite";
    /**
     * The format string for avatar URLs
     */
    public static final String AVATAR_URL_PATTERN = "https://cdn.discordapp.com/avatars/%1$s/%2$s.jpg";

}

Remove trailing slash b/c invite ID has leading one


package cms.qermit.prototype;

import cms.qermit.prototype.mongo.TokenRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class PrototypeApplication {

    @Autowired
    private TokenRepository tokenRepository;

    public static void main(String[] args) throws Exception {
        SpringApplication.run(PrototypeApplication.class, args);
    }

}

package cms.qermit.prototype;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class PrototypeApplication {

    public static void main(String[] args) throws Exception {
        SpringApplication.run(PrototypeApplication.class, args);
    }

}

Remove unused dependency in application class


package seedu.doit.logic.parser;

import static seedu.doit.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import seedu.doit.logic.commands.Command;
import seedu.doit.logic.commands.IncorrectCommand;
import seedu.doit.logic.commands.SortCommand;

/**
 * Parses input arguments and creates a new SortCommand object
 */
public class SortCommandParser {
    public static final String SORT_VALIDATION_REGEX = "(priority)|(deadline)|(start time)";

    /**
     * Parses the given {@code String} of arguments in the context of the FindCommand
     * and returns an FindCommand object for execution.
     */
    public Command parse(String args) {
        if (args.matches(SORT_VALIDATION_REGEX)) {
            return new SortCommand(args);
        } else {
            return new IncorrectCommand(
                String.format(MESSAGE_INVALID_COMMAND_FORMAT, SortCommand.MESSAGE_USAGE));
        }
    }
}

package seedu.doit.logic.parser;

import static seedu.doit.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import seedu.doit.logic.commands.Command;
import seedu.doit.logic.commands.IncorrectCommand;
import seedu.doit.logic.commands.SortCommand;

/**
 * Parses input arguments and creates a new SortCommand object
 */
public class SortCommandParser {
    public static final String SORT_VALIDATION_REGEX = "(priority)|(deadline)|(start time)";

    /**
     * Parses the given {@code String} of arguments in the context of the FindCommand
     * and returns an FindCommand object for execution.
     */
    public Command parse(String args) {
        if (args.trim().matches(SORT_VALIDATION_REGEX)) {
            return new SortCommand(args.trim());
        } else {
            return new IncorrectCommand(
                String.format(MESSAGE_INVALID_COMMAND_FORMAT, SortCommand.MESSAGE_USAGE));
        }
    }
}

Trim argument for sort command


package com.github.NewsBotIRC;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by Geronimo on 11/6/16.
 */
public class UrlShortener {

    public static String shortenUrl(String myUrl)
    {
        String shortenedUrl = myUrl;
        try {
            String encoded = URLEncoder.encode(myUrl, "UTF-8");

            URL url = new URL("http://qurl.org/api/url?url=" + encoded);
            HttpURLConnection http = (HttpURLConnection) url.openConnection();

            BufferedReader reader = new BufferedReader(new InputStreamReader(http.getInputStream()));

            JSONObject json = new JSONObject( reader.readLine() );
            shortenedUrl = json.optString("url");

        } catch (IOException | JSONException e) {
            System.out.println(e.getMessage());
        }
        return shortenedUrl;
    }
}

package com.github.NewsBotIRC;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;

/**
 * Created by Geronimo on 11/6/16.
 */
public class UrlShortener {

    public static String shortenUrl(String myUrl)
    {
        String shortenedUrl = myUrl;
        try {
            String encoded = URLEncoder.encode(myUrl, "UTF-8");

            URL url = new URL("https://tinyurl.com/api-create.php?url=" + encoded);
            HttpURLConnection http = (HttpURLConnection) url.openConnection();

            BufferedReader reader = new BufferedReader(new InputStreamReader(http.getInputStream()));

            shortenedUrl = reader.readLine();

        } catch (IOException e) {
            System.out.println(e.getMessage());
        }
        return shortenedUrl;
    }
}

Change qurl.org for tinyurl.com as URL shortener service


package com.maddenabbott.jenny;

/**
 * The main entry point for Jenny.
 */
public class Application {
  public static void main(String[] args) {
  }
  }

package com.maddenabbott.jenny;

/**
 * The main entry point for Jenny.
 */
public class Application {
  private static final String defaultCommand = "help";

  public static void main(String[] args) {
    String commandName = getCommandName(args, defaultCommand);
  }

  private static String getCommandName(final String[] args, final String defaultCommandName) {
    if (args.length > 0 && args[0] != null) {
      return args[0];
    } else {
      return defaultCommandName;
    }
  }
  }

Add method to extract command name from command line args.


package com.skelril.aurora.util;

import java.util.Random;

/**
 * @author Turtle9598
 */
public class ChanceUtil {

    private static Random r = new Random(8888);

    public static int getRandom(int highestValue) {

        return highestValue < 0 ? (r.nextInt(highestValue * -1) + 1) * -1 : r.nextInt(highestValue) + 1;
    }

    public static int getRangedRandom(int lowestValue, int highestValue) {

        if (lowestValue == highestValue) return lowestValue;
        return lowestValue + getRandom(highestValue - lowestValue) - 1;
    }

    public static double getRandom(double highestValue) {

        if (highestValue < 0) {
            return (r.nextDouble() * (highestValue * -1) + 1) * -1;
        }
        return (r.nextDouble() * highestValue) + 1;
    }

    public static double getRangedRandom(double lowestValue, double highestValue) {

        if (lowestValue == highestValue) return lowestValue;
        return lowestValue + getRandom(highestValue - lowestValue) - 1;
    }

    public static boolean getChance(int outOf) {

        return getChance(1, outOf);
    }

    public static boolean getChance(int chance, int outOf) {

        return getRandom(outOf) <= chance;
    }

}

package com.skelril.aurora.util;

import java.util.Random;

/**
 * @author Turtle9598
 */
public class ChanceUtil {

    private static Random r = new Random(1374633257);

    public static int getRandom(int highestValue) {

        return highestValue < 0 ? (r.nextInt(highestValue * -1) + 1) * -1 : r.nextInt(highestValue) + 1;
    }

    public static int getRangedRandom(int lowestValue, int highestValue) {

        if (lowestValue == highestValue) return lowestValue;
        return lowestValue + getRandom(highestValue - lowestValue) - 1;
    }

    public static double getRandom(double highestValue) {

        if (highestValue < 0) {
            return (r.nextDouble() * (highestValue * -1) + 1) * -1;
        }
        return (r.nextDouble() * highestValue) + 1;
    }

    public static double getRangedRandom(double lowestValue, double highestValue) {

        if (lowestValue == highestValue) return lowestValue;
        return lowestValue + getRandom(highestValue - lowestValue) - 1;
    }

    public static boolean getChance(int outOf) {

        return getChance(1, outOf);
    }

    public static boolean getChance(int chance, int outOf) {

        return getRandom(outOf) <= chance;
    }

}

Use a more randomly made number for the system


package tests;

import static org.fest.assertions.Assertions.assertThat;

import org.fest.assertions.GenericAssert;
import org.kercoin.magrit.Configuration;
import org.kercoin.magrit.Configuration.Authentication;

public class ConfigurationAssert extends GenericAssert<ConfigurationAssert, Configuration> {

	ConfigurationAssert(Class<ConfigurationAssert> selfType,
			Configuration actual) {
		super(selfType, actual);
	}

	public ConfigurationAssert onPort(int expected) {
		assertThat(actual.getSshPort()).isEqualTo(expected);
		return this;
	}

	public ConfigurationAssert hasHomeDir(String absolutePath) {
		assertThat(actual.getRepositoriesHomeDir().getAbsolutePath()).isEqualTo(absolutePath);
		return this;
	}

	public ConfigurationAssert hasWorkDir(String absolutePath) {
		assertThat(actual.getWorkHomeDir().getAbsolutePath()).isEqualTo(absolutePath);
		return this;
	}

	public ConfigurationAssert hasPublickeyDir(String absolutePath) {
		assertThat(actual.getPublickeyRepositoryDir().getAbsolutePath()).isEqualTo(absolutePath);
		return this;
	}

	public ConfigurationAssert hasAuthentication(Authentication expected) {
		assertThat(actual.getAuthentication()).isEqualTo(expected);
		return this;
	}

	public ConfigurationAssert isRemoteAllowed(boolean expected) {
		assertThat(actual.isRemoteAllowed()).isEqualTo(expected);
		return this;
	}

}

package tests;

import static org.fest.assertions.Assertions.assertThat;

import java.io.File;

import org.fest.assertions.GenericAssert;
import org.kercoin.magrit.Configuration;
import org.kercoin.magrit.Configuration.Authentication;

public class ConfigurationAssert extends GenericAssert<ConfigurationAssert, Configuration> {

	ConfigurationAssert(Class<ConfigurationAssert> selfType,
			Configuration actual) {
		super(selfType, actual);
	}

	public ConfigurationAssert onPort(int expected) {
		assertThat(actual.getSshPort()).isEqualTo(expected);
		return this;
	}

	public ConfigurationAssert hasHomeDir(String absolutePath) {
		assertThat(actual.getRepositoriesHomeDir().getAbsolutePath()).isEqualTo(cleanPath(absolutePath));
		return this;
	}

	public ConfigurationAssert hasWorkDir(String absolutePath) {
		assertThat(actual.getWorkHomeDir().getAbsolutePath()).isEqualTo(cleanPath(absolutePath));
		return this;
	}

	public ConfigurationAssert hasPublickeyDir(String absolutePath) {
		assertThat(actual.getPublickeyRepositoryDir().getAbsolutePath()).isEqualTo(cleanPath(absolutePath));
		return this;
	}

	public ConfigurationAssert hasAuthentication(Authentication expected) {
		assertThat(actual.getAuthentication()).isEqualTo(expected);
		return this;
	}

	public ConfigurationAssert isRemoteAllowed(boolean expected) {
		assertThat(actual.isRemoteAllowed()).isEqualTo(expected);
		return this;
	}

	private static String cleanPath(String absolutePath) {
		return new File(absolutePath).getPath();
	}

}

Clean paths containing double /


package smowton;

public class Test {

  private String field;

  public Test fluentNoop() {
    return this;
  }

  public Test indirectlyFluentNoop() {
    return this.fluentNoop();
  }

  public Test fluentSet(String x) {
    this.field = x;
    return this;
  }

  public static Test identity(Test t) {
    return t;
  }

  public String get() {
    return field;
  }

  public static String source() {
    return "taint";
  }

  public static void sink(String s) {}

  public static void test1() {
    Test t = new Test();
    t.fluentNoop().fluentSet(source()).fluentNoop();
    sink(t.get()); // $hasTaintFlow=y
  }

  public static void test2() {
    Test t = new Test();
    Test.identity(t).fluentNoop().fluentSet(source()).fluentNoop();
    sink(t.get()); // $hasTaintFlow=y
  }

  public static void test3() {
    Test t = new Test();
    t.indirectlyFluentNoop().fluentSet(source()).fluentNoop();
    sink(t.get()); // $hasTaintFlow=y
  }

}

Remove package from test Java file


package com.lyubenblagoev.postfixrest.entity;

import java.util.Date;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

@MappedSuperclass
public class BaseEntity {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;

	private boolean enabled;

	@CreatedDate
	private Date created;

	@LastModifiedDate
	private Date updated;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public Date getUpdated() {
		return updated;
	}

	public void setUpdated(Date updated) {
		this.updated = updated;
	}

}

package com.lyubenblagoev.postfixrest.entity;

import java.util.Date;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@MappedSuperclass
public class BaseEntity {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;

	private boolean enabled;

	@Temporal(TemporalType.TIMESTAMP)
	private Date created;

	@Temporal(TemporalType.TIMESTAMP)
	private Date updated;

	@PrePersist
	public void onPrePersist() {
		this.created = new Date();
	}

	@PreUpdate
	public void onPreUpdate() {
		this.updated = new Date();
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public Date getUpdated() {
		return updated;
	}

	public void setUpdated(Date updated) {
		this.updated = updated;
	}

}

Fix automatic update for the 'created' and 'updated' fields


package com.apruve;

import static org.junit.Assert.*;

import org.junit.Test;

public class ApruveEnvironmentTest {

	@Test
	public void testBaseUrl() {
		assertEquals("https://www.apruve.com", ApruveEnvironment.PROD.getBaseUrl());
		assertEquals("https://test.apruve.com", ApruveEnvironment.TEST.getBaseUrl());
	}

	@Test
	public void testApiUrl() {
		assertEquals("https://www.apruve.com/api/v3", ApruveEnvironment.PROD.getApiV3Url());
		assertEquals("https://test.apruve.com/api/v3", ApruveEnvironment.TEST.getApiV3Url());
	}

	@Test
	public void testJsUrl() {
		assertEquals("https://www.apruve.com/js/apruve.js", ApruveEnvironment.PROD.getJsUrl());
		assertEquals("https://test.apruve.com/js/apruve.js", ApruveEnvironment.TEST.getJsUrl());
	}

	@Test
	public void testJsTag() {
		assertEquals("<script src=\"https://www.apruve.com/js/apruve.js\" type=\"text/javascript\"></script>", ApruveEnvironment.PROD.getJsTag());
		assertEquals("<script src=\"https://test.apruve.com/js/apruve.js\" type=\"text/javascript\"></script>", ApruveEnvironment.TEST.getJsTag());
	}
}

package com.apruve;

import static org.junit.Assert.*;

import org.junit.Test;

public class ApruveEnvironmentTest {

	@Test
	public void testBaseUrl() {
		assertEquals("https://app.apruve.com", ApruveEnvironment.PROD.getBaseUrl());
		assertEquals("https://test.apruve.com", ApruveEnvironment.TEST.getBaseUrl());
	}

	@Test
	public void testApiUrl() {
		assertEquals("https://app.apruve.com/api/v3", ApruveEnvironment.PROD.getApiV3Url());
		assertEquals("https://test.apruve.com/api/v3", ApruveEnvironment.TEST.getApiV3Url());
	}

	@Test
	public void testJsUrl() {
		assertEquals("https://app.apruve.com/js/apruve.js", ApruveEnvironment.PROD.getJsUrl());
		assertEquals("https://test.apruve.com/js/apruve.js", ApruveEnvironment.TEST.getJsUrl());
	}

	@Test
	public void testJsTag() {
		assertEquals("<script src=\"https://app.apruve.com/js/apruve.js\" type=\"text/javascript\"></script>", ApruveEnvironment.PROD.getJsTag());
		assertEquals("<script src=\"https://test.apruve.com/js/apruve.js\" type=\"text/javascript\"></script>", ApruveEnvironment.TEST.getJsTag());
	}
}

Use app.apruve.com as the prod environment URL


/*
 * Copyright 2007 Russell Harmon
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package com.eatnumber1.util;

import org.jetbrains.annotations.NotNull;
import org.junit.Assert;
import org.junit.Test;

/**
 * @author Russell Harmon
 * @since Jul 13, 2009
 */
public class NullableTest {
    private void notNull( @NotNull Object obj ) {}

    @Test
    public void nullable() {
        try {
            notNull(null);
            Assert.fail();
        } catch( IllegalArgumentException e ) {
            // Do nothing
        }
    }
}

/*
 * Copyright 2007 Russell Harmon
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package com.eatnumber1.util;

import org.jetbrains.annotations.NotNull;
import org.junit.Assert;
import org.junit.Test;

/**
 * @author Russell Harmon
 * @since Jul 13, 2009
 */
public class NullableTest {
    private void notNull( @NotNull Object obj ) {}

    @Test
    public void nullable() {
        try {
            notNull(null);
            Assert.fail("@NotNull was not enforced.");
        } catch( IllegalArgumentException e ) {
            // Do nothing
        }
    }
}

Add message to test failure


package org.embulk.input;

import com.google.common.base.Optional;
import org.embulk.EmbulkTestRuntime;
import org.embulk.config.ConfigSource;
import org.embulk.spi.Exec;
import org.junit.Rule;
import org.junit.Test;

import java.util.Collections;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

public class TestRemoteFileInputPlugin
{
    @Rule
    public EmbulkTestRuntime runtime = new EmbulkTestRuntime();

    @Test
    public void checkDefaultValues()
    {
        ConfigSource config = Exec.newConfigSource();

        RemoteFileInputPlugin.PluginTask task = config.loadConfig(RemoteFileInputPlugin.PluginTask.class);
		assertThat(task.getHosts(), is(Collections.<String>emptyList()));
		assertThat(task.getHostsCommand(), is(Optional.<String>absent()));
		assertThat(task.getHostsSeparator(), is(" "));
		assertThat(task.getPath(), is(""));
		assertThat(task.getPathCommand(), is(Optional.<String>absent()));
		assertThat(task.getAuth(), is(Collections.<String, String>emptyMap()));
		assertThat(task.getLastTarget(), is(Optional.<RemoteFileInputPlugin.Target>absent()));
    }
}

package org.embulk.input;

//import com.google.common.base.Optional;
//import org.embulk.EmbulkTestRuntime;
//import org.embulk.config.ConfigSource;
//import org.embulk.spi.Exec;
//import org.junit.Rule;
//import org.junit.Test;
//
//import java.util.Collections;
//
//import static org.hamcrest.CoreMatchers.is;
//import static org.junit.Assert.assertThat;

public class TestRemoteFileInputPlugin
{
//    @Rule
//    public EmbulkTestRuntime runtime = new EmbulkTestRuntime();
//
//    @Test
//    public void checkDefaultValues()
//    {
//        ConfigSource config = Exec.newConfigSource();
//
//        RemoteFileInputPlugin.PluginTask task = config.loadConfig(RemoteFileInputPlugin.PluginTask.class);
//		assertThat(task.getHosts(), is(Collections.<String>emptyList()));
//		assertThat(task.getHostsCommand(), is(Optional.<String>absent()));
//		assertThat(task.getHostsSeparator(), is(" "));
//		assertThat(task.getPath(), is(""));
//		assertThat(task.getPathCommand(), is(Optional.<String>absent()));
//		assertThat(task.getAuth(), is(Collections.<String, String>emptyMap()));
//		assertThat(task.getLastTarget(), is(Optional.<RemoteFileInputPlugin.Target>absent()));
//    }
}

Comment out test. (Can't compile)


package org.dstadler.commoncrawl;

/**
 * Which extensions we are interested in.
 *
 * @author dominik.stadler
 */
public class Extensions {

    private static final String[] EXTENSIONS = new String[] {
        // Excel
        ".xls",
        ".xlsx",
        ".xlsm",
        ".xltx",
        ".xlsb",

        // Word
        ".doc",
        ".docx",
        ".dotx",
        ".docm",
        ".ooxml",

        // Powerpoint
        ".ppt",
        ".pptx",
        ".pptm",
        ".ppsm",
        ".ppsx",
        ".thmx",

        // Outlook
        ".msg",

        // Publisher
        ".pub",

        // Visio - binary
        ".vsd",
        ".vss",
        ".vst",
        ".vsw",

        // Visio - ooxml (currently unsupported)
        ".vsdm",
        ".vsdx",
        ".vssm",
        ".vssx",
        ".vstm",
        ".vstx",

        // POIFS
        ".ole2",

        // Microsoft Admin Template?
        ".adm",

        // Microsoft TNEF
        // ".dat", new HMEFFileHandler());
    };

    public static boolean matches(String url) {
        for(String ext : EXTENSIONS) {
            if(url.endsWith(ext)) {
                return true;
            }
        }

        return false;
    }
}

package org.dstadler.commoncrawl;

/**
 * Which extensions we are interested in.
 *
 * @author dominik.stadler
 */
public class Extensions {

    private static final String[] EXTENSIONS = new String[] {
        // Excel
        ".xls",
        ".xlsx",
        ".xlsm",
        ".xltx",
        ".xlsb",

        // Word
        ".doc",
        ".docx",
        ".dotx",
        ".docm",
        ".ooxml",

        // Powerpoint
        ".ppt",
        ".pot",
        ".pptx",
        ".pptm",
        ".ppsm",
        ".ppsx",
        ".thmx",
        ".potx",

        // Outlook
        ".msg",

        // Publisher
        ".pub",

        // Visio - binary
        ".vsd",
        ".vss",
        ".vst",
        ".vsw",

        // Visio - ooxml (currently unsupported)
        ".vsdm",
        ".vsdx",
        ".vssm",
        ".vssx",
        ".vstm",
        ".vstx",

        // POIFS
        ".ole2",

        // Microsoft Admin Template?
        ".adm",

        // Microsoft TNEF
        // ".dat", new HMEFFileHandler());
    };

    public static boolean matches(String url) {
        for(String ext : EXTENSIONS) {
            if(url.endsWith(ext)) {
                return true;
            }
        }

        return false;
    }
}

Add Extension .pot for powerpoint


package control;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import com.health.control.*;

public class ControlModuleTest {
	private ControlModule cm;

	@Before
	public void setUp() {
		cm = new ControlModule();
	}

	@Test
	public void setData() {
		InputData id1 = new InputData("path/to/xml1.xml", "path/to/data1.txt");
		InputData id2 = new InputData("path/to/xml2.xml", "path/to/data2.txt");
		InputData id3 = new InputData("path/to/xml3.xml", "path/to/data3.txt");

		InputData[] id = {id1, id2, id3};
		cm.setData(id);

		InputData[] expected = {id1, id2, id3};

		assertEquals(expected, cm.getScript());
	}

	@Test
	public void setScript() {
		cm.setScript("hist('histogram.png', avgByDay.AvgCreatinine, avgByDay.DateTime.DayOfYear, 365);");
		String expected = "hist('histogram.png', avgByDay.AvgCreatinine, avgByDay.DateTime.DayOfYear, 365);";

		assertEquals(expected, cm.getScript());
	}

	@Test
	public void getData() {

	}

}

package control;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import com.health.control.*;

public class ControlModuleTest {
	private ControlModule cm;

	@Before
	public void setUp() {
		cm = new ControlModule();
	}

	@Test
	public void setData() {
		InputData id1 = new InputData("path/to/xml1.xml", "path/to/data1.txt");
		InputData id2 = new InputData("path/to/xml2.xml", "path/to/data2.txt");
		InputData id3 = new InputData("path/to/xml3.xml", "path/to/data3.txt");

		InputData[] id = {id1, id2, id3};
		cm.setData(id);

		InputData[] expected = {id1, id2, id3};

		assertArrayEquals(expected, cm.getScript());
	}

	@Test
	public void setScript() {
		cm.setScript("hist('histogram.png', avgByDay.AvgCreatinine, avgByDay.DateTime.DayOfYear, 365);");
		String expected = "hist('histogram.png', avgByDay.AvgCreatinine, avgByDay.DateTime.DayOfYear, 365);";

		assertEquals(expected, cm.getScript());
	}

	@Test
	public void getData() {

	}

}

Update tests ControlModule and InputData


package com.artifex.mupdf.fitz;

public final class Location
{
	public final int chapter;
	public final int page;
	public final float x, y;
	public Location(int chapter, int page) {
		this.chapter = chapter;
		this.page = page;
		this.x = this.y = 0;
	}
	public Location(int chapter, int page, float x, float y) {
		this.chapter = chapter;
		this.page = page;
		this.x = x;
		this.y = y;
	}
}

package com.artifex.mupdf.fitz;

public final class Location
{
	public final int chapter;
	public final int page;
	public final float x, y;

	public Location(int chapter, int page) {
		this.chapter = chapter;
		this.page = page;
		this.x = this.y = 0;
	}

	public Location(int chapter, int page, float x, float y) {
		this.chapter = chapter;
		this.page = page;
		this.x = x;
		this.y = y;
	}

	public boolean equals(Object obj) {
		if (!(obj instanceof Location))
			return false;

		Location other = (Location) obj;

		return this.chapter == other.chapter &&
			this.page == other.page &&
			this.x == other.x &&
			this.y == other.y;
	}
}

Allow for comparing document locations.


package com.aspose.imaging.examples;

import java.io.File;

public class Utils {

    public static String getDataDir(Class c) {
        File dir = new File(System.getProperty("user.dir"));
        dir = new File(dir, "src");
        dir = new File(dir, "main");
        dir = new File(dir, "resources");

        for (String s : c.getName().split("\\.")) {
            dir = new File(dir, s);
        }

        System.out.println("Using data directory: " + dir.toString());
        return dir.toString() + File.separator;
    }

}

package com.aspose.imaging.examples;

import java.io.File;

public class Utils {

    public static String getDataDir(Class c) {
        File dir = new File(System.getProperty("user.dir"));
        dir = new File(dir, "src");
        dir = new File(dir, "main");
        dir = new File(dir, "resources");

        for (String s : c.getName().split("\\.")) {
            dir = new File(dir, s);
        }

        if (dir.exists()) {
            System.out.println("Using data directory: " + dir.toString());
        } else {
            dir.mkdirs();
            System.out.println("Creating data directory: " + dir.toString());
        }
        return dir.toString() + File.separator;
    }

}

Create data directory, if required


package guitests.guihandles;

import guitests.GuiRobot;
import javafx.stage.Stage;

/**
 * A handle to the Command Box in the GUI.
 */
public class CommandBoxHandle extends GuiHandle{

    private static final String COMMAND_INPUT_FIELD_ID = "#commandTextField";

    public CommandBoxHandle(GuiRobot guiRobot, Stage primaryStage, String stageTitle) {
        super(guiRobot, primaryStage, stageTitle);
    }

    public void enterCommand(String command) {
        setTextField(COMMAND_INPUT_FIELD_ID, command);
    }

    public String getCommandInput() {
        return getTextFieldText(COMMAND_INPUT_FIELD_ID);
    }

    /**
     * Enters the given command in the Command Box and presses enter.
     */
    public void runCommand(String command) {
        enterCommand(command);
        pressEnter();
        guiRobot.sleep(10);
        if (command.equals("clear")) // any commands that has an alert dialog that pops out
            pressEnter();
        guiRobot.sleep(700); //Give time for the command to take effect
    }

    public HelpWindowHandle runHelpCommand() {
        enterCommand("help");
        pressEnter();
        return new HelpWindowHandle(guiRobot, primaryStage);
    }
}

package guitests.guihandles;

import guitests.GuiRobot;
import javafx.stage.Stage;

/**
 * A handle to the Command Box in the GUI.
 */
public class CommandBoxHandle extends GuiHandle{

    private static final String COMMAND_INPUT_FIELD_ID = "#commandTextField";

    public CommandBoxHandle(GuiRobot guiRobot, Stage primaryStage, String stageTitle) {
        super(guiRobot, primaryStage, stageTitle);
    }

    public void enterCommand(String command) {
        setTextField(COMMAND_INPUT_FIELD_ID, command);
    }

    public String getCommandInput() {
        return getTextFieldText(COMMAND_INPUT_FIELD_ID);
    }

    /**
     * Enters the given command in the Command Box and presses enter.
     */
    public void runCommand(String command) {
        enterCommand(command);
        pressEnter();
        guiRobot.sleep(10);
        if (command.equals("clear")) // any commands that has an alert dialog that pops out
            pressEnter();
        guiRobot.sleep(100); //Give time for the command to take effect
    }

    public HelpWindowHandle runHelpCommand() {
        enterCommand("help");
        pressEnter();
        return new HelpWindowHandle(guiRobot, primaryStage);
    }
}

Change sleep timing of gui robot for command box handle which caused some test cases to fail


package com.ideaheap;

import java.util.Comparator;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

public class StreamsBasedCalculator {

    public Map<String, String> getStringTransition(
        final Set<String> stringSet,
        final Map<String, Double> stringCosts) {

        return stringCosts.keySet().parallelStream().collect(
            Collectors.toConcurrentMap(
                (state) -> state,
                (state) -> stringTransitionCost(state, stringSet, stringCosts)
            )
        );
    }

    private String stringTransitionCost(
        final String state,
        final Set<String> stringSet,
        final Map<String, Double> expectedUtilities) {

        return Double.toString(stringSet
        .stream()
        .mapToDouble(act -> calculateExpectedUtility(state, act, expectedUtilities))
        .max()
        .getAsDouble());
    }
//
    private Double calculateExpectedUtility(
        String state,
        String act,
        Map<String, Double> expectedUtilities) {

        return expectedUtilities
            .entrySet()
            .stream()
            .mapToDouble(
                n -> getStateProbability(state, act, n.getKey()) * n.getValue()
            ).sum();
    }

    private Double getStateProbability(String state, String act, String key) {
        return 5.0;
    }

}

package com.ideaheap;

import java.util.Comparator;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

public class StreamsBasedCalculator {

    public Map<String, String> getStringTransition(
        final Set<String> stringSet,
        final Map<String, Double> stringCosts) {

        return stringCosts.keySet().parallelStream().collect(
            Collectors.toConcurrentMap(
                (state) -> state,
                (state) -> stringTransitionCost(state, stringSet, stringCosts)
            )
        );
    }

    private String stringTransitionCost(
        final String state,
        final Set<String> stringSet,
        final Map<String, Double> expectedUtilities) {
        return stringSet.stream().max(
            Comparator.comparing(
                act -> calculateExpectedUtility(state, act, expectedUtilities)
            )
        ).get();
    }

    private Double calculateExpectedUtility(
        String state,
        String act,
        Map<String, Double> expectedUtilities) {

        return expectedUtilities
            .entrySet()
            .stream()
            .mapToDouble(
                n -> getStateProbability(state, act, n.getKey()) * n.getValue()
            ).sum();
    }

    private Double getStateProbability(String state, String act, String key) {
        return 5.0;
    }

}

Revert "first attempt to improve performance"


import java.io.*;
import java.util.*;

import irgeneration.*;
import semanticanalysis.*;
import symboltable.*;
import syntaxtree.*;
import visitor.*;

public class MiniJavaCompiler
{
    public static void main(String[] args) throws Exception
    {
        if (args.length < 1)
        {
            System.err.println("usage: java NameAnalysisTest <input-file>");
            System.exit(1);
        }

        MiniJavaParser parser = new MiniJavaParser(new MiniJavaLexer(new FileReader(args[0])));

        Program program = (Program)parser.parse().value;

        BuildSymbolTableVisitor symbolTableBuilder = new BuildSymbolTableVisitor();
        symbolTableBuilder.visit(program);

        ISymbolTable symbolTable = symbolTableBuilder.getSymbolTable();

        for (String error : symbolTableBuilder.getErrors())
            System.out.println(error);

        NameAnalysisVisitor nameAnalysis = new NameAnalysisVisitor(symbolTable);
        nameAnalysis.visit(program);
        for (String error : nameAnalysis.getErrors())
            System.out.println(error);

        TypeCheckVisitor typeChecker = new TypeCheckVisitor(symbolTable);
        typeChecker.visit(program);
        for (String error : typeChecker.getErrors())
            System.out.println(error);

        if(!(typeChecker.getErrors().isEmpty() && nameAnalysis.getErrors().isEmpty() && symbolTableBuilder.getErrors().isEmpty()))
          {
            System.out.println("Errors encountered, cannot generate IR.");
            return;
          }

        IRGenVisitor irGenerator = new IRGenVisitor((SymbolTable)symbolTable);
        irGenerator.visit(program);
        irGenerator.printIRList();
    }
}

Fix small source formatting issue


package com.vryba.selenium;

import com.vryba.selenium.pageObjects.HomePage;
import com.vryba.selenium.pageObjects.QuestionsPage;
import com.vryba.selenium.utilities.TestBase;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.testng.Assert;
import org.testng.annotations.Test;

public class QuestionsPage_TC extends TestBase {
}

package com.vryba.selenium;

import com.vryba.selenium.pageObjects.HomePage;
import com.vryba.selenium.pageObjects.QuestionsPage;
import com.vryba.selenium.utilities.TestBase;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.testng.Assert;
import org.testng.annotations.Test;

public class QuestionsPage_TC extends TestBase {
    private Logger LOG = LogManager.getLogger(QuestionsPage_TC.class);
}

Test case is still in design phase


package xyz.igorgee.imagecreator3d;

import java.io.File;

public class Model {
    String name;
    File location;
    String modelID;

    public Model(String name, File location) {
        this.name = name;
        this.location = location;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public File getLocation() {
        return location;
    }

    public void setLocation(File location) {
        this.location = location;
    }

    public String getModelID() {
        return modelID;
    }

    public void setModelID(String modelID) {
        this.modelID = modelID;
    }
}

package xyz.igorgee.imagecreator3d;

import java.io.File;

public class Model {
    String name;
    File location;
    Integer modelID;

    public Model(String name, File location) {
        this.name = name;
        this.location = location;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public File getLocation() {
        return location;
    }

    public void setLocation(File location) {
        this.location = location;
    }

    public Integer getModelID() {
        return modelID;
    }

    public void setModelID(Integer modelID) {
        this.modelID = modelID;
    }
}

Change modelId to type Integer


/*
 * Copyright 2013 That Amazing Web Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.taw.dashtube.model;

import com.google.api.client.util.Key;
import com.google.api.client.xml.GenericXml;

/**
 * Simple class encapsulating the <Line> element.
 */
public class Line extends GenericXml {
    @Key("@ID")
    public int id;
    @Key("@Name")
    public String name;
}

/*
 * Copyright 2013 That Amazing Web Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.taw.dashtube.model;

import com.google.api.client.util.Key;
import com.google.api.client.xml.GenericXml;

/**
 * Simple class encapsulating the <Line> element.
 */
public class Line extends GenericXml {
    @Key("@ID")
    public String id;
    @Key("@Name")
    public String name;
}

Change ID to String (easier for comparisons)


package com.timeanddate.services;

/**
 *
 * @author Cato Auestad {@literal <cato@timeanddate.com>}
 *
 */
final class Constants {
	static final int DefaultVersion = 2;
	static final String DefaultLanguage = "en";
	static final String DefaultReturnFormat = "xml";
	static final int DefaultVerboseTimeValue = 0;
	static final String EntryPoint = "http://api.xmltime.com/";
}

package com.timeanddate.services;

/**
 *
 * @author Cato Auestad {@literal <cato@timeanddate.com>}
 *
 */
final class Constants {
	static final int DefaultVersion = 3;
	static final String DefaultLanguage = "en";
	static final String DefaultReturnFormat = "xml";
	static final int DefaultVerboseTimeValue = 0;
	static final String EntryPoint = "http://api.xmltime.com/";
}

Update default version to version 3


package com.haxademic.core.math.easing;

public class LinearFloat
implements IEasingValue {

	public float _val, _target, _inc;
	public int _delay;

	public LinearFloat( float value, float inc ) {
		_val = value;
		_target = value;
		_inc = inc;
		_delay = 0;
	}

	public float value() {
		return _val;
	}

	public float target() {
		return _target;
	}

	public void setCurrent( float value ) {
		_val = value;
	}

	public void setTarget( float value ) {
		_target = value;
	}

	public void setInc( float value ) {
		_inc = value;
	}

	public void setDelay( int frames ) {
		_delay = frames;
	}

	public void update() {
		if( _delay > 0 ) { _delay--; return; }
		if( _val != _target ) {
			boolean switchedSides = false;
			if( _val < _target ) {
				_val += _inc;
				if( _val > _target ) switchedSides = true;
			} else {
				_val -= _inc;
				if( _val < _target ) switchedSides = true;
			}
			if( switchedSides == true ) {
				_val = _target;
			}

		}
	}

}

package com.haxademic.core.math.easing;

public class LinearFloat
implements IEasingValue {

	public float _val, _target, _inc;
	public int _delay;

	public LinearFloat( float value, float inc ) {
		_val = value;
		_target = value;
		_inc = inc;
		_delay = 0;
	}

	public float value() {
		return _val;
	}

	public float target() {
		return _target;
	}

	public void setCurrent( float value ) {
		_val = value;
	}

	public void setTarget( float value ) {
		_target = value;
	}

	public void setInc( float value ) {
		_inc = value;
	}

	public void setDelay( int frames ) {
		_delay = frames;
	}

	// mask to be swappable with EasingFloat
	public void update(boolean bool) {
		update();
	}

	public void update() {
		if( _delay > 0 ) { _delay--; return; }
		if( _val != _target ) {
			boolean switchedSides = false;
			if( _val < _target ) {
				_val += _inc;
				if( _val > _target ) switchedSides = true;
			} else {
				_val -= _inc;
				if( _val < _target ) switchedSides = true;
			}
			if( switchedSides == true ) {
				_val = _target;
			}
		}
	}

}

Align easing float classes API


/*
 * Copyright (C) 2016 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.copybara;

/**
 * Indicates that the configuration is wrong or some error attributable to the user happened. For
 * example wrong flag usage, errors in fields or errors that we discover during execution.
 */
public class ValidationException extends Exception {

  public ValidationException(String message) {
    super(message);
  }

  public ValidationException(String message, Throwable cause) {
    super(message, cause);
  }

  public static void checkCondition(boolean condition, String format, Object... args)
      throws ValidationException {
    if (!condition) {
      throw new ValidationException(String.format(format, args));
    }
  }
}

/*
 * Copyright (C) 2016 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.copybara;

/**
 * Indicates that the configuration is wrong or some error attributable to the user happened. For
 * example wrong flag usage, errors in fields or errors that we discover during execution.
 */
public class ValidationException extends Exception {

  public ValidationException(String message) {
    super(message);
  }

  @Deprecated
  public ValidationException(String message, Throwable cause) {
    super(message, cause);
  }

  public ValidationException(Throwable cause, String message, Object... args) {
    super(String.format(message, args), cause);
  }

  public static void checkCondition(boolean condition, String format, Object... args)
      throws ValidationException {
    if (!condition) {
      throw new ValidationException(String.format(format, args));
    }
  }
}

Introduce format-string version for rethrow VE


package controller;

import pipesentity.Definition;

public interface DefinitionProcessor {

	public Object execute( Definition definition );

}

package controller;

/**
 * TODO:Add more comments
 */
import pipesentity.Definition;

public interface DefinitionProcessor {

	public Object execute( Definition definition );

}

Test commit/pull on new machine


package com.thaiopensource.resolver;

import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.io.IOException;

/**
 *
 */
public class BasicResolver implements Resolver {
  static private final BasicResolver theInstance = new BasicResolver();

  protected BasicResolver() {
  }

  public static BasicResolver getInstance() {
    return theInstance;
  }

  public void resolve(Identifier id, Input input) throws IOException, ResolverException {
    if (!input.isResolved())
      input.setUri(resolveUri(id));
  }

  public void open(Input input) throws IOException, ResolverException {
    if (!input.isUriDefinitive())
      return;
    URI uri;
    try {
      uri = new URI(input.getUri());
    }
    catch (URISyntaxException e) {
      throw new ResolverException(e);
    }
    if (!uri.isAbsolute())
      throw new ResolverException("cannot open relative URI: " + uri);
    URL url = new URL(uri.toASCIIString());
    // XXX should set the encoding properly
    input.setByteStream(url.openStream());
  }

  public static String resolveUri(Identifier id) throws ResolverException {
    try {
      URI uri = new URI(id.getUriReference());
      String base = id.getBase();
      if (base != null)
        uri = new URI(base).resolve(uri);
      return uri.toString();
    }
    catch (URISyntaxException e) {
      throw new ResolverException(e);
    }
  }
}

package com.thaiopensource.resolver;

import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.io.IOException;

/**
 *
 */
public class BasicResolver implements Resolver {
  static private final BasicResolver theInstance = new BasicResolver();

  protected BasicResolver() {
  }

  public static BasicResolver getInstance() {
    return theInstance;
  }

  public void resolve(Identifier id, Input input) throws IOException, ResolverException {
    if (!input.isResolved())
      input.setUri(resolveUri(id));
  }

  public void open(Input input) throws IOException, ResolverException {
    if (!input.isUriDefinitive())
      return;
    URI uri;
    try {
      uri = new URI(input.getUri());
    }
    catch (URISyntaxException e) {
      throw new ResolverException(e);
    }
    if (!uri.isAbsolute())
      throw new ResolverException("cannot open relative URI: " + uri);
    URL url = new URL(uri.toASCIIString());
    // XXX should set the encoding properly
    // XXX if this is HTTP and we've been redirected, should do input.setURI with the new URI
    input.setByteStream(url.openStream());
  }

  public static String resolveUri(Identifier id) throws ResolverException {
    try {
      URI uri = new URI(id.getUriReference());
      String base = id.getBase();
      if (base != null)
        uri = new URI(base).resolve(uri);
      return uri.toString();
    }
    catch (URISyntaxException e) {
      throw new ResolverException(e);
    }
  }
}

Add note that we need to handle HTTP redirection