package fr.neamar.kiss;

import fr.neamar.R;

import android.support.test.rule.ActivityTestRule;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.LargeTest;

import org.junit.Rule;
import org.junit.Test;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static android.support.test.espresso.action.ViewActions.typeText;

@LargeTest
public class DeckardEspressoTest  {

    @Rule
    public ActivityTestRule<MainActivity> mActivityRule =
            new ActivityTestRule<>(MainActivity.class);

    @Test
    public void testActivityShouldHaveText() {
        onView(withId(R.id.searchEditText)).perform(typeText("Test"));
        onView(withId(R.id.searchEditText)).check(matches(withText("Test")));
    }
}

package fr.neamar.kiss;

import fr.neamar.R;

import android.support.test.rule.ActivityTestRule;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.LargeTest;

import org.junit.Rule;
import org.junit.Test;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static android.support.test.espresso.action.ViewActions.typeText;

@LargeTest
public class MainActivityTest  {

    @Rule
    public ActivityTestRule<MainActivity> mActivityRule =
            new ActivityTestRule<>(MainActivity.class);

    @Test
    public void testActivityShouldHaveText() {
        onView(withId(R.id.searchEditText)).perform(typeText("Test"));
        onView(withId(R.id.searchEditText)).check(matches(withText("Test")));
    }
}

Fix typo with class name


package com.redhat.ceylon.compiler.js;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import com.redhat.ceylon.compiler.typechecker.model.Module;

/** A container for things we need to keep per-module. */
class JsOutput {
    private File outfile;
    private Writer writer;
    private final Set<String> s = new HashSet<String>();
    final Map<String,String> requires = new HashMap<String,String>();
    final MetamodelVisitor mmg;
    final String encoding;
    protected JsOutput(Module m, String encoding) throws IOException {
        this.encoding = encoding;
        mmg = new MetamodelVisitor(m);
    }
    protected Writer getWriter() throws IOException {
        if (writer == null) {
            outfile = File.createTempFile("jsout", ".tmp");
            writer = new OutputStreamWriter(new FileOutputStream(outfile), encoding);
        }
        return writer;
    }
    protected File close() throws IOException {
        writer.close();
        return outfile;
    }
    void addSource(String src) {
        s.add(src);
    }
    Set<String> getSources() { return s; }
}

package com.redhat.ceylon.compiler.js;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import com.redhat.ceylon.compiler.typechecker.model.Module;

/** A container for things we need to keep per-module. */
class JsOutput {
    private File outfile;
    private Writer writer;
    private final Set<String> s = new HashSet<String>();
    final Map<String,String> requires = new HashMap<String,String>();
    final MetamodelVisitor mmg;
    final String encoding;
    protected JsOutput(Module m, String encoding) throws IOException {
        this.encoding = encoding == null ? "UTF-8" : encoding;
        mmg = new MetamodelVisitor(m);
    }
    protected Writer getWriter() throws IOException {
        if (writer == null) {
            outfile = File.createTempFile("jsout", ".tmp");
            writer = new OutputStreamWriter(new FileOutputStream(outfile), encoding);
        }
        return writer;
    }
    protected File close() throws IOException {
        writer.close();
        return outfile;
    }
    void addSource(String src) {
        s.add(src);
    }
    Set<String> getSources() { return s; }
}

Use UTF-8 as default encoding if missing


/**
 * Copyright 2010 - 2017 JetBrains s.r.o.
 *
 * 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 jetbrains.exodus.entitystore;

import org.jetbrains.annotations.NotNull;

public class ReadonlyPersistentStoreTransaction extends PersistentStoreTransaction {

    ReadonlyPersistentStoreTransaction(@NotNull final PersistentEntityStoreImpl store) {
        super(store, TransactionType.Readonly);
    }

    @Override
    public boolean isIdempotent() {
        if (!super.isIdempotent()) {
            throw new IllegalStateException("ReadonlyPersistentStoreTransaction should be idempotent");
        }
        return true;
    }

    public PersistentStoreTransaction getUpgradedTransaction() {
        return new PersistentStoreTransaction(this, TransactionType.Regular);
    }
}

/**
 * Copyright 2010 - 2017 JetBrains s.r.o.
 *
 * 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 jetbrains.exodus.entitystore;

import org.jetbrains.annotations.NotNull;

public class ReadonlyPersistentStoreTransaction extends PersistentStoreTransaction {

    ReadonlyPersistentStoreTransaction(@NotNull final PersistentEntityStoreImpl store) {
        super(store, TransactionType.Readonly);
    }

    @Override
    public boolean isIdempotent() {
        if (!super.isIdempotent()) {
            throw new IllegalStateException("ReadonlyPersistentStoreTransaction should be idempotent");
        }
        return true;
    }

    public PersistentStoreTransaction getUpgradedTransaction(boolean exclusive) {
        return new PersistentStoreTransaction(this, exclusive ? TransactionType.Exclusive : TransactionType.Regular);
    }

    public PersistentStoreTransaction getUpgradedTransaction() {
        return getUpgradedTransaction(false);
    }
}

Allow upgrade of transaction from readonly to exclusive


/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2016 Vincent Zhang/PhoenixLAB
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package co.phoenixlab.discord.api.request.channel;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Builder;

@Builder
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class CreateMessageRequest {

    private String content;
    private String nonce;
    private boolean tts;

}

/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2016 Vincent Zhang/PhoenixLAB
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package co.phoenixlab.discord.api.request.channel;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Builder;

import javax.validation.constraints.Size;

@Builder
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class CreateMessageRequest {

    /**
     * The message contents (up to 2000 characters).
     */
    @Size(min = 1, max = 2000)
    private String content;
    /**
     * A nonce that can be used for optimistic message sending.
     */
    private String nonce;
    /**
     * If this is a TTS message.
     */
    private boolean tts;

}

Add comments and validation to create msg


package com.vmware.http.json;

import com.google.gson.FieldNamingStrategy;

import java.lang.reflect.Field;
import java.util.Map;

public class RuntimeFieldNamingStrategy implements FieldNamingStrategy {

    private Map<String, String> runtimeFieldNameMappings;

    public RuntimeFieldNamingStrategy(Map<String, String> runtimeFieldNameMappings) {
        this.runtimeFieldNameMappings = runtimeFieldNameMappings;
    }

    @Override
    public String translateName(Field field) {
        RuntimeFieldName runtimeFieldName = field.getAnnotation(RuntimeFieldName.class);
        if (runtimeFieldName == null) {
            return field.getName();
        }
        String fieldVariableName = runtimeFieldName.value();
        if (!runtimeFieldNameMappings.containsKey(fieldVariableName)) {
            throw new RuntimeException("No field name mapping for variable " + field.getName());
        }
        return runtimeFieldNameMappings.get(fieldVariableName);
    }
}

package com.vmware.http.json;

import com.google.gson.FieldNamingPolicy;
import com.google.gson.FieldNamingStrategy;

import java.lang.reflect.Field;
import java.util.Map;

public class RuntimeFieldNamingStrategy implements FieldNamingStrategy {

    private FieldNamingStrategy defaultStrategy = FieldNamingPolicy.IDENTITY;

    private Map<String, String> runtimeFieldNameMappings;

    public RuntimeFieldNamingStrategy(Map<String, String> runtimeFieldNameMappings) {
        this.runtimeFieldNameMappings = runtimeFieldNameMappings;
    }

    @Override
    public String translateName(Field field) {
        RuntimeFieldName runtimeFieldName = field.getAnnotation(RuntimeFieldName.class);
        if (runtimeFieldName == null) {
            return defaultStrategy.translateName(field);
        }
        String fieldVariableName = runtimeFieldName.value();
        if (!runtimeFieldNameMappings.containsKey(fieldVariableName)) {
            throw new RuntimeException("No field name mapping for variable " + field.getName());
        }
        return runtimeFieldNameMappings.get(fieldVariableName);
    }
}

Update strategy to use IDENTITY as default strategy


package com.bignerdranch.android.beatbox;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class BeatBoxFragment extends Fragment {

    public static BeatBoxFragment newInstance() {
        return new BeatBoxFragment();
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_beat_box, container, false);

        RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.fragment_beat_box_recycler_view);
        recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 3));

        return view;
    }
}

package com.bignerdranch.android.beatbox;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Layout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

public class BeatBoxFragment extends Fragment {

    public static BeatBoxFragment newInstance() {
        return new BeatBoxFragment();
    }

    @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_beat_box, container, false);

        RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.fragment_beat_box_recycler_view);
        recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 3));

        return view;
    }

    private class SoundHolder extends RecyclerView.ViewHolder {

        private Button mButton;

        public SoundHolder(LayoutInflater inflater, ViewGroup container) {
            super(inflater.inflate(R.layout.list_item_sound, container, false);

            mButton = (Button) itemView.findViewById(R.id.list_item_sound_button);
        }
    }

    private class SoundAdapter extends RecyclerView.Adapter<SoundHolder> {

        @Override
        public SoundHolder onCreateViewHolder(ViewGroup parent, int i) {
            LayoutInflater inflater = LayoutInflater.from(getActivity());
            return new SoundHolder(inflater, parent);
        }

        @Override
        public void onBindViewHolder(SoundHolder soundHolder, int i) {

        }

        @Override
        public int getItemCount() {
            return 0;
        }
    }
}

Create adapter and viewholder for beatbox


package som.primitives;

import som.interpreter.nodes.nary.UnaryExpressionNode;
import som.vm.constants.Classes;
import som.vmobjects.SClass;

import com.oracle.truffle.api.dsl.GenerateNodeFactory;
import com.oracle.truffle.api.dsl.Specialization;

public abstract class DoublePrims  {

  @GenerateNodeFactory
  @Primitive("doubleRound:")
  public abstract static class RoundPrim extends UnaryExpressionNode {
    @Specialization
    public final long doDouble(final double receiver) {
      return Math.round(receiver);
    }
  }

  @GenerateNodeFactory
  @Primitive("doublePositiveInfinity:")
  public abstract static class PositiveInfinityPrim extends UnaryExpressionNode {
    protected final boolean receiverIsDoubleClass(final SClass receiver) {
      return receiver == Classes.doubleClass;
    }

    @Specialization(guards = "receiverIsDoubleClass(receiver)")
    public final double doSClass(final SClass receiver) {
      return Double.POSITIVE_INFINITY;
    }
  }
}

package som.primitives;

import som.interpreter.nodes.nary.UnaryExpressionNode;

import com.oracle.truffle.api.dsl.GenerateNodeFactory;
import com.oracle.truffle.api.dsl.Specialization;

public abstract class DoublePrims  {

  @GenerateNodeFactory
  @Primitive("doubleRound:")
  public abstract static class RoundPrim extends UnaryExpressionNode {
    @Specialization
    public final long doDouble(final double receiver) {
      return Math.round(receiver);
    }
  }

  @GenerateNodeFactory
  @Primitive("doublePositiveInfinity:")
  public abstract static class PositiveInfinityPrim extends UnaryExpressionNode {
    @Specialization
    public final double doSClass(final Object receiver) {
      return Double.POSITIVE_INFINITY;
    }
  }
}

Remove guard, isn't a primitive on the class anymore


package org.axonframework.boot.autoconfig;

import com.codahale.metrics.MetricRegistry;
import org.axonframework.metrics.GlobalMetricRegistry;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Auto configuration to set up Metrics for the infrastructure components.
 *
 * @author Steven van Beelen
 * @since 3.2
 */
@Configuration
public class MetricsAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    @ConditionalOnBean(MetricRegistry.class)
    public GlobalMetricRegistry globalMetricRegistry(MetricRegistry metricRegistry) {
        return new GlobalMetricRegistry(metricRegistry);
    }
}

package org.axonframework.boot.autoconfig;

import com.codahale.metrics.MetricRegistry;
import org.axonframework.metrics.GlobalMetricRegistry;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Auto configuration to set up Metrics for the infrastructure components.
 *
 * @author Steven van Beelen
 * @since 3.2
 */
@Configuration
@AutoConfigureBefore(AxonAutoConfiguration.class)
public class MetricsAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    @ConditionalOnBean(MetricRegistry.class)
    public GlobalMetricRegistry globalMetricRegistry(MetricRegistry metricRegistry) {
        return new GlobalMetricRegistry(metricRegistry);
    }
}

Configure this configuration before the AxonAutoConfiguration


package com.fanpics.opensource.android.modelrecord;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.lang.reflect.Type;

import retrofit.client.Response;
import retrofit.converter.ConversionException;
import retrofit.converter.GsonConverter;

public class ResponseParser<T> {
    private final Response response;
    private final Type type;
    private String dateFormat;

    public ResponseParser(Response response, Type type) {
        this.response = response;
        this.type = type;
    }

    public ResponseParser(Response response, Type type, String dateFormat) {
        this.response = response;
        this.type = type;
        this.dateFormat = dateFormat;
    }

    public Result<T> parse() {
        try {
            final T object = parseFromResponse();
            return new Result<T>(response, object);
        } catch (ConversionException e) {
            throw new RuntimeException("Response body must match type passed in at constructor", e);
        }
    }

    private T parseFromResponse() throws ConversionException {
        final Gson gson = getGson();
        final GsonConverter converter = new GsonConverter(gson);
        return (T) converter.fromBody(response.getBody(), type);
    }

    public Gson getGson() {
        Gson gson;

        if (dateFormat != null) {
            gson = new GsonBuilder().setDateFormat(dateFormat).create();
        } else {
            gson = new GsonBuilder().create();
        }

        return gson;
    }
}

package com.fanpics.opensource.android.modelrecord;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.lang.reflect.Type;

import retrofit.client.Response;
import retrofit.converter.ConversionException;
import retrofit.converter.GsonConverter;

public class ResponseParser<T> {
    private final Response response;
    private final Type type;
    private String dateFormat;

    public ResponseParser(Response response, Type type) {
        this.response = response;
        this.type = type;
    }

    public void setDateFormat(String dateFormat) {
        this.dateFormat = dateFormat;
    }

    public Result<T> parse() {
        try {
            final T object = parseFromResponse();
            return new Result<T>(response, object);
        } catch (ConversionException e) {
            throw new RuntimeException("Response body must match type passed in at constructor", e);
        }
    }

    private T parseFromResponse() throws ConversionException {
        final Gson gson = getGson();
        final GsonConverter converter = new GsonConverter(gson);
        return (T) converter.fromBody(response.getBody(), type);
    }

    public Gson getGson() {
        Gson gson;

        if (dateFormat != null) {
            gson = new GsonBuilder().setDateFormat(dateFormat).create();
        } else {
            gson = new GsonBuilder().create();
        }

        return gson;
    }
}

Move date format to setter


import javafx.fxml.FXML;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Color;
import javafx.stage.FileChooser;
import javafx.stage.Stage;

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

/**
 * Created by TUDelft SID on 1-5-2017.
 */
public class MenuController {

    @FXML
    private AnchorPane anchorPane;
    @FXML
    private Canvas canvas;
    private GraphicsContext gc;
    private GraphDrawer drawer;

    @FXML
    public void initialize() {
        gc = canvas.getGraphicsContext2D();
    }

    @FXML
    public void openFileClicked() {
        Stage stage = (Stage) anchorPane.getScene().getWindow();
        FileChooser fileChooser = new FileChooser();
        fileChooser.setTitle("Open Resource File");
        //fileChooser.setInitialDirectory(this.getClass().getResource("/resources").toString());
        File file = fileChooser.showOpenDialog(stage);
        if (file != null) {
            try {
                GfaParser parser = new GfaParser();
                System.out.println("src/main/resources/" + file.getName());
                SequenceGraph graph = graph = parser.parse("src/main/resources/" + file.getName());
                drawer = new GraphDrawer(graph, gc);
                drawer.drawShapes();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

}

import javafx.fxml.FXML;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Color;
import javafx.stage.FileChooser;
import javafx.stage.Stage;

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

/**
 * Created by TUDelft SID on 1-5-2017.
 */
public class MenuController {

    @FXML
    private AnchorPane anchorPane;
    @FXML
    private Canvas canvas;
    private GraphicsContext gc;
    private GraphDrawer drawer;

    @FXML
    public void initialize() {
        gc = canvas.getGraphicsContext2D();
    }

    @FXML
    public void openFileClicked() {
        Stage stage = (Stage) anchorPane.getScene().getWindow();
        FileChooser fileChooser = new FileChooser();
        fileChooser.setTitle("Open Resource File");
        //fileChooser.setInitialDirectory(this.getClass().getResource("/resources").toString());
        File file = fileChooser.showOpenDialog(stage);
        if (file != null) {
            try {
                GfaParser parser = new GfaParser();
                System.out.println("src/main/resources/" + file.getName());
                SequenceGraph graph = graph = parser.parse(file.getAbsolutePath());
                drawer = new GraphDrawer(graph, gc);
                drawer.drawShapes();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

}

Fix issue with loading of files due to wrong filepath


package com.grayben.riskExtractor.htmlScorer.partScorers.tagScorers;

import org.jsoup.parser.Tag;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import static org.junit.Assert.*;

/**
 * Created by beng on 22/12/2015.
 */
@RunWith(MockitoJUnitRunner.class)
public class TagSegmentationScorerTest extends MapScorerTest<Tag> {

    @Before
    public void setUp() throws Exception {

    }

    @After
    public void tearDown() throws Exception {

    }

    @Override
    @Test
    public void test_ScoreReturnsInteger_WhenArgumentIsNotEmpty() throws Exception {

    }

    @Override
    @Test
    public void test_ScoreGivesExpectedResult_WhenSimpleInput() throws Exception {

    }

    @Override
    @Test
    public void test_InitThrowsNullPointerException_WhenMapParamIsNull() throws Exception {

    }
}

package com.grayben.riskExtractor.htmlScorer.partScorers.tagScorers;

import org.jsoup.parser.Tag;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;

import static org.junit.Assert.*;

/**
 * Created by beng on 22/12/2015.
 */
@RunWith(MockitoJUnitRunner.class)
public class TagSegmentationScorerTest extends MapScorerTest<Tag> {

    TagSegmentationScorer tagSegmentationScorerSUT;

    @Mock public Tag tagToBeScoredMock;

    @Before
    public void setUp() throws Exception {
        this.tagSegmentationScorerSUT
                = new TagSegmentationScorer(
                TagSegmentationScorer.defaultMap()
        );
        super.setMapScorerSUT(this.tagSegmentationScorerSUT);
        super.setUp();
    }

    @After
    public void tearDown() throws Exception {
        super.tearDown();
    }

    @Override
    @Test
    public void test_ScoreReturnsInteger_WhenArgumentIsNotEmpty() throws Exception {

    }

    @Override
    @Test
    public void test_ScoreGivesExpectedResult_WhenSimpleInput() throws Exception {

    }

    @Override
    @Test
    public void test_InitThrowsNullPointerException_WhenMapParamIsNull() throws Exception {

    }
}

Add setup and teardown code


package org.skyscreamer.nevado.jms.util;

import org.junit.Assert;
import org.junit.Test;

/**
 * Tests the BackoffSleeper.
 *
 * @author Carter Page <carter@skyscreamer.org>
 */
public class BackoffSleeperTest {
    @Test
    public void testBackoffSleeper() throws InterruptedException {
        BackoffSleeper sleeper = new BackoffSleeper(10, 100, 2.0);
        long now = System.currentTimeMillis();
        sleeper.sleep();
        Assert.assertEquals(now + 10, System.currentTimeMillis(), 10);
        sleeper.sleep();
        Assert.assertEquals(now + 30, System.currentTimeMillis(), 10);
        sleeper.sleep();
        Assert.assertEquals(now + 70, System.currentTimeMillis(), 10);
        sleeper.sleep();
        Assert.assertEquals(now + 150, System.currentTimeMillis(), 10);
        sleeper.sleep();
        Assert.assertEquals(now + 250, System.currentTimeMillis(), 10);
        sleeper.reset();
        Assert.assertEquals(now + 250, System.currentTimeMillis(), 10);
        sleeper.sleep();
        Assert.assertEquals(now + 260, System.currentTimeMillis(), 10);
    }
}

package org.skyscreamer.nevado.jms.util;

import org.junit.Assert;
import org.junit.Test;

/**
 * Tests the BackoffSleeper.
 *
 * @author Carter Page <carter@skyscreamer.org>
 */
public class BackoffSleeperTest {
    // Cloudbees needs coarse resolution because their boxes have heavy contention
    public static final int ACCEPTABLE_DELTA_MS = 50;

    @Test
    public void testBackoffSleeper() throws InterruptedException {
        BackoffSleeper sleeper = new BackoffSleeper(50, 230, 2.0);
        long now = System.currentTimeMillis();
        sleeper.sleep();
        Assert.assertEquals(now + 50, System.currentTimeMillis(), ACCEPTABLE_DELTA_MS);
        sleeper.sleep();
        Assert.assertEquals(now + 150, System.currentTimeMillis(), ACCEPTABLE_DELTA_MS);
        sleeper.sleep();
        Assert.assertEquals(now + 350, System.currentTimeMillis(), ACCEPTABLE_DELTA_MS);
        sleeper.sleep();
        Assert.assertEquals(now + 580, System.currentTimeMillis(), ACCEPTABLE_DELTA_MS);
        sleeper.sleep();
        Assert.assertEquals(now + 810, System.currentTimeMillis(), ACCEPTABLE_DELTA_MS);
        sleeper.reset();
        Assert.assertEquals(now + 810, System.currentTimeMillis(), ACCEPTABLE_DELTA_MS);
        sleeper.sleep();
        Assert.assertEquals(now + 860, System.currentTimeMillis(), ACCEPTABLE_DELTA_MS);
    }
}

Make timer test more coarse to avoid race conditions with Cloudbees


/*
 * Copyright (C) 2007  Reto Schuettel, Robin Stocker
 *
 * IFS Institute for Software, HSR Rapperswil, Switzerland
 *
 */

package ch.hsr.ifs.pystructure.typeinference.model.definitions;

import org.python.pydev.parser.jython.ast.Assign;

import ch.hsr.ifs.pystructure.typeinference.model.base.IModule;
import ch.hsr.ifs.pystructure.typeinference.model.base.NameAdapter;

/**
 * Definition of a variable by an assignment.
 */
public class AssignDefinition extends Definition<Assign> {

	private final Value value;

	public AssignDefinition(IModule module, NameAdapter name, Assign assign, Value value) {
		super(module, name, assign);
		this.value = value;
	}

	public String toString() {
		return "Variable " + getName() + " defined at line " + getNode().beginLine + ", column " + getNode().beginColumn;
	}

	public Value getValue() {
		return value;
	}
}

/*
 * Copyright (C) 2007  Reto Schuettel, Robin Stocker
 *
 * IFS Institute for Software, HSR Rapperswil, Switzerland
 *
 */

package ch.hsr.ifs.pystructure.typeinference.model.definitions;

import org.python.pydev.parser.jython.ast.Assign;

import ch.hsr.ifs.pystructure.typeinference.model.base.IModule;
import ch.hsr.ifs.pystructure.typeinference.model.base.NameAdapter;

/**
 * Definition of a variable by an assignment.
 */
public class AssignDefinition extends Definition<Assign> {

	private final Value value;

	public AssignDefinition(IModule module, NameAdapter name, Assign assign, Value value) {
		super(module, name, assign);
		this.value = value;
	}

	public String toString() {
		return "Variable " + getName() + getNodePosition();
	}

	public Value getValue() {
		return value;
	}
}

Use the (L1 C2) form to report node positions here as well


package de.saxsys.mvvmfx.contacts;

import javafx.geometry.VerticalDirection;
import javafx.scene.Parent;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.loadui.testfx.Assertions;
import org.loadui.testfx.GuiTest;
import org.testfx.api.FxRobot;
import org.testfx.api.FxToolkit;

import static org.loadui.testfx.Assertions.verifyThat;
import static org.loadui.testfx.controls.TableViews.containsCell;

public class AppTestFxIT extends FxRobot {

	@Before
	public  void setupApp() throws Exception{

		FxToolkit.registerPrimaryStage();

		FxToolkit.setupApplication(App.class);
	}

	@Test
	public void testAddNewContact(){
		clickOn("#addNewContactButton");

		clickOn("#firstnameInput");
		write("luke");

		clickOn("#lastnameInput");
		write("skywalker");

		clickOn("#emailInput");
		write("luke.skywalker@example.org");

		clickOn("#nextButton");

		clickOn("#okButton");

		verifyThat("#masterContactTable", containsCell("luke"));
		verifyThat("#masterContactTable", containsCell("skywalker"));
		verifyThat("#masterContactTable", containsCell("luke.skywalker@example.org"));
	}
}

package de.saxsys.mvvmfx.contacts;

import static org.testfx.api.FxAssert.verifyThat;
import static org.testfx.matcher.control.TableViewMatchers.hasTableCell;

import org.junit.Before;
import org.junit.Test;
import org.testfx.api.FxRobot;
import org.testfx.api.FxToolkit;

public class AppTestFxIT extends FxRobot {

	@Before
	public void setupApp() throws Exception {

		FxToolkit.registerPrimaryStage();

		FxToolkit.setupApplication(App.class);
	}

	@Test
	public void testAddNewContact() {

		clickOn("#addNewContactButton");

		clickOn("#firstnameInput");
		write("luke");

		clickOn("#lastnameInput");
		write("skywalker");

		clickOn("#emailInput");
		write("luke.skywalker@example.org");

		clickOn("#nextButton");

		clickOn("#okButton");

		verifyThat("#masterContactTable", hasTableCell("luke"));
		verifyThat("#masterContactTable", hasTableCell("skywalker"));
		verifyThat("#masterContactTable", hasTableCell("luke.skywalker@example.org"));
	}
}

Update TestFX test in contacts module to fix compile error


package uk.ac.ebi.spot.goci.curation.service;

import uk.ac.ebi.spot.goci.curation.model.SnpAssociationForm;
import uk.ac.ebi.spot.goci.model.Association;

/**
 * Created by emma on 26/02/2016.
 *
 * @author emma
 *         <p>
 *         A component that takes a form containing association details and creates an associationobject or vice versa
 */
public interface SnpAssociationFormService {
    /**
     * Create association from values returned in form
     *
     * @return Association, which is normally saved in database
     */
    Association createAssociation(SnpAssociationForm form);

    /**
     * Create form from association
     *
     * @return Form, which is presented via controller to view
     */
    SnpAssociationForm createForm(Association association);
}

package uk.ac.ebi.spot.goci.curation.service;

import uk.ac.ebi.spot.goci.curation.model.SnpAssociationForm;
import uk.ac.ebi.spot.goci.model.Association;

/**
 * Created by emma on 26/02/2016.
 *
 * @author emma
 *         <p>
 *         A component that takes a form containing association details and creates an associationobject or vice versa
 */
public interface SnpAssociationFormService {

    /**
     * Create form from association
     *
     * @return Form, which is presented via controller to view
     */
    SnpAssociationForm createForm(Association association);
}

Update to interface to remove method that creates an association


package fortiss.gui.listeners.button;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import fortiss.components.Demand;
import fortiss.gui.Designer;
import fortiss.gui.listeners.helper.Chooser;

public class DBrowseListener extends MouseAdapter {

	@Override
	public void mouseClicked(MouseEvent e) {
		int building = Designer.currentBuilding;
		int component = Designer.currentComponent;
		Demand d = Designer.buildings.get(building).getDemand().get(component);

		// Update selection in text field
		Chooser c = new Chooser();
		String path = c.choosePath();

		if (path != null) {
			Designer.demandPanel.txtDConsumption.setText(path);
			d.setConsumptionProfile(path);
		}

		if (!d.getConsumptionProfile().isEmpty()) {
			Designer.demandPanel.setData(path);
		}
	}
}

package fortiss.gui.listeners.button;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import fortiss.components.Demand;
import fortiss.gui.Designer;
import fortiss.gui.listeners.helper.Chooser;

public class DBrowseListener extends MouseAdapter {

	@Override
	public void mouseClicked(MouseEvent e) {
		int building = Designer.currentBuilding;
		int component = Designer.currentComponent;
		Demand d = Designer.buildings.get(building).getDemand().get(component);

		// Update selection in text field
		Chooser c = new Chooser();
		String path = c.choosePath();

		if (path != null) {
			Designer.demandPanel.txtDConsumption.setText(path);
			d.setConsumptionProfile(path);
		}

		// null check necessary to account for a cancelled attempt to change path
		if (!d.getConsumptionProfile().isEmpty() && path != null) {
			Designer.demandPanel.setData(path);
		}
	}
}

Add null check for cancelled attempt too select profile file


/*
 * Copyright (C) 2010 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.
 */

/*
 * Copyright (C) 2012, Anthony Prieur & Daniel Oppenheim. All rights reserved.
 *
 * Original from SL4A modified to allow to embed Interpreter and scripts into an APK
 */

package info.namecoin.nmcontrolandroid.config;

public class GlobalConstants {

	public static final String PYTHON_MAIN_SCRIPT_NAME = "hello.py";
	public static final String PYTHON_PROJECT_ZIP_NAME = "my_python_project.zip";
	public static final String PYTHON_ZIP_NAME = "python_27.zip";
	public static final String PYTHON_EXTRAS_ZIP_NAME = "python_extras_27.zip";

	public static final boolean IS_FOREGROUND_SERVICE = true;
	public static final String LOG_TAG = "PythonAPK";
}

/*
 * Copyright (C) 2010 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.
 */

/*
 * Copyright (C) 2012, Anthony Prieur & Daniel Oppenheim. All rights reserved.
 *
 * Original from SL4A modified to allow to embed Interpreter and scripts into an APK
 */

package info.namecoin.nmcontrolandroid.config;

public class GlobalConstants {

	public static final String PYTHON_MAIN_SCRIPT_NAME = "nmcontrol.py";
	public static final String PYTHON_PROJECT_ZIP_NAME = "my_python_project.zip";
	public static final String PYTHON_ZIP_NAME = "python_27.zip";
	public static final String PYTHON_EXTRAS_ZIP_NAME = "python_extras_27.zip";

	public static final boolean IS_FOREGROUND_SERVICE = true;
	public static final String LOG_TAG = "PythonAPK";
}

Change main script name to nmcontrol.py


package com.jayway.jsonpath.matchers;

import org.junit.Test;

import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasNoJsonPath;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertThat;

public class HasNoJsonPathTest {
    private static final String JSON_STRING = "{" +
            "\"name\": \"Jessie\"" +
            "}";

    @Test
    public void shouldMatchMissingJsonPath() {
        assertThat(JSON_STRING, hasNoJsonPath("$.not_there"));
    }

    @Test
    public void shouldNotMatchExistingJsonPath() {
        assertThat(JSON_STRING, not(hasNoJsonPath("$.name")));
    }

    @Test
    public void shouldBeDescriptive() {
        assertThat(hasNoJsonPath("$.name"),
                hasToString(equalTo("is json without json path \"$['name']\"")));
    }

}

package com.jayway.jsonpath.matchers;

import org.junit.Test;

import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasNoJsonPath;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertThat;

public class HasNoJsonPathTest {
    private static final String JSON_STRING = "{" +
            "\"none\": null," +
            "\"name\": \"Jessie\"" +
            "}";

    @Test
    public void shouldMatchMissingJsonPath() {
        assertThat(JSON_STRING, hasNoJsonPath("$.not_there"));
    }

    @Test
    public void shouldNotMatchExistingJsonPath() {
        assertThat(JSON_STRING, not(hasNoJsonPath("$.name")));
    }

    @Test
    public void shouldNotMatchExplicitNull() {
        assertThat(JSON_STRING, not(hasNoJsonPath("$.none")));
    }

    @Test
    public void shouldBeDescriptive() {
        assertThat(hasNoJsonPath("$.name"),
                hasToString(equalTo("is json without json path \"$['name']\"")));
    }

}

Add hasNoJsonPath testcase for explicit null


package core.task.restart;

import core.command.CommandExecutor;
import core.message.DeployMessage;
import core.message.RestartAppMessage;
import core.task.Task;
import core.task.TaskPurpose;
import core.telemetry.Telemetry;

public class RestartAppTask implements Task<DeployMessage, RestartAppMessage> {

    private final String androidSdkPath;
    private final String appPackage;
    private final String mainActivity;

    public RestartAppTask(String androidSdkPath, String appPackage, String mainActivity) {
        this.androidSdkPath = androidSdkPath;
        this.appPackage = appPackage;
        this.mainActivity = mainActivity;
    }

    @Override
    public TaskPurpose getPurpose() {
        return TaskPurpose.RESTART_APPLICATION;
    }

    @Override
    public RestartAppMessage exec(Telemetry telemetry, DeployMessage message) {
        telemetry.message("Application package: %s", appPackage);
        telemetry.message("Application launcher activity: %s", mainActivity);
        telemetry.message("Restarting...");

        String cmdForceStop = String.format("adb shell am force-stop %s", appPackage);
        String cmdStart = String.format("adb shell am start -n \"%s/%s\" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER", appPackage, mainActivity);
        CommandExecutor.exec(cmdForceStop);
        CommandExecutor.exec(cmdStart);
        return null;
    }
}

package core.task.restart;

import core.command.CommandExecutor;
import core.message.DeployMessage;
import core.message.RestartAppMessage;
import core.task.Task;
import core.task.TaskPurpose;
import core.telemetry.Telemetry;

public class RestartAppTask implements Task<DeployMessage, RestartAppMessage> {

    private final String androidSdkPath;
    private final String appPackage;
    private final String mainActivity;

    public RestartAppTask(String androidSdkPath, String appPackage, String mainActivity) {
        this.androidSdkPath = androidSdkPath;
        this.appPackage = appPackage;
        this.mainActivity = mainActivity;
    }

    @Override
    public TaskPurpose getPurpose() {
        return TaskPurpose.RESTART_APPLICATION;
    }

    @Override
    public RestartAppMessage exec(Telemetry telemetry, DeployMessage message) {
        telemetry.message("Application package: %s", appPackage);
        telemetry.message("Application launcher activity: %s", mainActivity);
        telemetry.message("Restarting...");

        String adbFilePath = androidSdkPath + "/platform-tools/adb";
        String action = "android.intent.action.MAIN";
        String category = "android.intent.category.LAUNCHER";
        String cmdForceStop = String.format("%s shell am force-stop %s", adbFilePath, appPackage);
        String cmdStart = String.format("%s shell am start -n \"%s/%s\" -a %s -c %s", adbFilePath, appPackage, mainActivity, action, category);
        CommandExecutor.exec(cmdForceStop);
        CommandExecutor.exec(cmdStart);
        return null;
    }
}

Fix for running adb tool.


/*
 * (C) Copyright IBM Corporation 2016
 *
 * 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.ibm.ws.microprofile.sample.conference.vote.model;

public class Attendee {

	private String id;
	private final String revision;
	private final String name;

	public Attendee(String name) {
		this(null, null, name);
	}

	public Attendee(String id, String name) {
		this(id, null, name);
	}

	public Attendee(String id, String revision, String name) {
		this.id = id;
		this.revision = revision;
		this.name = name;
	}

	public String getId() {
		return id;
	}

	public void setID(String id) {
		this.id = id;
	}

	public String getRevision() {
		return revision;
	}

	public String getName() {
		return name;
	}
}

/*
 * (C) Copyright IBM Corporation 2016
 *
 * 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.ibm.ws.microprofile.sample.conference.vote.model;

public class Attendee {

	private String id;
	private final String revision;
	private String name;

	public Attendee(String name) {
		this(null, null, name);
	}

	public Attendee(String id, String name) {
		this(id, null, name);
	}

	public Attendee(String id, String revision, String name) {
		this.id = id;
		this.revision = revision;
		this.name = name;
	}

	public String getId() {
		return id;
	}

	public void setID(String id) {
		this.id = id;
	}

	public String getRevision() {
		return revision;
	}

	public String getName() {
		return name;
	}

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

Put the setName method back again


package com.google.step.coffee.servlets;

import com.google.api.client.auth.oauth2.Credential;
import com.google.step.coffee.JsonServlet;
import com.google.step.coffee.JsonServletRequest;
import com.google.step.coffee.OAuthService;
import com.google.step.coffee.UserManager;
import java.io.IOException;
import javax.servlet.annotation.WebServlet;

/**
 * Manage and check user authorisation for scopes for Google Calendar API in
 * OAuthService
 */
@WebServlet("/api/auth/calendar")
public class AuthCalendarServlet extends JsonServlet {

  /** Response object for fetching authorisation status of user. */
  private static class CalAuthResponse {
    private boolean authorised;
    private String authLink;

    CalAuthResponse(boolean authorised) {
      this.authorised = authorised;
    }

    CalAuthResponse(boolean authorised, String authLink) {
      this(authorised);
      this.authLink = authLink;
    }
  }

  @Override
  public Object get(JsonServletRequest request) throws IOException {
    CalAuthResponse responseData;
    Credential credentials = OAuthService.getCredentials(UserManager.getCurrentUserId());

    if (credentials != null) {
      responseData = new CalAuthResponse(true);
    } else {
      responseData = new CalAuthResponse(false, OAuthService.getAuthURL(request));
    }

    return responseData;
  }
}

package com.google.step.coffee.servlets;

import com.google.api.client.auth.oauth2.Credential;
import com.google.step.coffee.JsonServlet;
import com.google.step.coffee.JsonServletRequest;
import com.google.step.coffee.OAuthService;
import com.google.step.coffee.UserManager;
import java.io.IOException;
import javax.servlet.annotation.WebServlet;

/**
 * Manage and check user authorisation for scopes for Google Calendar API in
 * OAuthService
 */
@WebServlet("/api/auth/calendar")
public class AuthCalendarServlet extends JsonServlet {

  /** Response object for fetching authorisation status of user. */
  private static class CalAuthResponse {
    private boolean authorised;
    private String authLink;

    CalAuthResponse(boolean authorised) {
      this.authorised = authorised;
    }

    CalAuthResponse(boolean authorised, String authLink) {
      this(authorised);
      this.authLink = authLink;
    }
  }

  @Override
  public Object get(JsonServletRequest request) throws IOException {
    CalAuthResponse responseData;

    if (OAuthService.userHasAuthorised(UserManager.getCurrentUserId())) {
      responseData = new CalAuthResponse(false, OAuthService.getAuthURL(request));
    } else {
      responseData = new CalAuthResponse(true);
    }

    return responseData;
  }
}

Change credential check to not fetch credential to check existence


package tests;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertSame;

import com.github.sormuras.bach.Command;
import org.junit.jupiter.api.Test;
import tests.util.Print;

class CommandTests {

  @Test
  void withoutArguments() {
    var command = Command.of("name");
    assertEquals("name", command.name());
    var commandLine = command.toString();
    assertEquals("name", commandLine);
    assertEquals(Command.builder("name").build().toString(), commandLine);
  }

  @Test
  void withArguments() {
    var command = Command.builder("name").with(1).with("2", 3, 4).build();
    assertEquals("name", command.name());
    assertEquals("name 1 2 3 4", command.toString());
    assertEquals(Command.of("name", 1, 2, 3, 4).toString(), command.toString());
  }

  @Test
  void toCommandReturnsItself() {
    var expected = Command.of("name");
    assertSame(expected, expected.toCommand());
  }

  @Test
  void toCommandReturnsInstanceOfCommand() {
    assertEquals(Command.of("print"), new Print().toCommand());
    assertEquals(Command.of("print", "message"), new Print("message").toCommand());
  }
}

package tests;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertSame;

import com.github.sormuras.bach.Command;
import org.junit.jupiter.api.Test;
import tests.util.Print;

class CommandTests {

  @Test
  void withoutArguments() {
    var command = Command.of("name");
    assertEquals("name", command.name());
    var commandLine = command.toString();
    assertEquals("name", commandLine);
    assertEquals(Command.builder("name").build().toString(), commandLine);
  }

  @Test
  void withArguments() {
    var command = Command.builder("name").with(1).with("2", 3, 4).build();
    assertEquals("name", command.name());
    assertEquals("name 1 2 3 4", command.toString());
    assertEquals(Command.of("name", 1, 2, 3, 4).hashCode(), command.hashCode());
  }

  @Test
  void toCommandReturnsItself() {
    var expected = Command.of("name");
    assertSame(expected, expected.toCommand());
  }

  @Test
  void toCommandReturnsInstanceOfCommand() {
    assertEquals(Command.of("print"), new Print().toCommand());
    assertEquals(Command.of("print", "message"), new Print("message").toCommand());
  }
}

Use command's hash code method


package org.showshortcuts.internal;

import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;

/**
 * Initializer for shortcut visualizer preferences
 *
 * @author d031150
 */
public class ShortcutPreferenceInitializer extends AbstractPreferenceInitializer {

	public static final String PREF_KEY_SHORTCUTS_ENABLED = "enabled"; //$NON-NLS-1$
	public static final String PREF_KEY_MOUSE_TRIGGER_ENABLED = "enabled_mouseTrigger"; //$NON-NLS-1$

	public static final String PREF_KEY_TIME_TO_CLOSE = "timeToClose"; //$NON-NLS-1$
	public static final String PREF_KEY_SHOW_DESCRIPTION = "showCommandDescription"; //$NON-NLS-1$

	static final String THEME_CATEGORY = Activator.PLUGIN_ID + ".theme"; //$NON-NLS-1$

	@Override
	public void initializeDefaultPreferences() {
		IPreferenceStore store = Activator.getDefault().getPreferenceStore();

		store.setDefault(PREF_KEY_SHORTCUTS_ENABLED, true);
		store.setDefault(PREF_KEY_MOUSE_TRIGGER_ENABLED, false);
		store.setDefault(PREF_KEY_TIME_TO_CLOSE, 5000);
		store.setDefault(PREF_KEY_SHOW_DESCRIPTION, true);
	}

}

package org.showshortcuts.internal;

import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;

/**
 * Initializer for shortcut visualizer preferences
 *
 * @author d031150
 */
public class ShortcutPreferenceInitializer extends AbstractPreferenceInitializer {

	public static final String PREF_KEY_SHORTCUTS_ENABLED = "enabled"; //$NON-NLS-1$
	private static final String PREF_DEFAULT_SHORTCUTS_ENABLED = Activator.PLUGIN_ID + "." + PREF_KEY_SHORTCUTS_ENABLED; //$NON-NLS-1$
	public static final String PREF_KEY_MOUSE_TRIGGER_ENABLED = "enabled_mouseTrigger"; //$NON-NLS-1$

	public static final String PREF_KEY_TIME_TO_CLOSE = "timeToClose"; //$NON-NLS-1$
	public static final String PREF_KEY_SHOW_DESCRIPTION = "showCommandDescription"; //$NON-NLS-1$

	static final String THEME_CATEGORY = Activator.PLUGIN_ID + ".theme"; //$NON-NLS-1$

	@Override
	public void initializeDefaultPreferences() {
		IPreferenceStore store = Activator.getDefault().getPreferenceStore();

		boolean enabledDefault = Boolean.parseBoolean(System.getProperty(PREF_DEFAULT_SHORTCUTS_ENABLED, "true")); //$NON-NLS-1$
		store.setDefault(PREF_KEY_SHORTCUTS_ENABLED, enabledDefault);
		store.setDefault(PREF_KEY_MOUSE_TRIGGER_ENABLED, false);
		store.setDefault(PREF_KEY_TIME_TO_CLOSE, 5000);
		store.setDefault(PREF_KEY_SHOW_DESCRIPTION, true);
	}

}

Add a property to set the default enablement


package com.trello.navi2.rx;

import android.support.annotation.NonNull;
import com.trello.navi2.Event;
import com.trello.navi2.Listener;
import com.trello.navi2.NaviComponent;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.functions.Cancellable;

final class NaviOnSubscribe<T> implements ObservableOnSubscribe<T>{

  private final NaviComponent component;

  private final Event<T> event;

  NaviOnSubscribe(NaviComponent component, Event<T> event) {
    this.component = component;
    this.event = event;
  }

  @Override public void subscribe(final ObservableEmitter<T> emitter) throws Exception {
    EmitterListener<T> listener = new EmitterListener<>(emitter);
    emitter.setCancellable(listener);
    component.addListener(event, listener);
  }

  class EmitterListener<T> implements Listener<T>, Cancellable {
    private final ObservableEmitter<T> emitter;

    public EmitterListener(ObservableEmitter<T> emitter) {
      this.emitter = emitter;
    }

    @Override public void call(@NonNull T t) {
      emitter.onNext(t);
    }

    @Override public void cancel() throws Exception {
      component.removeListener(this);
    }
  }
}

package com.trello.navi2.rx;

import android.support.annotation.NonNull;
import com.trello.navi2.Event;
import com.trello.navi2.Listener;
import com.trello.navi2.NaviComponent;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.functions.Cancellable;

final class NaviOnSubscribe<T> implements ObservableOnSubscribe<T>{

  private final NaviComponent component;

  private final Event<T> event;

  NaviOnSubscribe(NaviComponent component, Event<T> event) {
    this.component = component;
    this.event = event;
  }

  @Override public void subscribe(final ObservableEmitter<T> emitter) throws Exception {
    EmitterListener listener = new EmitterListener(emitter);
    emitter.setCancellable(listener);
    component.addListener(event, listener);
  }

  class EmitterListener implements Listener<T>, Cancellable {
    private final ObservableEmitter<T> emitter;

    public EmitterListener(ObservableEmitter<T> emitter) {
      this.emitter = emitter;
    }

    @Override public void call(@NonNull T t) {
      emitter.onNext(t);
    }

    @Override public void cancel() throws Exception {
      component.removeListener(this);
    }
  }
}

Fix unnecessary type parameter hiding


package com.haxademic.core.render;

import com.haxademic.core.app.P;

public class AnimationLoop {

	protected float frames;
	protected float progress;
	protected float progressRads;

	public AnimationLoop(float frames) {
		this.frames = frames;
	}

	public float frames() {
		return frames;
	}

	public float progress() {
		return progress;
	}

	public float progressRads() {
		return progressRads;
	}

	public void update() {
		float loopFrames = (float) P.p.frameCount % frames;
		progress = loopFrames / frames;
		progressRads = progress * P.TWO_PI;
		P.p.debugView.setValue("AnimationLoop.progress()", progress);
	}

}

package com.haxademic.core.render;

import com.haxademic.core.app.P;

public class AnimationLoop {

	protected float frames;
	protected float progress;
	protected float progressRads;

	public AnimationLoop(float frames) {
		this.frames = frames;
	}

	public float frames() {
		return frames;
	}

	public float progress() {
		return progress;
	}

	public float progressRads() {
		return progressRads;
	}

	public void update() {
		float loopFrames = (float) P.p.frameCount % frames;
		progress = loopFrames / frames;
		progressRads = progress * P.TWO_PI;
		if(P.p.debugView != null) P.p.debugView.setValue("AnimationLoop.progress()", progress);
	}

}

Fix for PDF rendering mode


/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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 org.apache.beam.runners.spark.structuredstreaming.translation;

import org.apache.beam.sdk.transforms.PTransform;

/** Supports translation between a Beam transform, and Spark's operations on Datasets. */
public interface TransformTranslator<TransformT extends PTransform> {

  /** Base class for translators of {@link PTransform}. */
  void translateTransform(TransformT transform, TranslationContext context);
}

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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 org.apache.beam.runners.spark.structuredstreaming.translation;

import java.io.Serializable;
import org.apache.beam.sdk.transforms.PTransform;

/** Supports translation between a Beam transform, and Spark's operations on Datasets. */
public interface TransformTranslator<TransformT extends PTransform> extends Serializable {

  /** Base class for translators of {@link PTransform}. */
  void translateTransform(TransformT transform, TranslationContext context);
}

Put all transform translators Serializable


package eic.beike.projectx.util;

/**
 * Created by alex on 9/22/15.
 */
public class Constants {
    public static final String BASE_URL = "https://ece01.ericsson.net:4443/ecity";
    public static final String AUTHORIZATION ="";
}

package eic.beike.projectx.util;

/**
 * Global constants.
 *
 * Constructor call to avoid compile time inlining making
 * testing easier (reflect to change possible.)
 *
 * Created by alex on 9/22/15.
 */
public class Constants {
    public static final String BASE_URL = new String("https://ece01.ericsson.net:4443/ecity");
    public static final String AUTHORIZATION =new String("Z3JwMjU6cnZyMkMqT25kNw==");
}

Change constants to avoid compiler inlining.


package org.drools.workbench.screens.guided.rule.type;

import javax.enterprise.context.ApplicationScoped;

import org.uberfire.backend.vfs.Path;
import org.uberfire.workbench.type.ResourceTypeDefinition;

@ApplicationScoped
public class GuidedRuleDSLRResourceTypeDefinition
        implements ResourceTypeDefinition {

    @Override
    public String getShortName() {
        return "guided rule (with DSL)";
    }

    @Override
    public String getDescription() {
        return "Guided Rule";
    }

    @Override
    public String getPrefix() {
        return "";
    }

    @Override
    public String getSuffix() {
        return "gre.dslr";
    }

    @Override
    public int getPriority() {
        return 102;
    }

    @Override
    public String getSimpleWildcardPattern() {
        return "*." + getSuffix();
    }

    @Override
    public boolean accept( final Path path ) {
        return path.getFileName().endsWith( "." + getSuffix() );
    }
}

package org.drools.workbench.screens.guided.rule.type;

import javax.enterprise.context.ApplicationScoped;

import org.uberfire.backend.vfs.Path;
import org.uberfire.workbench.type.ResourceTypeDefinition;

@ApplicationScoped
public class GuidedRuleDSLRResourceTypeDefinition
        implements ResourceTypeDefinition {

    @Override
    public String getShortName() {
        return "guided rule (with DSL)";
    }

    @Override
    public String getDescription() {
        return "Guided Rule (with DSL)";
    }

    @Override
    public String getPrefix() {
        return "";
    }

    @Override
    public String getSuffix() {
        return "gre.dslr";
    }

    @Override
    public int getPriority() {
        return 102;
    }

    @Override
    public String getSimpleWildcardPattern() {
        return "*." + getSuffix();
    }

    @Override
    public boolean accept( final Path path ) {
        return path.getFileName().endsWith( "." + getSuffix() );
    }
}

Change DSLR description - so it doesn't look like a duplicate


package lt.vilnius.tvarkau.utils;

import android.app.Activity;
import android.content.Context;
import android.net.ConnectivityManager;

public class NetworkUtils {

    public static boolean isNetworkConnected(Activity activity) {
        ConnectivityManager cm = (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
        return cm.getActiveNetworkInfo() != null;
    }
}

package lt.vilnius.tvarkau.utils;

import android.app.Activity;
import android.content.Context;
import android.net.ConnectivityManager;

public class NetworkUtils {

    public static boolean isNetworkConnected(Activity activity) {
        ConnectivityManager cm = (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
        return cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isConnected();
    }
}

Improve user network check by checking actual connection to internet


package io.github.pbremer.icecreammanager.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class SimpleGreetingController {

    public static final String HELLO = "Hello, team formally known as 'Team 6'!";

    private static final Logger LOGGER = LoggerFactory
            .getLogger(SimpleGreetingController.class);

    @RequestMapping("/")
    public String hello() {
        LOGGER.debug("At index");
        // return HELLO;
        return "public/index";
    }

    @RequestMapping("/dashboard")
    public String dashboard() {
        LOGGER.debug("At dashboard");
        // return HELLO;
        return "public/dashboard";
    }

    @RequestMapping("/alter")
    public String alter() {
        LOGGER.debug("At alter");
        // return HELLO;
        return "public/alter";
    }

    @RequestMapping("/inventory")
    public String inventory() {
        LOGGER.debug("At inventory");
        // return HELLO;
        return "public/inventory";
    }
    @RequestMapping("/uploadfile")
    public String uploadfile() {
        LOGGER.debug("At uploadfile");
        // return HELLO;
        return "public/uploadfile";
    }
}

package io.github.pbremer.icecreammanager.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class SimpleGreetingController {

    public static final String HELLO = "Hello, team formally known as 'Team 6'!";

    private static final Logger LOGGER = LoggerFactory
            .getLogger(SimpleGreetingController.class);

    //@RequestMapping("/")
    public String hello() {
        LOGGER.debug("At index");
        // return HELLO;
        return "public/index";
    }

    @RequestMapping(path={"/dashboard", "/"})
    public String dashboard() {
        LOGGER.debug("At dashboard");
        // return HELLO;
        return "public/dashboard";
    }

    @RequestMapping("/alter")
    public String alter() {
        LOGGER.debug("At alter");
        // return HELLO;
        return "public/alter";
    }

    @RequestMapping("/inventory")
    public String inventory() {
        LOGGER.debug("At inventory");
        // return HELLO;
        return "public/inventory";
    }
    @RequestMapping("/uploadfile")
    public String uploadfile() {
        LOGGER.debug("At uploadfile");
        // return HELLO;
        return "public/uploadfile";
    }
}

Change homepage landing to dashboard


/*
 * Copyright (c) 2008-2014 MongoDB, 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.mongodb.operation;

import com.mongodb.ReadPreference;

/**
 * An interface describing the execution of a read or a write operation.
 *
 * @since 3.0
 */
public interface OperationExecutor {
    /**
     * Execute the read operation with the given read preference.
     *
     * @param operation the read operation.
     * @param readPreference the read preference.
     * @param <T> the operations result type.
     * @return the result of executing the operation.
     */
    <T> T execute(final ReadOperation<T> operation, final ReadPreference readPreference);

    /**
     * Execute the write operation.
     *
     * @param operation the write operation.
     * @param <T> the operations result type.
     * @return the result of executing the operation.
     */
    <T> T execute(final WriteOperation<T> operation);
}

/*
 * Copyright (c) 2008-2014 MongoDB, 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.mongodb.operation;

import com.mongodb.ReadPreference;

/**
 * An interface describing the execution of a read or a write operation.
 *
 * @since 3.0
 */
public interface OperationExecutor {
    /**
     * Execute the read operation with the given read preference.
     *
     * @param operation the read operation.
     * @param readPreference the read preference.
     * @param <T> the operations result type.
     * @return the result of executing the operation.
     */
    <T> T execute(ReadOperation<T> operation, ReadPreference readPreference);

    /**
     * Execute the write operation.
     *
     * @param operation the write operation.
     * @param <T> the operations result type.
     * @return the result of executing the operation.
     */
    <T> T execute(WriteOperation<T> operation);
}

Remove unnecessary final on interface


package org.fakekoji.api.http.rest;

import java.util.List;
import java.util.Map;
import java.util.Optional;

class RestUtils {

    static Optional<String> extractParamValue(Map<String, List<String>> paramsMap, String param) {
        return Optional.ofNullable(paramsMap.get(param))
                .filter(list -> list.size() == 1)
                .map(list -> list.get(0));
    }

}

package org.fakekoji.api.http.rest;

import org.fakekoji.functional.Result;
import org.fakekoji.functional.Tuple;
import org.fakekoji.jobmanager.model.Product;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;

class RestUtils {

    static Optional<String> extractParamValue(Map<String, List<String>> paramsMap, String param) {
        return Optional.ofNullable(paramsMap.get(param))
                .filter(list -> list.size() == 1)
                .map(list -> list.get(0));
    }

    static Result<String, OToolError> extractMandatoryParamValue(Map<String, List<String>> paramsMap, String param) {
        return extractParamValue(paramsMap, param).<Result<String, OToolError>>map(Result::ok)
                .orElseGet(() -> Result.err(new OToolError(
                        "Missing mandatory parameter: '" + param + "'!",
                        400
                )));
    }

    static Result<Tuple<Product, Product>, OToolError> extractProducts(final Map<String, List<String>> paramsMap) {
        return extractMandatoryParamValue(paramsMap, "from").flatMap(fromValue ->
           extractProduct(fromValue).flatMap(fromProduct ->
               extractMandatoryParamValue(paramsMap, "to").flatMap(toValue ->
                   extractProduct(toValue).flatMap(toProduct ->
                       Result.ok(new Tuple<>(fromProduct, toProduct))
                   )
               )
           )
        );
    }

    static Result<Product, OToolError> extractProduct(final String paramValue) {
        final String[] split = paramValue.split(",");
        if (split.length != 2 || split[0].trim().isEmpty() || split[1].trim().isEmpty()) {
            return Result.err(new OToolError("Expected format jdkVersionId,packageName", 400));
        }
        return Result.ok(new Product(split[0], split[1]));
    }

    static Result<List<String>, OToolError> extractProjectIds(Map<String, List<String>> paramsMap) {
        final Optional<String> projectIdsOptional = extractParamValue(paramsMap, "projects");
        return projectIdsOptional.<Result<List<String>, OToolError>>map(s ->
                Result.ok(Arrays.asList(s.split(",")))
        ).orElseGet(() -> Result.err(new OToolError(
                "projects are mandatory. Use get/projects?as=list to get them all",
                400
        )));
    }
}

Create helper methods for product bump


package io.rocketscience.java.lang;

import java.util.function.Supplier;

public class JavaExtensions {

	private JavaExtensions() {
	}

	public static void require(boolean condition, String message) throws IllegalStateException {
		if (!condition) {
			throw new IllegalStateException(message);
		}
	}

	public static void require(boolean condition, Supplier<String> lazyMessage) throws IllegalStateException {
		if (!condition) {
			throw new IllegalStateException(lazyMessage.get());
		}
	}

}

package io.rocketscience.java.lang;

import java.util.function.Supplier;

public interface JavaExtensions {

	static void require(boolean condition, String message) throws IllegalStateException {
		if (!condition) {
			throw new IllegalStateException(message);
		}
	}

	static void require(boolean condition, Supplier<String> lazyMessage) throws IllegalStateException {
		if (!condition) {
			throw new IllegalStateException(lazyMessage.get());
		}
	}

}

Create interfaces for Extensions with static methods by convention


/**
 * Copyright 2010 The PlayN Authors
 *
 * 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 playn.html;

import com.google.gwt.canvas.dom.client.Context2d;

import playn.core.AbstractLayer;

abstract class HtmlLayerCanvas extends AbstractLayer {

  abstract void paint(Context2d ctx, float parentAlpha);

  protected HtmlLayerCanvas() {
    super(new HtmlInternalTransform());
  }

  void transform(Context2d ctx) {
    ctx.translate(originX, originY);
    ctx.transform(transform.m00(), transform.m01(), transform.m10(),
        transform.m11(), transform.tx() - originX, transform.ty() - originY);
    ctx.translate(-originX, -originY);
  }
}

/**
 * Copyright 2010 The PlayN Authors
 *
 * 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 playn.html;

import com.google.gwt.canvas.dom.client.Context2d;

import playn.core.AbstractLayer;
import playn.core.StockInternalTransform;

abstract class HtmlLayerCanvas extends AbstractLayer {

  abstract void paint(Context2d ctx, float parentAlpha);

  protected HtmlLayerCanvas() {
    super(HtmlPlatform.hasTypedArraySupport ?
          new HtmlInternalTransform() : new StockInternalTransform());
  }

  void transform(Context2d ctx) {
    ctx.translate(originX, originY);
    ctx.transform(transform.m00(), transform.m01(), transform.m10(),
        transform.m11(), transform.tx() - originX, transform.ty() - originY);
    ctx.translate(-originX, -originY);
  }
}

Use approrpiate transform implementation in canvas backend.


package ui;

public class IdGenerator {
    public static String getPanelCellId(String repoId, int panelIndex, int issueId) {
        return repoId + "_col" + panelIndex + "_" + issueId;
    }

    public static String getPanelFilterTextFieldId(String repoId, int panelIndex) {
        return repoId + "_col" + panelIndex + "_filterTextField";
    }

    public static String getRepositorySelectorId() {
        return "repositorySelector";
    }

    public static String getPanelNameAreaId(String repoId, int panelIndex) {
        return repoId + "_col" + panelIndex + "_nameText";
    }
}

package ui;

public final class IdGenerator {
    private IdGenerator() {}

    public static String getPanelCellId(String repoId, int panelIndex, int issueId) {
        return repoId + "_col" + panelIndex + "_" + issueId;
    }

    public static String getPanelFilterTextFieldId(String repoId, int panelIndex) {
        return repoId + "_col" + panelIndex + "_filterTextField";
    }

    public static String getRepositorySelectorId() {
        return "repositorySelector";
    }

    public static String getPanelNameAreaId(String repoId, int panelIndex) {
        return repoId + "_col" + panelIndex + "_nameText";
    }
}

Add private constructor and made class final.


package utils;

public class SemesterInfo {
    public static final int NO_OF_WEEKS_FIRST_SEMESTER = 16;
    public static final int CHRISTMAS_HOLIDAY = 12;
    public static final int CHRISTMAS_HOLIDAY_LENGTH = 2;

    public static final int NO_OF_WEEKS_SECOND_SEMESTER = 15;
    public static final int EASTER_HOLIDAY = 7;
    public static final int EASTER_HOLIDAY_LENGTH = 1;

    public static final String STARTING_DATE_FIRST_SEMESTER = "2016-10-03";
    public static final String STARTING_DATE_SECOND_SEMESTER = "2017-02-27";

    public static int getNoOfWeeks(int semester) {
        return (semester == 1 ? NO_OF_WEEKS_FIRST_SEMESTER : NO_OF_WEEKS_SECOND_SEMESTER);
    }

    public static int getHolidayStartingWeek(int semester) {
        return (semester == 1 ? CHRISTMAS_HOLIDAY : EASTER_HOLIDAY);
    }

    public static int getHolidayLength(int semester) {
        return (semester == 1 ? CHRISTMAS_HOLIDAY_LENGTH : EASTER_HOLIDAY_LENGTH);
    }

    public static String getStartingDate(int semester) {
        return (semester == 1 ? STARTING_DATE_FIRST_SEMESTER : STARTING_DATE_SECOND_SEMESTER);
    }
}

package utils;

public class SemesterInfo {
    public static final int NO_OF_WEEKS_FIRST_SEMESTER = 16;
    public static final int CHRISTMAS_HOLIDAY = 12;
    public static final int CHRISTMAS_HOLIDAY_LENGTH = 2;

    public static final int NO_OF_WEEKS_SECOND_SEMESTER = 15;
    public static final int EASTER_HOLIDAY = 7;
    public static final int EASTER_HOLIDAY_LENGTH = 1;

    public static final String STARTING_DATE_FIRST_SEMESTER = "2017-10-02";
    public static final String STARTING_DATE_SECOND_SEMESTER = "2017-02-27";

    public static int getNoOfWeeks(int semester) {
        return (semester == 1 ? NO_OF_WEEKS_FIRST_SEMESTER : NO_OF_WEEKS_SECOND_SEMESTER);
    }

    public static int getHolidayStartingWeek(int semester) {
        return (semester == 1 ? CHRISTMAS_HOLIDAY : EASTER_HOLIDAY);
    }

    public static int getHolidayLength(int semester) {
        return (semester == 1 ? CHRISTMAS_HOLIDAY_LENGTH : EASTER_HOLIDAY_LENGTH);
    }

    public static String getStartingDate(int semester) {
        return (semester == 1 ? STARTING_DATE_FIRST_SEMESTER : STARTING_DATE_SECOND_SEMESTER);
    }
}

Update - Starting Date First Semester


package de.eightbitboy.ecorealms.simulation.production;

import de.eightbitboy.ecorealms.simulation.resource.Resource;

public class ProducerData {

	public void addInputResource(Resource resource, int amount) {

	}

	public void addOutputResource(Resource resource, int amount) {

	}
}

package de.eightbitboy.ecorealms.simulation.production;

import java.util.HashMap;
import java.util.Map;

import de.eightbitboy.ecorealms.simulation.resource.Resource;

public class ProducerData {

	public Map<Resource, Integer> input = new HashMap<Resource, Integer>();

	public Map<Resource, Integer> output = new HashMap<Resource, Integer>();

	public void addInputResource(Resource resource, int amount) {

	}

	public void addOutputResource(Resource resource, int amount) {

	}
}

Add fields for holding data


package us.myles.ViaVersion.protocols.protocol1_9to1_8.listeners;

import lombok.RequiredArgsConstructor;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import us.myles.ViaVersion.ViaVersionPlugin;
import us.myles.ViaVersion.api.minecraft.Position;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.EntityTracker;

@RequiredArgsConstructor
public class BlockListener implements Listener{

    private final ViaVersionPlugin plugin;

    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    public void placeBlock(BlockPlaceEvent e) {
        if(plugin.isPorted(e.getPlayer())) {
            Block b = e.getBlockPlaced();
            plugin.getConnection(e.getPlayer()).get(EntityTracker.class).addBlockInteraction(new Position((long)b.getX(), (long)b.getY(), (long)b.getZ()));
        }
    }
}

package us.myles.ViaVersion.protocols.protocol1_9to1_8.listeners;

import lombok.RequiredArgsConstructor;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import us.myles.ViaVersion.ViaVersionPlugin;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.minecraft.Position;
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.EntityTracker;

@RequiredArgsConstructor
public class BlockListener implements Listener {

    private final ViaVersionPlugin plugin;

    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    public void placeBlock(BlockPlaceEvent e) {
        if(plugin.isPorted(e.getPlayer())) {
            UserConnection c = plugin.getConnection(e.getPlayer());
            if (!c.get(ProtocolInfo.class).getPipeline().contains(Protocol1_9TO1_8.class)) return;
            Block b = e.getBlockPlaced();
            plugin.getConnection(e.getPlayer()).get(EntityTracker.class).addBlockInteraction(new Position((long) b.getX(), (long) b.getY(), (long) b.getZ()));
        }
    }
}

Check if user is indeed using 1.9 to 1.8 protocol conversion


package edu.stuy.starlorn.entities;

public class Projectile extends Entity {
    // Angle is radians, measured from the positive x axis
    private double _angle, _speed;

    public Projectile() {
        super();
        _angle = 0;
        _speed = 1;
    }

    @Override
    public void step() {
        setXY(getX() + (getSpeed() * Math.cos(getAngle())),
              getY() + (getSpeed() * Math.sin(getAngle())));
    }

    public void setAngle(double angle) {
        _angle = angle;
    }

    public double getAngle() {
        return _angle;
    }

    public void setSpeed(double speed) {
        _speed = speed;
    }

    public double getSpeed() {
        return _speed;
    }
}

package edu.stuy.starlorn.entities;

public class Projectile extends Entity {
    // Angle is radians, measured from the positive x axis
    private double _angle, _speed;

    public Projectile() {
        super();
        _angle = 0;
        _speed = 1;
    }

    @Override
    public void step() {
        setXY(getX() + (getSpeed() * Math.cos(getAngle())),
              getY() + (getSpeed() * Math.sin(getAngle())));
    }

    public boolean shouldDespawnOnCollision() {
        return false;
    }

    public void setAngle(double angle) {
        _angle = angle;
    }

    public double getAngle() {
        return _angle;
    }

    public void setSpeed(double speed) {
        _speed = speed;
    }

    public double getSpeed() {
        return _speed;
    }
}

Add shouldDespawn tag to projectiles, so we can do piercing shots


package fr.issamax.essearch.test;

import org.elasticsearch.client.Client;
import org.elasticsearch.node.Node;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * Just launch the Spring factory
 * @author PILATO
 *
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
		"classpath:annotation-context.xml"
		})
public class AbstractConfigurationTest {

	@Autowired Node node;

	@Autowired Client client;
}

package fr.issamax.essearch.test;

import org.elasticsearch.client.Client;
import org.elasticsearch.node.Node;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * Just launch the Spring factory
 * @author PILATO
 *
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
		"classpath:annotation-context.xml"
		})
public abstract class AbstractConfigurationTest {

	@Autowired Node node;

	@Autowired Client client;
}

Disable tests for abstract class


package sqlancer.dbms;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

import org.junit.jupiter.api.Test;

import sqlancer.Main;

public class TestMySQL {

    @Test
    public void testMySQL() {
        String mysqlAvailable = System.getenv("MYSQL_AVAILABLE");
        boolean mysqlIsAvailable = mysqlAvailable != null && mysqlAvailable.equalsIgnoreCase("true");
        assumeTrue(mysqlIsAvailable);
        assertEquals(0,
                Main.executeMain(new String[] { "--random-seed", "0", "--timeout-seconds", TestConfig.SECONDS,
                        "--max-expression-depth", "1", "--num-threads", "1", "--num-queries", TestConfig.NUM_QUERIES,
                        "mysql" }));
    }

}

package sqlancer.dbms;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

import org.junit.jupiter.api.Test;

import sqlancer.Main;

public class TestMySQL {

    String mysqlAvailable = System.getenv("MYSQL_AVAILABLE");
    boolean mysqlIsAvailable = mysqlAvailable != null && mysqlAvailable.equalsIgnoreCase("true");

    @Test
    public void testMySQL() {
        assumeTrue(mysqlIsAvailable);
        assertEquals(0,
                Main.executeMain(new String[] { "--random-seed", "0", "--timeout-seconds", TestConfig.SECONDS,
                        "--max-expression-depth", "1", "--num-threads", "4", "--num-queries", TestConfig.NUM_QUERIES,
                        "mysql" }));
    }

    @Test
    public void testPQS() {
        assumeTrue(mysqlIsAvailable);
        assertEquals(0,
                Main.executeMain(new String[] { "--random-seed", "0", "--timeout-seconds", TestConfig.SECONDS,
                        "--num-threads", "4", "--random-string-generation", "ALPHANUMERIC", "--database-prefix",
                        "pqsdb" /* Workaround for connections not being closed */, "--num-queries", "100000", "mysql",
                        "--oracle", "PQS" }));
    }

}

Add tests for the PQS implementation


package kurs.zadania.adressbook.appmanager;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class NavigationHelper extends HelperBase{

  public NavigationHelper(WebDriver wd) {
    super(wd);
  }

 // public void gotoGroupPage() { click(By.linkText("groups")); }

/* sprawdzanie elementu na stronie i przejście po linku - wariant 1
  public void gotoGroupPage() {
    if (!isElementPresent(By.tagName("h1"))
            || !wd.findElement(By.tagName("h1")).getText().equals("Groups")
            || !isElementPresent(By.name("new"))) {
      click(By.linkText("groups"));
    }
  }
*/
// sprawdzanie elementu na stronie i przejście po linku - wariant 2 lepszy

  public void gotoGroupPage() {
    if (isElementPresent(By.tagName("h1"))
            && !wd.findElement(By.tagName("h1")).getText().equals("Groups")
            && !isElementPresent(By.name("new"))) {
      return;
    }
      click(By.linkText("groups"));
    }

  public void gotoMainPage() {
    if (isElementPresent(By.id("maintable"))) {
      return;
    }
      click(By.linkText("home"));
  }
}

package kurs.zadania.adressbook.appmanager;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class NavigationHelper extends HelperBase{

  public NavigationHelper(WebDriver wd) {
    super(wd);
  }

  public void gotoGroupPage() {
      click(By.linkText("groups"));
  }

  public void gotoMainPage() {
      click(By.linkText("home"));

  }
}

Revert "optimization of the transition between the pages"


/*
 * substitution-schedule-parser - Java library for parsing schools' substitution schedules
 * Copyright (c) 2017 Johan v. Forstner
 *
 * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
 * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

package me.vertretungsplan.additionalinfo.lsschleswig;

import me.vertretungsplan.additionalinfo.BaseRSSFeedParser;

public class LsSchleswigRSSParser extends BaseRSSFeedParser {
    @Override protected String getRSSUrl() {
        return "http://hp.lornsenschule.de/index" +
                ".php/schule/artikelarchiv?option=com_content&format=feed&type=rss&filter_order=a" +
                ".publish_up&filter_order_Dir=desc";
    }
}

/*
 * substitution-schedule-parser - Java library for parsing schools' substitution schedules
 * Copyright (c) 2017 Johan v. Forstner
 *
 * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
 * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

package me.vertretungsplan.additionalinfo.lsschleswig;

import me.vertretungsplan.additionalinfo.BaseRSSFeedParser;

public class LsSchleswigRSSParser extends BaseRSSFeedParser {
    @Override protected String getRSSUrl() {
        return "http://hp.lornsenschule.de/index" +
                ".php/12-aktuelle-beitraege?option=com_content&format=feed&type=rss&filter_order=a" +
                ".publish_up&filter_order_Dir=desc";
    }
}

Update LS Schleswig feed URL


package com.naijab.nextzytimeline.ui.people.addform;

import com.naijab.nextzytimeline.base.BaseMvpPresenter;

import io.realm.Realm;

public class AddPeopleFragmentPresenter extends BaseMvpPresenter<AddPeopleFragmentInterface.View>
        implements AddPeopleFragmentInterface.Presenter{

    private Realm realm;

    public static AddPeopleFragmentInterface.Presenter create(){
        return new AddPeopleFragmentPresenter();
    }

    @Override
    public void onViewStart() {
        super.onViewStart();
        realm = Realm.getDefaultInstance();
    }

    @Override
    public void onViewStop() {
        super.onViewStop();
        realm.close();
    }
}

package com.naijab.nextzytimeline.ui.people.addform;

import com.naijab.nextzytimeline.base.BaseMvpPresenter;
import com.naijab.nextzytimeline.ui.people.model.PeopleModel;

import io.realm.Realm;
import io.realm.RealmResults;

public class AddPeopleFragmentPresenter extends BaseMvpPresenter<AddPeopleFragmentInterface.View>
        implements AddPeopleFragmentInterface.Presenter {

    private Realm realm;

    public static AddPeopleFragmentInterface.Presenter create() {
        return new AddPeopleFragmentPresenter();
    }

    @Override
    public void onViewStart() {
        super.onViewStart();
        realm = Realm.getDefaultInstance();
    }

    @Override
    public void onViewStop() {
        super.onViewStop();
        realm.close();
    }

    @Override
    public void saveIntoRealm(final String name,
                              final String birthday,
                              final String startJob,
                              final String job,
                              final String game,
                              final String smartphone,
                              final String photos) {

        RealmResults<PeopleModel> resultRealm = realm.where(PeopleModel.class)
                .findAll();
        final int id = resultRealm.size() + 1;

        realm.executeTransactionAsync(new Realm.Transaction() {
            @Override
            public void execute(Realm bgRealm) {
                PeopleModel people = realm.createObject(PeopleModel.class, id);
                people.setName(name);
                people.setBirthday(birthday);
                people.setJobstart(startJob);
                people.setJob(job);
                people.setGame(game);
                people.setSmartphone(smartphone);
                people.setPhoto(photos);
            }
        }, new Realm.Transaction.OnSuccess() {
            @Override
            public void onSuccess() {
                getView().response("onSuccess");
            }
        }, new Realm.Transaction.OnError() {
            @Override
            public void onError(Throwable error) {
                getView().response(error.getMessage());
            }
        });

    }
}

Add Insert Realm in Presenter


package org.tearsofaunicorn.auspost.domestic.postcode.search.model;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * _TODO:_ Write summary
 */
public class SearchRequestTest {

    @Test
    public void testQuery() throws Exception {
        Assert.fail("Implement test");

    }

    @Test
    public void testSetState() throws Exception {
        Assert.fail("Implement test");

    }

    @Test
    public void testExcludePostBoxes() throws Exception {
        Assert.fail("Implement test");

    }

    @Test
    public void testBuildUrl() throws Exception {
        Assert.fail("Implement test");

    }
}

package org.tearsofaunicorn.auspost.domestic.postcode.search.model;

import org.junit.Assert;
import org.junit.Test;

public class SearchRequestTest {

    @Test
    public void testQuery() throws Exception {
        String request = new SearchRequest("apiKey", "http://test.com").query("query").buildUrl();
        Assert.assertTrue(request.contains("q=query"));
    }

    @Test
    public void testSetState() throws Exception {
        String request = new SearchRequest("apiKey", "http://test.com").setState(AustralianState.WA).buildUrl();
        Assert.assertTrue(request.contains("state=WA"));
    }

    @Test
    public void testExcludePostBoxes() throws Exception {
        String request = new SearchRequest("apiKey", "http://test.com").excludePostBoxes(true).buildUrl();
        Assert.assertTrue(request.contains("excludePostBoxFlag=true"));
    }

}

Add test for building search requests


package ro.pub.cs.vmchecker.client.service.json;

import ro.pub.cs.vmchecker.client.model.AuthenticationResponse;
import ro.pub.cs.vmchecker.client.model.User;

import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONValue;

public class AuthenticationResponseDecoder implements JSONDecoder<AuthenticationResponse> {

	public static final String statusKey = "status";
	public static final String usernameKey = "username";
	public static final String useridKey = "userid";
	public static final String infoKey = "info";

	@Override
	public AuthenticationResponse decode(String text) throws Exception {
		JSONValue jsonValue = JSONParser.parse(text);
		JSONObject jsonObj = jsonValue.isObject();

		boolean status = jsonObj.get(statusKey).isBoolean().booleanValue();
		String info = jsonObj.get(infoKey).isString().stringValue();
		if (!status) {
			/*
			 * Authentication failed.
			 */
			return new AuthenticationResponse(status, null, info);
		}

		String username = jsonObj.get(usernameKey).isString().stringValue();
		String userid = jsonObj.get(useridKey).isString().stringValue();
		return new AuthenticationResponse(status, new User(userid, username), info);
	}

}

package ro.pub.cs.vmchecker.client.service.json;

import ro.pub.cs.vmchecker.client.model.AuthenticationResponse;
import ro.pub.cs.vmchecker.client.model.User;

import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONValue;

public class AuthenticationResponseDecoder implements JSONDecoder<AuthenticationResponse> {

	public static final String statusKey = "status";
	public static final String fullnameKey = "fullname";
	public static final String usernameKey = "username";
	public static final String infoKey = "info";

	@Override
	public AuthenticationResponse decode(String text) throws Exception {
		JSONValue jsonValue = JSONParser.parse(text);
		JSONObject jsonObj = jsonValue.isObject();

		boolean status = jsonObj.get(statusKey).isBoolean().booleanValue();
		String info = jsonObj.get(infoKey).isString().stringValue();
		if (!status) {
			/*
			 * Authentication failed.
			 */
			return new AuthenticationResponse(status, null, info);
		}

		String username = jsonObj.get(usernameKey).isString().stringValue();
		String fullname = jsonObj.get(fullnameKey).isString().stringValue();
		return new AuthenticationResponse(status, new User(username, fullname), info);
	}

}

Use new services.py reply format for login().