target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testExistsClass() throws IOException, CQLException { TextRuleList trl = new TextRuleList( TestDatasetsVector.arabicInHeader.getStyledFS(), false); trl.setEnabled(true); trl.addDefaultClass(); trl.addDefaultClass("de"); trl.addClass(StylingUtil.STYLE_BUILDER.createTextSymbolizer(), "testRuleName_DE", E... | public boolean existsClass(Filter filter, String lang) { for (int i = 0; i < countClasses(); i++) { if (getClassLang(i) == null && lang != null) continue; if (getClassLang(i) != null && !getClassLang(i).equals(lang)) continue; if (filter != null && getClassFilter(i).toString().equals(filter.toString())) return true; } ... | TextRuleList extends AbstractRulesList { public boolean existsClass(Filter filter, String lang) { for (int i = 0; i < countClasses(); i++) { if (getClassLang(i) == null && lang != null) continue; if (getClassLang(i) != null && !getClassLang(i).equals(lang)) continue; if (filter != null && getClassFilter(i).toString().e... | TextRuleList extends AbstractRulesList { public boolean existsClass(Filter filter, String lang) { for (int i = 0; i < countClasses(); i++) { if (getClassLang(i) == null && lang != null) continue; if (getClassLang(i) != null && !getClassLang(i).equals(lang)) continue; if (filter != null && getClassFilter(i).toString().e... | TextRuleList extends AbstractRulesList { public boolean existsClass(Filter filter, String lang) { for (int i = 0; i < countClasses(); i++) { if (getClassLang(i) == null && lang != null) continue; if (getClassLang(i) != null && !getClassLang(i).equals(lang)) continue; if (filter != null && getClassFilter(i).toString().e... | TextRuleList extends AbstractRulesList { public boolean existsClass(Filter filter, String lang) { for (int i = 0; i < countClasses(); i++) { if (getClassLang(i) == null && lang != null) continue; if (getClassLang(i) != null && !getClassLang(i).equals(lang)) continue; if (filter != null && getClassFilter(i).toString().e... |
@Test public void testColorMapImport1() { ColorMap cm = StylingUtil.STYLE_BUILDER.createColorMap(new String[] {"A","B","C"}, new double[] {1,2,3}, new Color[]{Color.red, Color.blue, Color.green}, ColorMap.TYPE_VALUES); RasterRulesList_DistinctValues rl = new RasterRulesList_DistinctValues(styledRaster); rl.importColorM... | @Override public void importColorMap(ColorMap cm) { QuantileBin1D ops = new QuantileBin1D(1.); for (ColorMapEntry cme : cm.getColorMapEntries()) { importValuesLabelsQuantitiesColors(cme); ops.add(getOpacities().get(getOpacities().size() - 1)); } if (ops.median() >= 0 && ops.median() < 1.) setOpacity(ops.median()); else... | RasterRulesList_DistinctValues extends RasterRulesListColormap implements UniqueValuesRulesListInterface<Double> { @Override public void importColorMap(ColorMap cm) { QuantileBin1D ops = new QuantileBin1D(1.); for (ColorMapEntry cme : cm.getColorMapEntries()) { importValuesLabelsQuantitiesColors(cme); ops.add(getOpacit... | RasterRulesList_DistinctValues extends RasterRulesListColormap implements UniqueValuesRulesListInterface<Double> { @Override public void importColorMap(ColorMap cm) { QuantileBin1D ops = new QuantileBin1D(1.); for (ColorMapEntry cme : cm.getColorMapEntries()) { importValuesLabelsQuantitiesColors(cme); ops.add(getOpacit... | RasterRulesList_DistinctValues extends RasterRulesListColormap implements UniqueValuesRulesListInterface<Double> { @Override public void importColorMap(ColorMap cm) { QuantileBin1D ops = new QuantileBin1D(1.); for (ColorMapEntry cme : cm.getColorMapEntries()) { importValuesLabelsQuantitiesColors(cme); ops.add(getOpacit... | RasterRulesList_DistinctValues extends RasterRulesListColormap implements UniqueValuesRulesListInterface<Double> { @Override public void importColorMap(ColorMap cm) { QuantileBin1D ops = new QuantileBin1D(1.); for (ColorMapEntry cme : cm.getColorMapEntries()) { importValuesLabelsQuantitiesColors(cme); ops.add(getOpacit... |
@Test public void testImportRules() { } | @Override public void importRules(List<Rule> rules) { pushQuite(); try { if (rules.size() > 1) { LOGGER.warn("Importing a " + this.getClass().getSimpleName() + " with " + rules.size() + " rules"); } Rule rule = rules.get(0); RasterSymbolizer rs = (RasterSymbolizer) rule.symbolizers().get(0); { ChannelSelection channelS... | RasterRulesListColormap extends RasterRulesList { @Override public void importRules(List<Rule> rules) { pushQuite(); try { if (rules.size() > 1) { LOGGER.warn("Importing a " + this.getClass().getSimpleName() + " with " + rules.size() + " rules"); } Rule rule = rules.get(0); RasterSymbolizer rs = (RasterSymbolizer) rule... | RasterRulesListColormap extends RasterRulesList { @Override public void importRules(List<Rule> rules) { pushQuite(); try { if (rules.size() > 1) { LOGGER.warn("Importing a " + this.getClass().getSimpleName() + " with " + rules.size() + " rules"); } Rule rule = rules.get(0); RasterSymbolizer rs = (RasterSymbolizer) rule... | RasterRulesListColormap extends RasterRulesList { @Override public void importRules(List<Rule> rules) { pushQuite(); try { if (rules.size() > 1) { LOGGER.warn("Importing a " + this.getClass().getSimpleName() + " with " + rules.size() + " rules"); } Rule rule = rules.get(0); RasterSymbolizer rs = (RasterSymbolizer) rule... | RasterRulesListColormap extends RasterRulesList { @Override public void importRules(List<Rule> rules) { pushQuite(); try { if (rules.size() > 1) { LOGGER.warn("Importing a " + this.getClass().getSimpleName() + " with " + rules.size() + " rules"); } Rule rule = rules.get(0); RasterSymbolizer rs = (RasterSymbolizer) rule... |
@Test public void testGetDefaultNoDataSymbol() { ASUtil.getDefaultNoDataSymbol(GeometryForm.LINE); ASUtil.getDefaultNoDataSymbol(GeometryForm.LINE, Color.green); ASUtil.getDefaultNoDataSymbol(GeometryForm.LINE, Color.green, Color.black); ASUtil.getDefaultNoDataSymbol(GeometryForm.POINT); ASUtil.getDefaultNoDataSymbol(G... | public static SingleRuleList getDefaultNoDataSymbol( final GeometryForm form, final Color... colors) { return getDefaultNoDataSymbol(form, 1., colors); } | ASUtil { public static SingleRuleList getDefaultNoDataSymbol( final GeometryForm form, final Color... colors) { return getDefaultNoDataSymbol(form, 1., colors); } } | ASUtil { public static SingleRuleList getDefaultNoDataSymbol( final GeometryForm form, final Color... colors) { return getDefaultNoDataSymbol(form, 1., colors); } } | ASUtil { public static SingleRuleList getDefaultNoDataSymbol( final GeometryForm form, final Color... colors) { return getDefaultNoDataSymbol(form, 1., colors); } static String askForString(final Component owner,
final String preset, final String question); static Fill createDefaultFill(); static Graphic createDefa... | ASUtil { public static SingleRuleList getDefaultNoDataSymbol( final GeometryForm form, final Color... colors) { return getDefaultNoDataSymbol(form, 1., colors); } static String askForString(final Component owner,
final String preset, final String question); static Fill createDefaultFill(); static Graphic createDefa... |
@Test public void testGetSymbolizerImage() throws Throwable { PolygonSymbolizer ps = StylingUtil.STYLE_BUILDER.createPolygonSymbolizer(); FeatureSource<SimpleFeatureType, SimpleFeature> pfs = GTTestingUtil.TestDatasetsVector.kreise.getFeatureSource(); BufferedImage symbolizerImage = ASUtil.getSymbolizerImage(ps, pfs.ge... | public static BufferedImage getSymbolizerImage(Symbolizer symb, final Dimension size, final SimpleFeatureType featureType) { if (ChartGraphic.isChart(symb)) symb = ChartGraphic.getFixDataSymbolizer(symb); Rule rule = StylingUtil.STYLE_FACTORY.createRule(); rule.symbolizers().add(symb); final BufferedImage image = new L... | ASUtil { public static BufferedImage getSymbolizerImage(Symbolizer symb, final Dimension size, final SimpleFeatureType featureType) { if (ChartGraphic.isChart(symb)) symb = ChartGraphic.getFixDataSymbolizer(symb); Rule rule = StylingUtil.STYLE_FACTORY.createRule(); rule.symbolizers().add(symb); final BufferedImage imag... | ASUtil { public static BufferedImage getSymbolizerImage(Symbolizer symb, final Dimension size, final SimpleFeatureType featureType) { if (ChartGraphic.isChart(symb)) symb = ChartGraphic.getFixDataSymbolizer(symb); Rule rule = StylingUtil.STYLE_FACTORY.createRule(); rule.symbolizers().add(symb); final BufferedImage imag... | ASUtil { public static BufferedImage getSymbolizerImage(Symbolizer symb, final Dimension size, final SimpleFeatureType featureType) { if (ChartGraphic.isChart(symb)) symb = ChartGraphic.getFixDataSymbolizer(symb); Rule rule = StylingUtil.STYLE_FACTORY.createRule(); rule.symbolizers().add(symb); final BufferedImage imag... | ASUtil { public static BufferedImage getSymbolizerImage(Symbolizer symb, final Dimension size, final SimpleFeatureType featureType) { if (ChartGraphic.isChart(symb)) symb = ChartGraphic.getFixDataSymbolizer(symb); Rule rule = StylingUtil.STYLE_FACTORY.createRule(); rule.symbolizers().add(symb); final BufferedImage imag... |
@Ignore @Test public void testsLoadWithGUI() throws Throwable { if (TestingUtil.HASGUI) { int performArgs = CliOptions.performArgs(new String[] { "-a " + testAtlas }); assertEquals(-1, performArgs); LangUtil.sleepExceptionless(5000); assertTrue(GeopublisherGUI.isInstanciated()); SwingUtilities.invokeAndWait(new Runnabl... | public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliOptions.parse(args); if (comma... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... |
@Test public void testExportFails() throws Throwable { assertEquals("No atlas, no export", Errors.EXPORTDIR_NOTEMPTYNOFORCE.getErrCode(), CliOptions.performArgs(new String[] { "-e /tmp" })); assertEquals( "Not empty directory should not allow export without -f", Errors.EXPORTDIR_NOTEMPTYNOFORCE.getErrCode(), CliOptions... | public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliOptions.parse(args); if (comma... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... |
@Test @Ignore public void testExportWithForce() throws Throwable { File expDir = GpTestingUtil.createAtlasExportTesttDir(); new File(expDir, "sometestfile").createNewFile(); assertEquals( Errors.EXPORTDIR_NOTEMPTYNOFORCE.getErrCode(), CliOptions.performArgs(new String[] { "-e", expDir.toString(), "--atlas", testAtlas.t... | public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliOptions.parse(args); if (comma... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... |
@Test @Ignore public void testExport() throws Throwable { File expDir = GpTestingUtil.createAtlasExportTesttDir(); assertEquals( 0, CliOptions.performArgs(new String[] { "-e", expDir.toString(), "--atlas", testAtlas.toString() })); assertTrue(ArrayUtils.contains(expDir.list(), JarExportUtil.DISK)); assertTrue(ArrayUtil... | public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliOptions.parse(args); if (comma... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... |
@Test @Ignore public void testExportDISKonlyZipped() throws Throwable { File expDir = GpTestingUtil.createAtlasExportTesttDir(); assertEquals(0, CliOptions.performArgs(new String[] { "--" + CliOptions.ZIPDISK, "-e", expDir.toString(), "-d", "--atlas", testAtlas.toString() })); AtlasConfigEditable ace = TestAtlas.small.... | public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliOptions.parse(args); if (comma... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... | CliOptions extends Options { public static int performArgs(final String[] args) { boolean exitAfterInterpret = false; CliOptions.Errors errorDuringInterpret = null; boolean startGui = false; File awcFile = null; File exportFile = null; CliOptions cliOptions = new CliOptions(); try { final CommandLine commandLine = cliO... |
@Test public void testToString() throws Exception { Assert.assertEquals("True", _converter.toString(true)); Assert.assertEquals("False", _converter.toString(false)); } | @Override public String toString(Boolean object, ConverterContext context) { if (Boolean.FALSE.equals(object)) { return getFalse(); } else if (Boolean.TRUE.equals(object)) { return getTrue(); } else { return getNull(); } } | BooleanConverter extends DefaultObjectConverter<Boolean> { @Override public String toString(Boolean object, ConverterContext context) { if (Boolean.FALSE.equals(object)) { return getFalse(); } else if (Boolean.TRUE.equals(object)) { return getTrue(); } else { return getNull(); } } } | BooleanConverter extends DefaultObjectConverter<Boolean> { @Override public String toString(Boolean object, ConverterContext context) { if (Boolean.FALSE.equals(object)) { return getFalse(); } else if (Boolean.TRUE.equals(object)) { return getTrue(); } else { return getNull(); } } BooleanConverter(); } | BooleanConverter extends DefaultObjectConverter<Boolean> { @Override public String toString(Boolean object, ConverterContext context) { if (Boolean.FALSE.equals(object)) { return getFalse(); } else if (Boolean.TRUE.equals(object)) { return getTrue(); } else { return getNull(); } } BooleanConverter(); @Override String t... | BooleanConverter extends DefaultObjectConverter<Boolean> { @Override public String toString(Boolean object, ConverterContext context) { if (Boolean.FALSE.equals(object)) { return getFalse(); } else if (Boolean.TRUE.equals(object)) { return getTrue(); } else { return getNull(); } } BooleanConverter(); @Override String t... |
@Test public void testFromString() throws Exception { Assert.assertEquals(Boolean.TRUE, _converter.fromString("true")); Assert.assertEquals(Boolean.TRUE, _converter.fromString("True")); Assert.assertEquals(Boolean.FALSE, _converter.fromString("false")); Assert.assertEquals(Boolean.FALSE, _converter.fromString("False"))... | @Override public Boolean fromString(String string, ConverterContext context) { if (string.equalsIgnoreCase(getTrue())) { return Boolean.TRUE; } else if (string.equalsIgnoreCase("true")) { return Boolean.TRUE; } else if (string.equalsIgnoreCase(getFalse())) { return Boolean.FALSE; } else if (string.equalsIgnoreCase("fal... | BooleanConverter extends DefaultObjectConverter<Boolean> { @Override public Boolean fromString(String string, ConverterContext context) { if (string.equalsIgnoreCase(getTrue())) { return Boolean.TRUE; } else if (string.equalsIgnoreCase("true")) { return Boolean.TRUE; } else if (string.equalsIgnoreCase(getFalse())) { re... | BooleanConverter extends DefaultObjectConverter<Boolean> { @Override public Boolean fromString(String string, ConverterContext context) { if (string.equalsIgnoreCase(getTrue())) { return Boolean.TRUE; } else if (string.equalsIgnoreCase("true")) { return Boolean.TRUE; } else if (string.equalsIgnoreCase(getFalse())) { re... | BooleanConverter extends DefaultObjectConverter<Boolean> { @Override public Boolean fromString(String string, ConverterContext context) { if (string.equalsIgnoreCase(getTrue())) { return Boolean.TRUE; } else if (string.equalsIgnoreCase("true")) { return Boolean.TRUE; } else if (string.equalsIgnoreCase(getFalse())) { re... | BooleanConverter extends DefaultObjectConverter<Boolean> { @Override public Boolean fromString(String string, ConverterContext context) { if (string.equalsIgnoreCase(getTrue())) { return Boolean.TRUE; } else if (string.equalsIgnoreCase("true")) { return Boolean.TRUE; } else if (string.equalsIgnoreCase(getFalse())) { re... |
@Test public void testFromString() throws Exception { Assert.assertEquals(LocalDate.of(2000, 1, 1), _converter.fromString("Jan 1, 2000")); Assert.assertEquals(LocalDate.of(2000, 1, 1), _converter.fromString("1/1/00")); Assert.assertEquals(LocalDate.of(2003, 1, 2), _converter.fromString("01/02/03")); Assert.assertEquals... | synchronized public LocalDate fromString(String string, String pattern) { return LocalDate.from(DateTimeFormatter.ofPattern(pattern).parse(string)); } | LocalDateConverter extends TemporalAccessConverter<LocalDate> { synchronized public LocalDate fromString(String string, String pattern) { return LocalDate.from(DateTimeFormatter.ofPattern(pattern).parse(string)); } } | LocalDateConverter extends TemporalAccessConverter<LocalDate> { synchronized public LocalDate fromString(String string, String pattern) { return LocalDate.from(DateTimeFormatter.ofPattern(pattern).parse(string)); } LocalDateConverter(); } | LocalDateConverter extends TemporalAccessConverter<LocalDate> { synchronized public LocalDate fromString(String string, String pattern) { return LocalDate.from(DateTimeFormatter.ofPattern(pattern).parse(string)); } LocalDateConverter(); synchronized LocalDate fromString(String string, String pattern); @Override synchro... | LocalDateConverter extends TemporalAccessConverter<LocalDate> { synchronized public LocalDate fromString(String string, String pattern) { return LocalDate.from(DateTimeFormatter.ofPattern(pattern).parse(string)); } LocalDateConverter(); synchronized LocalDate fromString(String string, String pattern); @Override synchro... |
@Test public void testFromString() throws Exception { Assert.assertEquals(0.5, _converter.fromString("50%"), 0.001); Assert.assertEquals(0.5, _converter.fromString("50"), 0.001); Assert.assertEquals(0.005, _converter.fromString("0.5"), 0.001); } | @Override public Double fromString(String string, ConverterContext context) { Number number = numberFromString(string, context); if (number == null) { number = Double.parseDouble(string); } if (string != null && !string.trim().endsWith("%") && number != null) { number = number.doubleValue() / 100; } return number != nu... | PercentConverter extends DoubleConverter { @Override public Double fromString(String string, ConverterContext context) { Number number = numberFromString(string, context); if (number == null) { number = Double.parseDouble(string); } if (string != null && !string.trim().endsWith("%") && number != null) { number = number... | PercentConverter extends DoubleConverter { @Override public Double fromString(String string, ConverterContext context) { Number number = numberFromString(string, context); if (number == null) { number = Double.parseDouble(string); } if (string != null && !string.trim().endsWith("%") && number != null) { number = number... | PercentConverter extends DoubleConverter { @Override public Double fromString(String string, ConverterContext context) { Number number = numberFromString(string, context); if (number == null) { number = Double.parseDouble(string); } if (string != null && !string.trim().endsWith("%") && number != null) { number = number... | PercentConverter extends DoubleConverter { @Override public Double fromString(String string, ConverterContext context) { Number number = numberFromString(string, context); if (number == null) { number = Double.parseDouble(string); } if (string != null && !string.trim().endsWith("%") && number != null) { number = number... |
@Test public void loadFXMLWithExplicitContent() throws Exception { URL resource = DecorationPaneTest.class.getClassLoader().getResource("jidefx/scene/control/decoration/DecorationPaneTestExplicitContent.fxml"); FXMLLoader loader = new FXMLLoader(resource); loader.load(); DecorationPaneTestController controller = loader... | public Parent getContent() { return _content; } | DecorationPane extends StackPane implements DecorationSupport { public Parent getContent() { return _content; } } | DecorationPane extends StackPane implements DecorationSupport { public Parent getContent() { return _content; } DecorationPane(); DecorationPane(Parent content); } | DecorationPane extends StackPane implements DecorationSupport { public Parent getContent() { return _content; } DecorationPane(); DecorationPane(Parent content); Parent getContent(); void setContent(Parent content); @Override void positionInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeig... | DecorationPane extends StackPane implements DecorationSupport { public Parent getContent() { return _content; } DecorationPane(); DecorationPane(Parent content); Parent getContent(); void setContent(Parent content); @Override void positionInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeig... |
@Test public void loadFXMLWithImplicitContent() throws Exception { URL resource = DecorationPaneTest.class.getClassLoader().getResource("jidefx/scene/control/decoration/DecorationPaneTestImplicitContent.fxml"); FXMLLoader loader = new FXMLLoader(resource); loader.load(); DecorationPaneTestController controller = loader... | public Parent getContent() { return _content; } | DecorationPane extends StackPane implements DecorationSupport { public Parent getContent() { return _content; } } | DecorationPane extends StackPane implements DecorationSupport { public Parent getContent() { return _content; } DecorationPane(); DecorationPane(Parent content); } | DecorationPane extends StackPane implements DecorationSupport { public Parent getContent() { return _content; } DecorationPane(); DecorationPane(Parent content); Parent getContent(); void setContent(Parent content); @Override void positionInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeig... | DecorationPane extends StackPane implements DecorationSupport { public Parent getContent() { return _content; } DecorationPane(); DecorationPane(Parent content); Parent getContent(); void setContent(Parent content); @Override void positionInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeig... |
@Test public void givenHelloWorldWhenSetInvalidPhraseThenThrowException() { try { helloWorld.setPhrase( null ); fail( "Should not be allowed to set phrase to null" ); } catch( IllegalArgumentException e ) { } } | public void setPhrase( String phrase ) throws IllegalArgumentException { if( phrase == null ) { throw new IllegalArgumentException( "Phrase may not be null " ); } this.phrase = phrase; } | HelloWorld { public void setPhrase( String phrase ) throws IllegalArgumentException { if( phrase == null ) { throw new IllegalArgumentException( "Phrase may not be null " ); } this.phrase = phrase; } } | HelloWorld { public void setPhrase( String phrase ) throws IllegalArgumentException { if( phrase == null ) { throw new IllegalArgumentException( "Phrase may not be null " ); } this.phrase = phrase; } } | HelloWorld { public void setPhrase( String phrase ) throws IllegalArgumentException { if( phrase == null ) { throw new IllegalArgumentException( "Phrase may not be null " ); } this.phrase = phrase; } String getPhrase(); void setPhrase( String phrase ); String getName(); void setName( String name ); String say(); } | HelloWorld { public void setPhrase( String phrase ) throws IllegalArgumentException { if( phrase == null ) { throw new IllegalArgumentException( "Phrase may not be null " ); } this.phrase = phrase; } String getPhrase(); void setPhrase( String phrase ); String getName(); void setName( String name ); String say(); } |
@Test public void givenWhereQueryWhenWhereClauseLimitsToRangeExpectLimitedResult() { final QueryBuilder<TestComposite> qb = queryBuilderFactory.newQueryBuilder( TestComposite.class ); TestComposite template = templateFor( TestComposite.class ); Query<TestComposite> query = qb.where( and( ge( template.b(), 3 ), lt( temp... | @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); return new QueryBuilderImpl<>( serviceReference.get(), re... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... |
@Test public void whenAskingForDependencyGivenThatGraphContainsCyclicDepThenDetectTheError() throws Exception { Thing thing1 = new Thing(); Thing thing2 = new Thing(); Thing thing3 = new Thing(); Thing thing4 = new Thing(); Thing thing5 = new Thing(); Thing thing6 = new Thing(); Thing thing7 = new Thing(); thing1.uses.... | public List<K> resolveOrder() throws BindingException { if( resolved == null ) { buildUsageGraph(); resolved = new LinkedList<>(); for( K item : data ) { int pos = resolved.size(); for( K entry : resolved ) { if( transitiveUse( entry, item ) ) { pos = resolved.indexOf( entry ); break; } } resolved.add( pos, item ); } }... | UsageGraph { public List<K> resolveOrder() throws BindingException { if( resolved == null ) { buildUsageGraph(); resolved = new LinkedList<>(); for( K item : data ) { int pos = resolved.size(); for( K entry : resolved ) { if( transitiveUse( entry, item ) ) { pos = resolved.indexOf( entry ); break; } } resolved.add( pos... | UsageGraph { public List<K> resolveOrder() throws BindingException { if( resolved == null ) { buildUsageGraph(); resolved = new LinkedList<>(); for( K item : data ) { int pos = resolved.size(); for( K entry : resolved ) { if( transitiveUse( entry, item ) ) { pos = resolved.indexOf( entry ); break; } } resolved.add( pos... | UsageGraph { public List<K> resolveOrder() throws BindingException { if( resolved == null ) { buildUsageGraph(); resolved = new LinkedList<>(); for( K item : data ) { int pos = resolved.size(); for( K entry : resolved ) { if( transitiveUse( entry, item ) ) { pos = resolved.indexOf( entry ); break; } } resolved.add( pos... | UsageGraph { public List<K> resolveOrder() throws BindingException { if( resolved == null ) { buildUsageGraph(); resolved = new LinkedList<>(); for( K item : data ) { int pos = resolved.size(); for( K entry : resolved ) { if( transitiveUse( entry, item ) ) { pos = resolved.indexOf( entry ); break; } } resolved.add( pos... |
@Test public void whenAskingForResolveOrderGivenThatGraphContainsCyclicDepThenDetectTheError() throws Exception { Thing thing1 = new Thing(); Thing thing2 = new Thing(); Thing thing3 = new Thing(); Thing thing4 = new Thing(); Thing thing5 = new Thing(); Thing thing6 = new Thing(); Thing thing7 = new Thing(); thing1.use... | public boolean transitiveUse( K source, K other ) throws BindingException { if( transitive == null ) { buildUsageGraph(); } return transitive.containsKey( source ) && transitive.get( source ).contains( other ); } | UsageGraph { public boolean transitiveUse( K source, K other ) throws BindingException { if( transitive == null ) { buildUsageGraph(); } return transitive.containsKey( source ) && transitive.get( source ).contains( other ); } } | UsageGraph { public boolean transitiveUse( K source, K other ) throws BindingException { if( transitive == null ) { buildUsageGraph(); } return transitive.containsKey( source ) && transitive.get( source ).contains( other ); } UsageGraph( Collection<K> data, Use<K> use, boolean allowCyclic ); } | UsageGraph { public boolean transitiveUse( K source, K other ) throws BindingException { if( transitive == null ) { buildUsageGraph(); } return transitive.containsKey( source ) && transitive.get( source ).contains( other ); } UsageGraph( Collection<K> data, Use<K> use, boolean allowCyclic ); boolean transitiveUse( K so... | UsageGraph { public boolean transitiveUse( K source, K other ) throws BindingException { if( transitive == null ) { buildUsageGraph(); } return transitive.containsKey( source ) && transitive.get( source ).contains( other ); } UsageGraph( Collection<K> data, Use<K> use, boolean allowCyclic ); boolean transitiveUse( K so... |
@Test public void testTemplate() { new TestBuilder( "Rickard" ).newInstance( module ); } | public T newInstance( ModuleDescriptor module ) { ValueBuilder<T> builder = module.instance().newValueBuilder( type ); build( builder.prototype() ); return builder.newInstance(); } | ValueBuilderTemplate { public T newInstance( ModuleDescriptor module ) { ValueBuilder<T> builder = module.instance().newValueBuilder( type ); build( builder.prototype() ); return builder.newInstance(); } } | ValueBuilderTemplate { public T newInstance( ModuleDescriptor module ) { ValueBuilder<T> builder = module.instance().newValueBuilder( type ); build( builder.prototype() ); return builder.newInstance(); } protected ValueBuilderTemplate( Class<T> type ); } | ValueBuilderTemplate { public T newInstance( ModuleDescriptor module ) { ValueBuilder<T> builder = module.instance().newValueBuilder( type ); build( builder.prototype() ); return builder.newInstance(); } protected ValueBuilderTemplate( Class<T> type ); T newInstance( ModuleDescriptor module ); } | ValueBuilderTemplate { public T newInstance( ModuleDescriptor module ) { ValueBuilder<T> builder = module.instance().newValueBuilder( type ); build( builder.prototype() ); return builder.newInstance(); } protected ValueBuilderTemplate( Class<T> type ); T newInstance( ModuleDescriptor module ); } |
@Test public void testAnonymousTemplate() { new ValueBuilderTemplate<TestValue>( TestValue.class ) { @Override protected void build( TestValue prototype ) { prototype.name().set( "Rickard" ); } }.newInstance( module ); } | public T newInstance( ModuleDescriptor module ) { ValueBuilder<T> builder = module.instance().newValueBuilder( type ); build( builder.prototype() ); return builder.newInstance(); } | ValueBuilderTemplate { public T newInstance( ModuleDescriptor module ) { ValueBuilder<T> builder = module.instance().newValueBuilder( type ); build( builder.prototype() ); return builder.newInstance(); } } | ValueBuilderTemplate { public T newInstance( ModuleDescriptor module ) { ValueBuilder<T> builder = module.instance().newValueBuilder( type ); build( builder.prototype() ); return builder.newInstance(); } protected ValueBuilderTemplate( Class<T> type ); } | ValueBuilderTemplate { public T newInstance( ModuleDescriptor module ) { ValueBuilder<T> builder = module.instance().newValueBuilder( type ); build( builder.prototype() ); return builder.newInstance(); } protected ValueBuilderTemplate( Class<T> type ); T newInstance( ModuleDescriptor module ); } | ValueBuilderTemplate { public T newInstance( ModuleDescriptor module ) { ValueBuilder<T> builder = module.instance().newValueBuilder( type ); build( builder.prototype() ); return builder.newInstance(); } protected ValueBuilderTemplate( Class<T> type ); T newInstance( ModuleDescriptor module ); } |
@Test public void givenClassWithInterfacesWhenInterfacesOfThenGetCorrectSet() { assertThat( "one interface returned", interfacesOf( A.class ).count(), equalTo( 1L ) ); assertThat( "two interface returned", interfacesOf( B.class ).count(), equalTo( 2L ) ); assertThat( "tree interface returned", interfacesOf( C.class ).c... | public static Stream<? extends Type> interfacesOf( Stream<? extends Type> types ) { return types.flatMap( INTERFACES_OF ); } | Classes { public static Stream<? extends Type> interfacesOf( Stream<? extends Type> types ) { return types.flatMap( INTERFACES_OF ); } } | Classes { public static Stream<? extends Type> interfacesOf( Stream<? extends Type> types ) { return types.flatMap( INTERFACES_OF ); } private Classes(); } | Classes { public static Stream<? extends Type> interfacesOf( Stream<? extends Type> types ) { return types.flatMap( INTERFACES_OF ); } private Classes(); static Type typeOf( AccessibleObject from ); static Stream<Type> typesOf( Stream<? extends Type> types ); static Stream<? extends Type> typesOf( Type type ); static ... | Classes { public static Stream<? extends Type> interfacesOf( Stream<? extends Type> types ) { return types.flatMap( INTERFACES_OF ); } private Classes(); static Type typeOf( AccessibleObject from ); static Stream<Type> typesOf( Stream<? extends Type> types ); static Stream<? extends Type> typesOf( Type type ); static ... |
@Test public void givenClassWithInterfacesWhenGetInterfacesWithMethodsThenGetCorrectSet() { HashSet<Class<?>> interfaces = new HashSet<Class<?>>(); interfaces.add( B.class ); Set<Class<?>> types = interfacesWithMethods( interfaces ); assertThat( "one interface returned", types.size(), equalTo( 1 ) ); assertThat( "corre... | @SuppressWarnings( "raw" ) public static Set<Class<?>> interfacesWithMethods( Set<Class<?>> interfaces ) { Set<Class<?>> newSet = new LinkedHashSet<>(); for( Class type : interfaces ) { if( type.isInterface() && type.getDeclaredMethods().length > 0 ) { newSet.add( type ); } } return newSet; } | Classes { @SuppressWarnings( "raw" ) public static Set<Class<?>> interfacesWithMethods( Set<Class<?>> interfaces ) { Set<Class<?>> newSet = new LinkedHashSet<>(); for( Class type : interfaces ) { if( type.isInterface() && type.getDeclaredMethods().length > 0 ) { newSet.add( type ); } } return newSet; } } | Classes { @SuppressWarnings( "raw" ) public static Set<Class<?>> interfacesWithMethods( Set<Class<?>> interfaces ) { Set<Class<?>> newSet = new LinkedHashSet<>(); for( Class type : interfaces ) { if( type.isInterface() && type.getDeclaredMethods().length > 0 ) { newSet.add( type ); } } return newSet; } private Classes... | Classes { @SuppressWarnings( "raw" ) public static Set<Class<?>> interfacesWithMethods( Set<Class<?>> interfaces ) { Set<Class<?>> newSet = new LinkedHashSet<>(); for( Class type : interfaces ) { if( type.isInterface() && type.getDeclaredMethods().length > 0 ) { newSet.add( type ); } } return newSet; } private Classes... | Classes { @SuppressWarnings( "raw" ) public static Set<Class<?>> interfacesWithMethods( Set<Class<?>> interfaces ) { Set<Class<?>> newSet = new LinkedHashSet<>(); for( Class type : interfaces ) { if( type.isInterface() && type.getDeclaredMethods().length > 0 ) { newSet.add( type ); } } return newSet; } private Classes... |
@Test public void givenClassesWithInterfacesWhenGetInterfacesWithMethodsThenGetCorrectSet() { assertThat( "one interface returned", interfacesOf( C.class ).filter( Methods.HAS_METHODS ) .count(), equalTo( 1L ) ); boolean isIn = interfacesOf( C.class ).filter( Methods.HAS_METHODS ) .anyMatch( B.class::equals ); assertTh... | public static Stream<? extends Type> interfacesOf( Stream<? extends Type> types ) { return types.flatMap( INTERFACES_OF ); } | Classes { public static Stream<? extends Type> interfacesOf( Stream<? extends Type> types ) { return types.flatMap( INTERFACES_OF ); } } | Classes { public static Stream<? extends Type> interfacesOf( Stream<? extends Type> types ) { return types.flatMap( INTERFACES_OF ); } private Classes(); } | Classes { public static Stream<? extends Type> interfacesOf( Stream<? extends Type> types ) { return types.flatMap( INTERFACES_OF ); } private Classes(); static Type typeOf( AccessibleObject from ); static Stream<Type> typesOf( Stream<? extends Type> types ); static Stream<? extends Type> typesOf( Type type ); static ... | Classes { public static Stream<? extends Type> interfacesOf( Stream<? extends Type> types ) { return types.flatMap( INTERFACES_OF ); } private Classes(); static Type typeOf( AccessibleObject from ); static Stream<Type> typesOf( Stream<? extends Type> types ); static Stream<? extends Type> typesOf( Type type ); static ... |
@Test public void givenClassNameWhenToUriThenUriIsReturned() { assertThat( "URI is correct", Classes.toURI( A.class ), equalTo( "urn:polygene:type:org.apache.polygene.api.util.ClassesTest-A" ) ); } | @SuppressWarnings( "raw" ) public static String toURI( final Class clazz ) throws NullPointerException { return toURI( clazz.getName() ); } | Classes { @SuppressWarnings( "raw" ) public static String toURI( final Class clazz ) throws NullPointerException { return toURI( clazz.getName() ); } } | Classes { @SuppressWarnings( "raw" ) public static String toURI( final Class clazz ) throws NullPointerException { return toURI( clazz.getName() ); } private Classes(); } | Classes { @SuppressWarnings( "raw" ) public static String toURI( final Class clazz ) throws NullPointerException { return toURI( clazz.getName() ); } private Classes(); static Type typeOf( AccessibleObject from ); static Stream<Type> typesOf( Stream<? extends Type> types ); static Stream<? extends Type> typesOf( Type ... | Classes { @SuppressWarnings( "raw" ) public static String toURI( final Class clazz ) throws NullPointerException { return toURI( clazz.getName() ); } private Classes(); static Type typeOf( AccessibleObject from ); static Stream<Type> typesOf( Stream<? extends Type> types ); static Stream<? extends Type> typesOf( Type ... |
@Test public void givenUriWhenToClassNameThenClassNameIsReturned() { assertThat( "Class name is correct", Classes.toClassName( "urn:polygene:type:org.apache.polygene.api.util.ClassesTest-A" ), equalTo( "org.apache.polygene.api.util.ClassesTest$A" ) ); } | public static String toClassName( String uri ) throws NullPointerException { uri = uri.substring( "urn:polygene:type:".length() ); uri = denormalizeURIToClass( uri ); return uri; } | Classes { public static String toClassName( String uri ) throws NullPointerException { uri = uri.substring( "urn:polygene:type:".length() ); uri = denormalizeURIToClass( uri ); return uri; } } | Classes { public static String toClassName( String uri ) throws NullPointerException { uri = uri.substring( "urn:polygene:type:".length() ); uri = denormalizeURIToClass( uri ); return uri; } private Classes(); } | Classes { public static String toClassName( String uri ) throws NullPointerException { uri = uri.substring( "urn:polygene:type:".length() ); uri = denormalizeURIToClass( uri ); return uri; } private Classes(); static Type typeOf( AccessibleObject from ); static Stream<Type> typesOf( Stream<? extends Type> types ); sta... | Classes { public static String toClassName( String uri ) throws NullPointerException { uri = uri.substring( "urn:polygene:type:".length() ); uri = denormalizeURIToClass( uri ); return uri; } private Classes(); static Type typeOf( AccessibleObject from ); static Stream<Type> typesOf( Stream<? extends Type> types ); sta... |
@Test public void givenHelloWorldWhenSetInvalidNameThenThrowException() { try { helloWorld.setName( null ); fail( "Should not be allowed to set name to null" ); } catch( IllegalArgumentException e ) { } } | public void setName( String name ) throws IllegalArgumentException { if( name == null ) { throw new IllegalArgumentException( "Name may not be null " ); } this.name = name; } | HelloWorld { public void setName( String name ) throws IllegalArgumentException { if( name == null ) { throw new IllegalArgumentException( "Name may not be null " ); } this.name = name; } } | HelloWorld { public void setName( String name ) throws IllegalArgumentException { if( name == null ) { throw new IllegalArgumentException( "Name may not be null " ); } this.name = name; } } | HelloWorld { public void setName( String name ) throws IllegalArgumentException { if( name == null ) { throw new IllegalArgumentException( "Name may not be null " ); } this.name = name; } String getPhrase(); void setPhrase( String phrase ); String getName(); void setName( String name ); String say(); } | HelloWorld { public void setName( String name ) throws IllegalArgumentException { if( name == null ) { throw new IllegalArgumentException( "Name may not be null " ); } this.name = name; } String getPhrase(); void setPhrase( String phrase ); String getName(); void setName( String name ); String say(); } |
@Test public void givenTypeVariableWhenResolveThenResolved() { for( Method method : Type1.class.getMethods() ) { Type type = method.getGenericReturnType(); TypeVariable typeVariable = (TypeVariable) type; Type resolvedType = Classes.resolveTypeVariable( typeVariable, method.getDeclaringClass(), Type1.class ); System.ou... | @SuppressWarnings( "raw" ) public static Type resolveTypeVariable( TypeVariable name, Class declaringClass, Class topClass ) { Type type = resolveTypeVariable( name, declaringClass, new HashMap<>(), topClass ); if( type == null ) { type = Object.class; } return type; } | Classes { @SuppressWarnings( "raw" ) public static Type resolveTypeVariable( TypeVariable name, Class declaringClass, Class topClass ) { Type type = resolveTypeVariable( name, declaringClass, new HashMap<>(), topClass ); if( type == null ) { type = Object.class; } return type; } } | Classes { @SuppressWarnings( "raw" ) public static Type resolveTypeVariable( TypeVariable name, Class declaringClass, Class topClass ) { Type type = resolveTypeVariable( name, declaringClass, new HashMap<>(), topClass ); if( type == null ) { type = Object.class; } return type; } private Classes(); } | Classes { @SuppressWarnings( "raw" ) public static Type resolveTypeVariable( TypeVariable name, Class declaringClass, Class topClass ) { Type type = resolveTypeVariable( name, declaringClass, new HashMap<>(), topClass ); if( type == null ) { type = Object.class; } return type; } private Classes(); static Type typeOf( ... | Classes { @SuppressWarnings( "raw" ) public static Type resolveTypeVariable( TypeVariable name, Class declaringClass, Class topClass ) { Type type = resolveTypeVariable( name, declaringClass, new HashMap<>(), topClass ); if( type == null ) { type = Object.class; } return type; } private Classes(); static Type typeOf( ... |
@Test public void givenGenericTypeWhenGetSimpleGenericNameThenCorrectStringIsReturned() throws NoSuchMethodException { assertThat( "Simple Generic Name is 'A'", Classes.simpleGenericNameOf( A.class ), equalTo( "A" ) ); assertThat( "Simple Generic Name is 'B'", Classes.simpleGenericNameOf( B.class ), equalTo( "B" ) ); a... | public static String simpleGenericNameOf( Type type ) { StringBuilder sb = new StringBuilder(); simpleGenericNameOf( sb, type ); return sb.toString(); } | Classes { public static String simpleGenericNameOf( Type type ) { StringBuilder sb = new StringBuilder(); simpleGenericNameOf( sb, type ); return sb.toString(); } } | Classes { public static String simpleGenericNameOf( Type type ) { StringBuilder sb = new StringBuilder(); simpleGenericNameOf( sb, type ); return sb.toString(); } private Classes(); } | Classes { public static String simpleGenericNameOf( Type type ) { StringBuilder sb = new StringBuilder(); simpleGenericNameOf( sb, type ); return sb.toString(); } private Classes(); static Type typeOf( AccessibleObject from ); static Stream<Type> typesOf( Stream<? extends Type> types ); static Stream<? extends Type> t... | Classes { public static String simpleGenericNameOf( Type type ) { StringBuilder sb = new StringBuilder(); simpleGenericNameOf( sb, type ); return sb.toString(); } private Classes(); static Type typeOf( AccessibleObject from ); static Stream<Type> typesOf( Stream<? extends Type> types ); static Stream<? extends Type> t... |
@Test public void single() { assertThat( Stream.of( 1L ).collect( Collectors.single() ), is( 1L ) ); try { Stream.of().collect( Collectors.single() ); fail( "Should have failed" ); } catch( IllegalArgumentException ex ) {} try { Stream.of( 1, 1 ).collect( Collectors.single() ); fail( "Should have failed" ); } catch( Il... | public static <T> Collector<T, ?, T> single() throws IllegalArgumentException { Supplier<T> thrower = () -> { throw new IllegalArgumentException( "No or more than one element in stream" ); }; return java.util.stream.Collectors.collectingAndThen( java.util.stream.Collectors.reducing( ( a, b ) -> null ), optional -> opti... | Collectors { public static <T> Collector<T, ?, T> single() throws IllegalArgumentException { Supplier<T> thrower = () -> { throw new IllegalArgumentException( "No or more than one element in stream" ); }; return java.util.stream.Collectors.collectingAndThen( java.util.stream.Collectors.reducing( ( a, b ) -> null ), opt... | Collectors { public static <T> Collector<T, ?, T> single() throws IllegalArgumentException { Supplier<T> thrower = () -> { throw new IllegalArgumentException( "No or more than one element in stream" ); }; return java.util.stream.Collectors.collectingAndThen( java.util.stream.Collectors.reducing( ( a, b ) -> null ), opt... | Collectors { public static <T> Collector<T, ?, T> single() throws IllegalArgumentException { Supplier<T> thrower = () -> { throw new IllegalArgumentException( "No or more than one element in stream" ); }; return java.util.stream.Collectors.collectingAndThen( java.util.stream.Collectors.reducing( ( a, b ) -> null ), opt... | Collectors { public static <T> Collector<T, ?, T> single() throws IllegalArgumentException { Supplier<T> thrower = () -> { throw new IllegalArgumentException( "No or more than one element in stream" ); }; return java.util.stream.Collectors.collectingAndThen( java.util.stream.Collectors.reducing( ( a, b ) -> null ), opt... |
@Test public void singleOrEmpty() { assertThat( Stream.of().collect( Collectors.singleOrEmpty() ), equalTo( Optional.empty() ) ); assertThat( Stream.of( 1 ).collect( Collectors.singleOrEmpty() ), equalTo( Optional.of( 1 ) ) ); try { Stream.of( 1, 1 ).collect( Collectors.singleOrEmpty() ); fail( "Should have failed" ); ... | public static <T> Collector<T, ?, Optional<T>> singleOrEmpty() { return java.util.stream.Collectors.reducing( ( left, right ) -> { if( left != null && right != null ) { throw new IllegalArgumentException( "More than one element in stream" ); } if( left != null ) { return left; } return right; } ); } | Collectors { public static <T> Collector<T, ?, Optional<T>> singleOrEmpty() { return java.util.stream.Collectors.reducing( ( left, right ) -> { if( left != null && right != null ) { throw new IllegalArgumentException( "More than one element in stream" ); } if( left != null ) { return left; } return right; } ); } } | Collectors { public static <T> Collector<T, ?, Optional<T>> singleOrEmpty() { return java.util.stream.Collectors.reducing( ( left, right ) -> { if( left != null && right != null ) { throw new IllegalArgumentException( "More than one element in stream" ); } if( left != null ) { return left; } return right; } ); } privat... | Collectors { public static <T> Collector<T, ?, Optional<T>> singleOrEmpty() { return java.util.stream.Collectors.reducing( ( left, right ) -> { if( left != null && right != null ) { throw new IllegalArgumentException( "More than one element in stream" ); } if( left != null ) { return left; } return right; } ); } privat... | Collectors { public static <T> Collector<T, ?, Optional<T>> singleOrEmpty() { return java.util.stream.Collectors.reducing( ( left, right ) -> { if( left != null && right != null ) { throw new IllegalArgumentException( "More than one element in stream" ); } if( left != null ) { return left; } return right; } ); } privat... |
@Test public void toMap() { Map<String, String> input = new LinkedHashMap<>(); input.put( "foo", "bar" ); input.put( "bazar", "cathedral" ); Map<String, String> output = input.entrySet().stream().collect( Collectors.toMap() ); assertThat( output.get( "foo" ), equalTo( "bar" ) ); assertThat( output.get( "bazar" ), equal... | public static <T extends Map.Entry<K, U>, K, U> Collector<T, ?, Map<K, U>> toMap() { return toMap( Map.Entry::getKey, Map.Entry::getValue, HashMap::new ); } | Collectors { public static <T extends Map.Entry<K, U>, K, U> Collector<T, ?, Map<K, U>> toMap() { return toMap( Map.Entry::getKey, Map.Entry::getValue, HashMap::new ); } } | Collectors { public static <T extends Map.Entry<K, U>, K, U> Collector<T, ?, Map<K, U>> toMap() { return toMap( Map.Entry::getKey, Map.Entry::getValue, HashMap::new ); } private Collectors(); } | Collectors { public static <T extends Map.Entry<K, U>, K, U> Collector<T, ?, Map<K, U>> toMap() { return toMap( Map.Entry::getKey, Map.Entry::getValue, HashMap::new ); } private Collectors(); static Collector<T, ?, T> single(); static Collector<T, ?, Optional<T>> singleOrEmpty(); static Collector<T, ?, Map<K, U>> toMa... | Collectors { public static <T extends Map.Entry<K, U>, K, U> Collector<T, ?, Map<K, U>> toMap() { return toMap( Map.Entry::getKey, Map.Entry::getValue, HashMap::new ); } private Collectors(); static Collector<T, ?, T> single(); static Collector<T, ?, Optional<T>> singleOrEmpty(); static Collector<T, ?, Map<K, U>> toMa... |
@Test public void toMapRejectNullValues() { Map<String, String> input = new LinkedHashMap<>(); input.put( "foo", "bar" ); input.put( "bazar", null ); try { input.entrySet().stream().collect( Collectors.toMap() ); fail( "Should have failed, that's the default Map::merge behaviour" ); } catch( NullPointerException expect... | public static <T extends Map.Entry<K, U>, K, U> Collector<T, ?, Map<K, U>> toMap() { return toMap( Map.Entry::getKey, Map.Entry::getValue, HashMap::new ); } | Collectors { public static <T extends Map.Entry<K, U>, K, U> Collector<T, ?, Map<K, U>> toMap() { return toMap( Map.Entry::getKey, Map.Entry::getValue, HashMap::new ); } } | Collectors { public static <T extends Map.Entry<K, U>, K, U> Collector<T, ?, Map<K, U>> toMap() { return toMap( Map.Entry::getKey, Map.Entry::getValue, HashMap::new ); } private Collectors(); } | Collectors { public static <T extends Map.Entry<K, U>, K, U> Collector<T, ?, Map<K, U>> toMap() { return toMap( Map.Entry::getKey, Map.Entry::getValue, HashMap::new ); } private Collectors(); static Collector<T, ?, T> single(); static Collector<T, ?, Optional<T>> singleOrEmpty(); static Collector<T, ?, Map<K, U>> toMa... | Collectors { public static <T extends Map.Entry<K, U>, K, U> Collector<T, ?, Map<K, U>> toMap() { return toMap( Map.Entry::getKey, Map.Entry::getValue, HashMap::new ); } private Collectors(); static Collector<T, ?, T> single(); static Collector<T, ?, Optional<T>> singleOrEmpty(); static Collector<T, ?, Map<K, U>> toMa... |
@Test public void toMapWithNullValues() { Map<String, String> input = new LinkedHashMap<>(); input.put( "foo", "bar" ); input.put( "bazar", null ); Map<String, String> output = input.entrySet().stream().collect( Collectors.toMapWithNullValues() ); assertThat( output.get( "foo" ), equalTo( "bar" ) ); assertThat( output.... | public static <T extends Map.Entry<K, U>, K, U> Collector<T, ?, Map<K, U>> toMapWithNullValues() { return toMapWithNullValues( Map.Entry::getKey, Map.Entry::getValue, HashMap::new ); } | Collectors { public static <T extends Map.Entry<K, U>, K, U> Collector<T, ?, Map<K, U>> toMapWithNullValues() { return toMapWithNullValues( Map.Entry::getKey, Map.Entry::getValue, HashMap::new ); } } | Collectors { public static <T extends Map.Entry<K, U>, K, U> Collector<T, ?, Map<K, U>> toMapWithNullValues() { return toMapWithNullValues( Map.Entry::getKey, Map.Entry::getValue, HashMap::new ); } private Collectors(); } | Collectors { public static <T extends Map.Entry<K, U>, K, U> Collector<T, ?, Map<K, U>> toMapWithNullValues() { return toMapWithNullValues( Map.Entry::getKey, Map.Entry::getValue, HashMap::new ); } private Collectors(); static Collector<T, ?, T> single(); static Collector<T, ?, Optional<T>> singleOrEmpty(); static Col... | Collectors { public static <T extends Map.Entry<K, U>, K, U> Collector<T, ?, Map<K, U>> toMapWithNullValues() { return toMapWithNullValues( Map.Entry::getKey, Map.Entry::getValue, HashMap::new ); } private Collectors(); static Collector<T, ?, T> single(); static Collector<T, ?, Optional<T>> singleOrEmpty(); static Col... |
@Test public void testTemplate() throws UnitOfWorkCompletionException { new UnitOfWorkTemplate<Void, RuntimeException>() { @Override protected Void withUnitOfWork( UnitOfWork uow ) throws RuntimeException { new EntityBuilderTemplate<TestEntity>( TestEntity.class ) { @Override protected void build( TestEntity prototype ... | @SuppressWarnings( "unchecked" ) public RESULT withModule( Module module ) throws ThrowableType, UnitOfWorkCompletionException { int loop = 0; ThrowableType ex = null; do { UnitOfWork uow = module.unitOfWorkFactory().newUnitOfWork( usecase ); try { RESULT result = withUnitOfWork( uow ); if( complete ) { try { uow.compl... | UnitOfWorkTemplate { @SuppressWarnings( "unchecked" ) public RESULT withModule( Module module ) throws ThrowableType, UnitOfWorkCompletionException { int loop = 0; ThrowableType ex = null; do { UnitOfWork uow = module.unitOfWorkFactory().newUnitOfWork( usecase ); try { RESULT result = withUnitOfWork( uow ); if( complet... | UnitOfWorkTemplate { @SuppressWarnings( "unchecked" ) public RESULT withModule( Module module ) throws ThrowableType, UnitOfWorkCompletionException { int loop = 0; ThrowableType ex = null; do { UnitOfWork uow = module.unitOfWorkFactory().newUnitOfWork( usecase ); try { RESULT result = withUnitOfWork( uow ); if( complet... | UnitOfWorkTemplate { @SuppressWarnings( "unchecked" ) public RESULT withModule( Module module ) throws ThrowableType, UnitOfWorkCompletionException { int loop = 0; ThrowableType ex = null; do { UnitOfWork uow = module.unitOfWorkFactory().newUnitOfWork( usecase ); try { RESULT result = withUnitOfWork( uow ); if( complet... | UnitOfWorkTemplate { @SuppressWarnings( "unchecked" ) public RESULT withModule( Module module ) throws ThrowableType, UnitOfWorkCompletionException { int loop = 0; ThrowableType ex = null; do { UnitOfWork uow = module.unitOfWorkFactory().newUnitOfWork( usecase ); try { RESULT result = withUnitOfWork( uow ); if( complet... |
@Test public void selectMatchingTypes() { List<ValueType> valueTypes = Arrays.asList( ValueType.of( String.class ), ValueType.of( Integer.class ), ValueType.of( Number.class ) ); List<ValueType> number = valueTypes.stream().collect( HasTypesCollectors.matchingTypes( Number.class ) ); assertThat( number.size(), is( 2 ) ... | public static <T extends HasTypes> Collector<T, ?, List<T>> matchingTypes( T hasTypes ) { return hasTypesToListCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, List<T>> matchingTypes( T hasTypes ) { return hasTypesToListCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } } | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, List<T>> matchingTypes( T hasTypes ) { return hasTypesToListCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } private HasTypesCollectors(); } | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, List<T>> matchingTypes( T hasTypes ) { return hasTypesToListCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } private HasTypesCollectors(); static Collector<T, ?, Optional<T>> matchingType( T hasTypes ); static Collector<T, ?, Opti... | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, List<T>> matchingTypes( T hasTypes ) { return hasTypesToListCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } private HasTypesCollectors(); static Collector<T, ?, Optional<T>> matchingType( T hasTypes ); static Collector<T, ?, Opti... |
@Test public void selectMatchingType() { List<ValueType> valueTypes = Arrays.asList( ValueType.of( String.class ), ValueType.of( Double.class ), ValueType.of( Integer.class ) ); Optional<ValueType> number = valueTypes.stream() .collect( HasTypesCollectors.matchingType( Number.class ) ); assertThat( number.isPresent(), ... | public static <T extends HasTypes> Collector<T, ?, Optional<T>> matchingType( T hasTypes ) { return hasTypesFindFirstCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, Optional<T>> matchingType( T hasTypes ) { return hasTypesFindFirstCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } } | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, Optional<T>> matchingType( T hasTypes ) { return hasTypesFindFirstCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } private HasTypesCollectors(); } | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, Optional<T>> matchingType( T hasTypes ) { return hasTypesFindFirstCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } private HasTypesCollectors(); static Collector<T, ?, Optional<T>> matchingType( T hasTypes ); static Collector<T, ?... | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, Optional<T>> matchingType( T hasTypes ) { return hasTypesFindFirstCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } private HasTypesCollectors(); static Collector<T, ?, Optional<T>> matchingType( T hasTypes ); static Collector<T, ?... |
@Test @Disabled( "Expectations need to be figured out." ) public void failingBooking() throws ActivationException, AssemblyException { SingletonAssembler assembler = new SingletonAssembler( module -> module.transients( ShippingServiceTestComposite.class ) ); ShippingService shippingService = createMock( ShippingService... | @Override public int makeBooking( Cargo cargo, Voyage voyage ) { int ok = next.makeBooking( cargo, voyage ); if( ok < 0 ) { return ok; } Property<Integer> gen = generator.sequence(); ok = gen.get(); generator.sequence().set( ok + 1 ); return ok; } | SequencingConcern extends ConcernOf<ShippingService> implements ShippingService { @Override public int makeBooking( Cargo cargo, Voyage voyage ) { int ok = next.makeBooking( cargo, voyage ); if( ok < 0 ) { return ok; } Property<Integer> gen = generator.sequence(); ok = gen.get(); generator.sequence().set( ok + 1 ); ret... | SequencingConcern extends ConcernOf<ShippingService> implements ShippingService { @Override public int makeBooking( Cargo cargo, Voyage voyage ) { int ok = next.makeBooking( cargo, voyage ); if( ok < 0 ) { return ok; } Property<Integer> gen = generator.sequence(); ok = gen.get(); generator.sequence().set( ok + 1 ); ret... | SequencingConcern extends ConcernOf<ShippingService> implements ShippingService { @Override public int makeBooking( Cargo cargo, Voyage voyage ) { int ok = next.makeBooking( cargo, voyage ); if( ok < 0 ) { return ok; } Property<Integer> gen = generator.sequence(); ok = gen.get(); generator.sequence().set( ok + 1 ); ret... | SequencingConcern extends ConcernOf<ShippingService> implements ShippingService { @Override public int makeBooking( Cargo cargo, Voyage voyage ) { int ok = next.makeBooking( cargo, voyage ); if( ok < 0 ) { return ok; } Property<Integer> gen = generator.sequence(); ok = gen.get(); generator.sequence().set( ok + 1 ); ret... |
@Test public void selectMatchingValueTypes() { List<ValueType> valueTypes = Arrays.asList( ValueType.of( String.class ), ValueType.of( Number.class, Integer.class ), ValueType.of( Integer.class ), ValueType.of( Number.class ) ); List<ValueType> number = valueTypes.stream() .collect( HasTypesCollectors.matchingTypes( Va... | public static <T extends HasTypes> Collector<T, ?, List<T>> matchingTypes( T hasTypes ) { return hasTypesToListCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, List<T>> matchingTypes( T hasTypes ) { return hasTypesToListCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } } | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, List<T>> matchingTypes( T hasTypes ) { return hasTypesToListCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } private HasTypesCollectors(); } | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, List<T>> matchingTypes( T hasTypes ) { return hasTypesToListCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } private HasTypesCollectors(); static Collector<T, ?, Optional<T>> matchingType( T hasTypes ); static Collector<T, ?, Opti... | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, List<T>> matchingTypes( T hasTypes ) { return hasTypesToListCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } private HasTypesCollectors(); static Collector<T, ?, Optional<T>> matchingType( T hasTypes ); static Collector<T, ?, Opti... |
@Test public void selectMatchingValueType() { List<ValueType> valueTypes = Arrays.asList( ValueType.of( String.class ), ValueType.of( Number.class, Integer.class ), ValueType.of( Integer.class ), ValueType.of( Number.class ) ); Optional<ValueType> number = valueTypes.stream() .collect( HasTypesCollectors.matchingType( ... | public static <T extends HasTypes> Collector<T, ?, Optional<T>> matchingType( T hasTypes ) { return hasTypesFindFirstCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, Optional<T>> matchingType( T hasTypes ) { return hasTypesFindFirstCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } } | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, Optional<T>> matchingType( T hasTypes ) { return hasTypesFindFirstCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } private HasTypesCollectors(); } | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, Optional<T>> matchingType( T hasTypes ) { return hasTypesFindFirstCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } private HasTypesCollectors(); static Collector<T, ?, Optional<T>> matchingType( T hasTypes ); static Collector<T, ?... | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, Optional<T>> matchingType( T hasTypes ) { return hasTypesFindFirstCollector( hasTypes, new HasAssignableFromType<>( hasTypes ) ); } private HasTypesCollectors(); static Collector<T, ?, Optional<T>> matchingType( T hasTypes ); static Collector<T, ?... |
@Test public void selectClosestValueTypes() { List<ValueType> list = new ArrayList<ValueType>() {{ add( ValueType.of( String.class ) ); add( ValueType.of( Identity.class ) ); }}; List<ValueType> result = list.stream() .collect( HasTypesCollectors.closestTypes( StringIdentity.class ) ); assertThat( result.size(), is( 1 ... | public static <T extends HasTypes> Collector<T, ?, List<T>> closestTypes( T hasTypes ) { return hasTypesToListCollector( hasTypes, new HasAssignableToType<>( hasTypes ) ); } | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, List<T>> closestTypes( T hasTypes ) { return hasTypesToListCollector( hasTypes, new HasAssignableToType<>( hasTypes ) ); } } | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, List<T>> closestTypes( T hasTypes ) { return hasTypesToListCollector( hasTypes, new HasAssignableToType<>( hasTypes ) ); } private HasTypesCollectors(); } | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, List<T>> closestTypes( T hasTypes ) { return hasTypesToListCollector( hasTypes, new HasAssignableToType<>( hasTypes ) ); } private HasTypesCollectors(); static Collector<T, ?, Optional<T>> matchingType( T hasTypes ); static Collector<T, ?, Optiona... | HasTypesCollectors { public static <T extends HasTypes> Collector<T, ?, List<T>> closestTypes( T hasTypes ) { return hasTypesToListCollector( hasTypes, new HasAssignableToType<>( hasTypes ) ); } private HasTypesCollectors(); static Collector<T, ?, Optional<T>> matchingType( T hasTypes ); static Collector<T, ?, Optiona... |
@Test public void testMappingOfInteger() throws Exception { assertThat( mapToType( null, Integer.class, "5" ), equalTo( 5 ) ); assertThat( mapToType( null, Integer.class, "-5" ), equalTo( -5 ) ); assertThat( mapToType( null, Integer.class, "5" ).getClass(), equalTo( Integer.class ) ); } | @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY.get( Array.class... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... |
@Test public void testMappingOfLong() throws Exception { assertThat( mapToType( null, Long.class, "5" ), equalTo( 5L ) ); assertThat( mapToType( null, Long.class, "5876328476238746238" ), equalTo( 5876328476238746238L ) ); assertThat( mapToType( null, Long.class, "5" ).getClass(), equalTo( Long.class ) ); } | @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY.get( Array.class... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... |
@Test public void testMappingOfBoolean() throws Exception { assertThat( mapToType( null, Boolean.class, "false" ), is( false ) ); assertThat( mapToType( null, Boolean.class, "true" ), is( true ) ); assertThat( mapToType( null, Boolean.class, "false" ).getClass(), equalTo( Boolean.class ) ); } | @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY.get( Array.class... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... |
@Test public void testMappingOfFloat() throws Exception { assertThat( mapToType( null, Float.class, "5.1234" ), equalTo( 5.1234f ) ); assertThat( mapToType( null, Float.class, "5876328476.6238" ), equalTo( 5876328476.6238f ) ); assertThat( mapToType( null, Float.class, "5" ).getClass(), equalTo( Float.class ) ); } | @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY.get( Array.class... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... |
@Test public void testMappingOfDouble() throws Exception { assertThat( mapToType( null, Double.class, "5.1234" ), equalTo( 5.1234 ) ); assertThat( mapToType( null, Double.class, "5876328476.623823" ), equalTo( 5876328476.623823 ) ); assertThat( mapToType( null, Double.class, "5" ).getClass(), equalTo( Double.class ) );... | @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY.get( Array.class... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... |
@Test public void testMappingOfBigDecimal() throws Exception { assertThat( mapToType( null, BigDecimal.class, "3" ), equalTo( new BigDecimal( 3 ) ) ); assertThat( mapToType( null, BigDecimal.class, "12345.67891011" ), equalTo( new BigDecimal( "12345.67891011" ) ) ); assertThat( mapToType( null, BigDecimal.class, "5" ).... | @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY.get( Array.class... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... |
@Test public void testMappingOfBigInteger() throws Exception { assertThat( mapToType( null, BigInteger.class, "32" ), equalTo( new BigInteger( "20", 16 ) ) ); assertThat( mapToType( null, BigInteger.class, "1234567891011" ), equalTo( new BigInteger( "1234567891011" ) ) ); assertThat( mapToType( null, BigInteger.class, ... | @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY.get( Array.class... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... |
@Test @Disabled( "Expectations need to be figured out." ) public void successfulBooking() throws ActivationException, AssemblyException { SingletonAssembler assembler = new SingletonAssembler( module -> module.transients( ShippingServiceTestComposite.class ) ); ShippingService shippingService = createMock( ShippingServ... | @Override public int makeBooking( Cargo cargo, Voyage voyage ) { int ok = next.makeBooking( cargo, voyage ); if( ok < 0 ) { return ok; } Property<Integer> gen = generator.sequence(); ok = gen.get(); generator.sequence().set( ok + 1 ); return ok; } | SequencingConcern extends ConcernOf<ShippingService> implements ShippingService { @Override public int makeBooking( Cargo cargo, Voyage voyage ) { int ok = next.makeBooking( cargo, voyage ); if( ok < 0 ) { return ok; } Property<Integer> gen = generator.sequence(); ok = gen.get(); generator.sequence().set( ok + 1 ); ret... | SequencingConcern extends ConcernOf<ShippingService> implements ShippingService { @Override public int makeBooking( Cargo cargo, Voyage voyage ) { int ok = next.makeBooking( cargo, voyage ); if( ok < 0 ) { return ok; } Property<Integer> gen = generator.sequence(); ok = gen.get(); generator.sequence().set( ok + 1 ); ret... | SequencingConcern extends ConcernOf<ShippingService> implements ShippingService { @Override public int makeBooking( Cargo cargo, Voyage voyage ) { int ok = next.makeBooking( cargo, voyage ); if( ok < 0 ) { return ok; } Property<Integer> gen = generator.sequence(); ok = gen.get(); generator.sequence().set( ok + 1 ); ret... | SequencingConcern extends ConcernOf<ShippingService> implements ShippingService { @Override public int makeBooking( Cargo cargo, Voyage voyage ) { int ok = next.makeBooking( cargo, voyage ); if( ok < 0 ) { return ok; } Property<Integer> gen = generator.sequence(); ok = gen.get(); generator.sequence().set( ok + 1 ); ret... |
@Test public void testMappingOfEnum() throws Exception { assertThat( mapToType( null, TestEnum.class, "FIRST" ), is( TestEnum.FIRST ) ); assertThat( mapToType( null, TestEnum.class, "SECOND" ), is( TestEnum.SECOND ) ); assertThat( mapToType( null, TestEnum.class, "SECOND" ).getClass(), equalTo( TestEnum.class ) ); } | @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY.get( Array.class... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... |
@Test public void testMappingOfIntegerArray() throws Exception { Object[] value = (Object[]) mapToType( null, Integer[].class, "5,4 , 3 ,2,1" ); assertThat( value.length, equalTo( 5 ) ); assertThat( value[ 0 ], equalTo( 5 ) ); assertThat( value[ 1 ], equalTo( 4 ) ); assertThat( value[ 2 ], equalTo( 3 ) ); assertThat( v... | @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY.get( Array.class... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... |
@Test public void testMappingOfStringArray() throws Exception { { Object[] value = (Object[]) mapToType( null, String[].class, "5,4 , 3 ,2,1" ); assertThat( value.length, equalTo( 5 ) ); assertThat( value[ 0 ], equalTo( "5" ) ); assertThat( value[ 1 ], equalTo( "4 " ) ); assertThat( value[ 2 ], equalTo( " 3 " ) ); asse... | @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY.get( Array.class... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... |
@Test public void testMappingOfBooleanArray() throws Exception { Object[] value = (Object[]) mapToType( null, Boolean[].class, " true,false, false, true ,true,false" ); assertThat( value[ 0 ], equalTo( true ) ); assertThat( value[ 1 ], equalTo( false ) ); assertThat( value[ 2 ], equalTo( false ) ); assertThat( value[ 3... | @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY.get( Array.class... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... |
@Test public void testMappingOfList() throws Exception { Type type = Testing.class.getDeclaredMethod( "list" ).getGenericReturnType(); List<String> value = (List<String>) mapToType( null, type, "5,4 ,\" 3, \", \" 2\" ,1" ); assertThat( value.get( 0 ), equalTo( "5" ) ); assertThat( value.get( 1 ), equalTo( "4 " ) ); ass... | @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY.get( Array.class... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... |
@Test public void testMappingOfSet() throws Exception { Type type = Testing.class.getDeclaredMethod( "set" ).getGenericReturnType(); Set<String> value = (Set<String>) mapToType( null, type, "5,4 ,\" 3, \", \" 2\" ,1" ); assertThat( value.contains( "5" ), is( true ) ); assertThat( value.contains( "4 " ), is( true ) ); a... | @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY.get( Array.class... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... |
@Test public void testMappingOfMap() throws Exception { Type type = Testing.class.getDeclaredMethod( "map" ).getGenericReturnType(); Map<String, String> value = (Map<String, String>) mapToType( null, type, "first:5,second:4 , third:\" 3, \", fourth: \" 2\" ,fifth : 1" ); assertThat( value.get( "first" ), equalTo( "5" )... | @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY.get( Array.class... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... | PropertyMapper { @SuppressWarnings( "raw" ) private static Object mapToType( Composite composite, Type propertyType, Object value ) { final String stringValue = value.toString(); MappingStrategy strategy; if( propertyType instanceof Class ) { Class type = (Class) propertyType; if( type.isArray() ) { strategy = STRATEGY... |
@Test public void testQualifiedNameWithDollar() { assertThat( "Name containing dollar is modified", new QualifiedName( TypeName.nameOf( "Test$Test" ), "satisfiedBy" ).type(), equalTo( "Test-Test" ) ); } | public String type() { return typeName.normalized(); } | QualifiedName implements Comparable<QualifiedName> { public String type() { return typeName.normalized(); } } | QualifiedName implements Comparable<QualifiedName> { public String type() { return typeName.normalized(); } QualifiedName( TypeName typeName, String name ); } | QualifiedName implements Comparable<QualifiedName> { public String type() { return typeName.normalized(); } QualifiedName( TypeName typeName, String name ); static QualifiedName fromAccessor( AccessibleObject method ); static QualifiedName fromClass( Class type, String name ); static QualifiedName fromName( String type... | QualifiedName implements Comparable<QualifiedName> { public String type() { return typeName.normalized(); } QualifiedName( TypeName typeName, String name ); static QualifiedName fromAccessor( AccessibleObject method ); static QualifiedName fromClass( Class type, String name ); static QualifiedName fromName( String type... |
@Test public void nonNullArguments4() { assertThrows( NullPointerException.class, () -> QualifiedName.fromFQN( null ) ); } | public static QualifiedName fromFQN( String fullQualifiedName ) { Objects.requireNonNull( fullQualifiedName, "qualifiedName" ); int idx = fullQualifiedName.lastIndexOf( ":" ); if( idx == -1 ) { throw new IllegalArgumentException( "Name '" + fullQualifiedName + "' is not a qualified name" ); } final String type = fullQu... | QualifiedName implements Comparable<QualifiedName> { public static QualifiedName fromFQN( String fullQualifiedName ) { Objects.requireNonNull( fullQualifiedName, "qualifiedName" ); int idx = fullQualifiedName.lastIndexOf( ":" ); if( idx == -1 ) { throw new IllegalArgumentException( "Name '" + fullQualifiedName + "' is ... | QualifiedName implements Comparable<QualifiedName> { public static QualifiedName fromFQN( String fullQualifiedName ) { Objects.requireNonNull( fullQualifiedName, "qualifiedName" ); int idx = fullQualifiedName.lastIndexOf( ":" ); if( idx == -1 ) { throw new IllegalArgumentException( "Name '" + fullQualifiedName + "' is ... | QualifiedName implements Comparable<QualifiedName> { public static QualifiedName fromFQN( String fullQualifiedName ) { Objects.requireNonNull( fullQualifiedName, "qualifiedName" ); int idx = fullQualifiedName.lastIndexOf( ":" ); if( idx == -1 ) { throw new IllegalArgumentException( "Name '" + fullQualifiedName + "' is ... | QualifiedName implements Comparable<QualifiedName> { public static QualifiedName fromFQN( String fullQualifiedName ) { Objects.requireNonNull( fullQualifiedName, "qualifiedName" ); int idx = fullQualifiedName.lastIndexOf( ":" ); if( idx == -1 ) { throw new IllegalArgumentException( "Name '" + fullQualifiedName + "' is ... |
@Test public void nonNullArguments5() { assertThrows( NullPointerException.class, () -> QualifiedName.fromAccessor( null ) ); } | public static QualifiedName fromAccessor( AccessibleObject method ) { Objects.requireNonNull( method, "method" ); return fromClass( ( (Member) method ).getDeclaringClass(), ( (Member) method ).getName() ); } | QualifiedName implements Comparable<QualifiedName> { public static QualifiedName fromAccessor( AccessibleObject method ) { Objects.requireNonNull( method, "method" ); return fromClass( ( (Member) method ).getDeclaringClass(), ( (Member) method ).getName() ); } } | QualifiedName implements Comparable<QualifiedName> { public static QualifiedName fromAccessor( AccessibleObject method ) { Objects.requireNonNull( method, "method" ); return fromClass( ( (Member) method ).getDeclaringClass(), ( (Member) method ).getName() ); } QualifiedName( TypeName typeName, String name ); } | QualifiedName implements Comparable<QualifiedName> { public static QualifiedName fromAccessor( AccessibleObject method ) { Objects.requireNonNull( method, "method" ); return fromClass( ( (Member) method ).getDeclaringClass(), ( (Member) method ).getName() ); } QualifiedName( TypeName typeName, String name ); static Qua... | QualifiedName implements Comparable<QualifiedName> { public static QualifiedName fromAccessor( AccessibleObject method ) { Objects.requireNonNull( method, "method" ); return fromClass( ( (Member) method ).getDeclaringClass(), ( (Member) method ).getName() ); } QualifiedName( TypeName typeName, String name ); static Qua... |
@Test public void givenPlainQueryWhenFindEntityExpectFirstEntityReturned() { Query<TestComposite> query = queryBuilderFactory.newQueryBuilder( TestComposite.class ).newQuery( composites ); assertThat( query.find().a().get(), equalTo( "A" ) ); assertThat( query.count(), equalTo( 6L ) ); } | @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); return new QueryBuilderImpl<>( serviceReference.get(), re... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... |
@Test public void nonNullArguments6() { assertThrows( NullPointerException.class, () -> QualifiedName.fromClass( null, "satisfiedBy" ) ); } | public static QualifiedName fromClass( Class type, String name ) { return new QualifiedName( TypeName.nameOf( type ), name ); } | QualifiedName implements Comparable<QualifiedName> { public static QualifiedName fromClass( Class type, String name ) { return new QualifiedName( TypeName.nameOf( type ), name ); } } | QualifiedName implements Comparable<QualifiedName> { public static QualifiedName fromClass( Class type, String name ) { return new QualifiedName( TypeName.nameOf( type ), name ); } QualifiedName( TypeName typeName, String name ); } | QualifiedName implements Comparable<QualifiedName> { public static QualifiedName fromClass( Class type, String name ) { return new QualifiedName( TypeName.nameOf( type ), name ); } QualifiedName( TypeName typeName, String name ); static QualifiedName fromAccessor( AccessibleObject method ); static QualifiedName fromCla... | QualifiedName implements Comparable<QualifiedName> { public static QualifiedName fromClass( Class type, String name ) { return new QualifiedName( TypeName.nameOf( type ), name ); } QualifiedName( TypeName typeName, String name ); static QualifiedName fromAccessor( AccessibleObject method ); static QualifiedName fromCla... |
@Test public void nonNullArguments7() { assertThrows( NullPointerException.class, () -> QualifiedName.fromClass( null, null ) ); } | public static QualifiedName fromClass( Class type, String name ) { return new QualifiedName( TypeName.nameOf( type ), name ); } | QualifiedName implements Comparable<QualifiedName> { public static QualifiedName fromClass( Class type, String name ) { return new QualifiedName( TypeName.nameOf( type ), name ); } } | QualifiedName implements Comparable<QualifiedName> { public static QualifiedName fromClass( Class type, String name ) { return new QualifiedName( TypeName.nameOf( type ), name ); } QualifiedName( TypeName typeName, String name ); } | QualifiedName implements Comparable<QualifiedName> { public static QualifiedName fromClass( Class type, String name ) { return new QualifiedName( TypeName.nameOf( type ), name ); } QualifiedName( TypeName typeName, String name ); static QualifiedName fromAccessor( AccessibleObject method ); static QualifiedName fromCla... | QualifiedName implements Comparable<QualifiedName> { public static QualifiedName fromClass( Class type, String name ) { return new QualifiedName( TypeName.nameOf( type ), name ); } QualifiedName( TypeName typeName, String name ); static QualifiedName fromAccessor( AccessibleObject method ); static QualifiedName fromCla... |
@Test public void testInvoke() throws Throwable { DomainType domain1 = transientBuilderFactory.newTransient( DomainType.class ); assertThat(domain1.do1("her message"), equalTo("[her message]") ); } | @Override public Object invoke( Object proxy, Method method, Object[] objects ) throws Throwable { Object result = ( (Invocable) engine ).invokeFunction( method.getName(), objects ); return castInvocationResult( method.getReturnType(), result ); } | ScriptMixin implements InvocationHandler, ScriptReloadable, ScriptRedirect, ScriptAttributes, ScriptAttributes.All { @Override public Object invoke( Object proxy, Method method, Object[] objects ) throws Throwable { Object result = ( (Invocable) engine ).invokeFunction( method.getName(), objects ); return castInvocatio... | ScriptMixin implements InvocationHandler, ScriptReloadable, ScriptRedirect, ScriptAttributes, ScriptAttributes.All { @Override public Object invoke( Object proxy, Method method, Object[] objects ) throws Throwable { Object result = ( (Invocable) engine ).invokeFunction( method.getName(), objects ); return castInvocatio... | ScriptMixin implements InvocationHandler, ScriptReloadable, ScriptRedirect, ScriptAttributes, ScriptAttributes.All { @Override public Object invoke( Object proxy, Method method, Object[] objects ) throws Throwable { Object result = ( (Invocable) engine ).invokeFunction( method.getName(), objects ); return castInvocatio... | ScriptMixin implements InvocationHandler, ScriptReloadable, ScriptRedirect, ScriptAttributes, ScriptAttributes.All { @Override public Object invoke( Object proxy, Method method, Object[] objects ) throws Throwable { Object result = ( (Invocable) engine ).invokeFunction( method.getName(), objects ); return castInvocatio... |
@Test public void testEntityTypeSerializer() throws RDFHandlerException { EntityDescriptor entityDescriptor = module.entityDescriptor(TestEntity.class.getName()); Iterable<Statement> graph = serializer.serialize( entityDescriptor ); String[] prefixes = new String[]{ "rdf", "dc", " vc", "polygene" }; String[] namespaces... | public EntityTypeSerializer() { dataTypes.put( String.class.getName(), XMLSchema.STRING ); dataTypes.put( Integer.class.getName(), XMLSchema.INT ); dataTypes.put( Boolean.class.getName(), XMLSchema.BOOLEAN ); dataTypes.put( Byte.class.getName(), XMLSchema.BYTE ); dataTypes.put( BigDecimal.class.getName(), XMLSchema.DEC... | EntityTypeSerializer { public EntityTypeSerializer() { dataTypes.put( String.class.getName(), XMLSchema.STRING ); dataTypes.put( Integer.class.getName(), XMLSchema.INT ); dataTypes.put( Boolean.class.getName(), XMLSchema.BOOLEAN ); dataTypes.put( Byte.class.getName(), XMLSchema.BYTE ); dataTypes.put( BigDecimal.class.g... | EntityTypeSerializer { public EntityTypeSerializer() { dataTypes.put( String.class.getName(), XMLSchema.STRING ); dataTypes.put( Integer.class.getName(), XMLSchema.INT ); dataTypes.put( Boolean.class.getName(), XMLSchema.BOOLEAN ); dataTypes.put( Byte.class.getName(), XMLSchema.BYTE ); dataTypes.put( BigDecimal.class.g... | EntityTypeSerializer { public EntityTypeSerializer() { dataTypes.put( String.class.getName(), XMLSchema.STRING ); dataTypes.put( Integer.class.getName(), XMLSchema.INT ); dataTypes.put( Boolean.class.getName(), XMLSchema.BOOLEAN ); dataTypes.put( Byte.class.getName(), XMLSchema.BYTE ); dataTypes.put( BigDecimal.class.g... | EntityTypeSerializer { public EntityTypeSerializer() { dataTypes.put( String.class.getName(), XMLSchema.STRING ); dataTypes.put( Integer.class.getName(), XMLSchema.INT ); dataTypes.put( Boolean.class.getName(), XMLSchema.BOOLEAN ); dataTypes.put( Byte.class.getName(), XMLSchema.BYTE ); dataTypes.put( BigDecimal.class.g... |
@Test public void givenPlainQueryWhenOrderByFirstPropertyExpectOrderedResult() { Query<TestComposite> query = queryBuilderFactory.newQueryBuilder( TestComposite.class ).newQuery( composites ); TestComposite template = templateFor( TestComposite.class ); query.orderBy( orderBy( template.a() ) ); verifyOrder( query, "612... | @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); return new QueryBuilderImpl<>( serviceReference.get(), re... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... |
@Test public void givenPlainQueryWhenOrderBySecondPropertyExpectOrderedResult() { Query<TestComposite> query = queryBuilderFactory.newQueryBuilder( TestComposite.class ).newQuery( composites ); TestComposite template = templateFor( TestComposite.class ); query.orderBy( orderBy( template.b() ) ); verifyOrder( query, "12... | @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); return new QueryBuilderImpl<>( serviceReference.get(), re... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... |
@Test public void givenPlainQueryWhenOrderByTwoPropertiesExpectOrderedResult() { Query<TestComposite> query = queryBuilderFactory.newQueryBuilder( TestComposite.class ).newQuery( composites ); TestComposite template = templateFor( TestComposite.class ); query.orderBy( orderBy( template.a() ), orderBy( template.b() ) );... | @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); return new QueryBuilderImpl<>( serviceReference.get(), re... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... |
@Test public void givenPlainQueryWhenMaxedResultExpectLimitedResult() { Query<TestComposite> query = queryBuilderFactory.newQueryBuilder( TestComposite.class ).newQuery( composites ); query.maxResults( 5 ); verifyOrder( query, "62345" ); } | @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); return new QueryBuilderImpl<>( serviceReference.get(), re... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... |
@Test public void givenPlainQueryWhenFirstResultIsBeyondFirstElementExpectLimitedResult() { Query<TestComposite> query = queryBuilderFactory.newQueryBuilder( TestComposite.class ).newQuery( composites ); query.firstResult( 2 ); verifyOrder( query, "3451" ); } | @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); return new QueryBuilderImpl<>( serviceReference.get(), re... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... | QueryBuilderFactoryImpl implements QueryBuilderFactory { @Override public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType ) { NotQueryableException.throwIfNotQueryable( resultType ); final ServiceReference<EntityFinder> serviceReference; try { serviceReference = finder.findService( EntityFinder.class ); ... |
@Test public void hello() throws Exception { sendMail.sendSimpleMail("aaaa","1193889747@qq.com","sdas"); } | public void sendSimpleMail(String subject, String to, String context) { SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); simpleMailMessage.setFrom(from); simpleMailMessage.setTo(to); simpleMailMessage.setSubject(subject); simpleMailMessage.setText(context); try { javaMailSender.send(simpleMailMessage); lo... | SendMail { public void sendSimpleMail(String subject, String to, String context) { SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); simpleMailMessage.setFrom(from); simpleMailMessage.setTo(to); simpleMailMessage.setSubject(subject); simpleMailMessage.setText(context); try { javaMailSender.send(simpleMailM... | SendMail { public void sendSimpleMail(String subject, String to, String context) { SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); simpleMailMessage.setFrom(from); simpleMailMessage.setTo(to); simpleMailMessage.setSubject(subject); simpleMailMessage.setText(context); try { javaMailSender.send(simpleMailM... | SendMail { public void sendSimpleMail(String subject, String to, String context) { SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); simpleMailMessage.setFrom(from); simpleMailMessage.setTo(to); simpleMailMessage.setSubject(subject); simpleMailMessage.setText(context); try { javaMailSender.send(simpleMailM... | SendMail { public void sendSimpleMail(String subject, String to, String context) { SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); simpleMailMessage.setFrom(from); simpleMailMessage.setTo(to); simpleMailMessage.setSubject(subject); simpleMailMessage.setText(context); try { javaMailSender.send(simpleMailM... |
@Test public void hellomaiTemplate() throws Exception { sendMail.sendtemplateHtmlMail("你好,模板邮件加附件加图片","1193889747@qq.com","Bocly"); } | public void sendtemplateHtmlMail(String subject, String to, String name) { MimeMessage mimeMessage = javaMailSender.createMimeMessage(); try { MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true); helper.setSubject(subject); helper.setTo(to); helper.setFrom(from); String filepath = "C:\\Users\\Administra... | SendMail { public void sendtemplateHtmlMail(String subject, String to, String name) { MimeMessage mimeMessage = javaMailSender.createMimeMessage(); try { MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true); helper.setSubject(subject); helper.setTo(to); helper.setFrom(from); String filepath = "C:\\Users\... | SendMail { public void sendtemplateHtmlMail(String subject, String to, String name) { MimeMessage mimeMessage = javaMailSender.createMimeMessage(); try { MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true); helper.setSubject(subject); helper.setTo(to); helper.setFrom(from); String filepath = "C:\\Users\... | SendMail { public void sendtemplateHtmlMail(String subject, String to, String name) { MimeMessage mimeMessage = javaMailSender.createMimeMessage(); try { MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true); helper.setSubject(subject); helper.setTo(to); helper.setFrom(from); String filepath = "C:\\Users\... | SendMail { public void sendtemplateHtmlMail(String subject, String to, String name) { MimeMessage mimeMessage = javaMailSender.createMimeMessage(); try { MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true); helper.setSubject(subject); helper.setTo(to); helper.setFrom(from); String filepath = "C:\\Users\... |
@Test public void testSetCounts() { Location mockLocation = new Location(LocationManager.GPS_PROVIDER); { StumblerBundle bundle = new StumblerBundle(mockLocation); testObservationCounts(bundle, 0, 0); for (String bssid : new String[]{"01:23:45:67:89:ab", "23:45:67:89:ab:cd"}) { ScanResult scanResult = createScanResult(... | public void setCounts(MLSJSONObject ichnaeaQueryObj) { mCellCount = ichnaeaQueryObj.getCellCount(); mWifiCount = ichnaeaQueryObj.getWifiCount(); } | ObservationPoint implements AsyncGeolocate.MLSLocationGetterCallback { public void setCounts(MLSJSONObject ichnaeaQueryObj) { mCellCount = ichnaeaQueryObj.getCellCount(); mWifiCount = ichnaeaQueryObj.getWifiCount(); } } | ObservationPoint implements AsyncGeolocate.MLSLocationGetterCallback { public void setCounts(MLSJSONObject ichnaeaQueryObj) { mCellCount = ichnaeaQueryObj.getCellCount(); mWifiCount = ichnaeaQueryObj.getWifiCount(); } ObservationPoint(Location pointGPS); ObservationPoint(String provider, Coordinate pointGPS, int wifis... | ObservationPoint implements AsyncGeolocate.MLSLocationGetterCallback { public void setCounts(MLSJSONObject ichnaeaQueryObj) { mCellCount = ichnaeaQueryObj.getCellCount(); mWifiCount = ichnaeaQueryObj.getWifiCount(); } ObservationPoint(Location pointGPS); ObservationPoint(String provider, Coordinate pointGPS, int wifis... | ObservationPoint implements AsyncGeolocate.MLSLocationGetterCallback { public void setCounts(MLSJSONObject ichnaeaQueryObj) { mCellCount = ichnaeaQueryObj.getCellCount(); mWifiCount = ichnaeaQueryObj.getWifiCount(); } ObservationPoint(Location pointGPS); ObservationPoint(String provider, Coordinate pointGPS, int wifis... |
@Test @Config(shadows = {CustomShadowConnectivityManager.class}) public void testMapNetworkConnectionChanged() { MapFragment mapFragment = spy(MapFragment.class); doNothing().when(mapFragment).doOnCreateView(any(Bundle.class)); doNothing().when(mapFragment).getUrlAndInit(); doNothing().when(mapFragment).setHighBandwidt... | public void mapNetworkConnectionChanged() { FragmentActivity activity = getActivity(); if (activity == null) { return; } if (activity.getFilesDir() == null) { showMapNotAvailableMessage(NoMapAvailableMessage.eNoMapDueToNoAccessibleStorage); return; } getUrlAndInit(); final ConnectivityManager cm = (ConnectivityManager)... | MapFragment extends android.support.v4.app.Fragment implements MetricsView.IMapLayerToggleListener { public void mapNetworkConnectionChanged() { FragmentActivity activity = getActivity(); if (activity == null) { return; } if (activity.getFilesDir() == null) { showMapNotAvailableMessage(NoMapAvailableMessage.eNoMapDueTo... | MapFragment extends android.support.v4.app.Fragment implements MetricsView.IMapLayerToggleListener { public void mapNetworkConnectionChanged() { FragmentActivity activity = getActivity(); if (activity == null) { return; } if (activity.getFilesDir() == null) { showMapNotAvailableMessage(NoMapAvailableMessage.eNoMapDueTo... | MapFragment extends android.support.v4.app.Fragment implements MetricsView.IMapLayerToggleListener { public void mapNetworkConnectionChanged() { FragmentActivity activity = getActivity(); if (activity == null) { return; } if (activity.getFilesDir() == null) { showMapNotAvailableMessage(NoMapAvailableMessage.eNoMapDueTo... | MapFragment extends android.support.v4.app.Fragment implements MetricsView.IMapLayerToggleListener { public void mapNetworkConnectionChanged() { FragmentActivity activity = getActivity(); if (activity == null) { return; } if (activity.getFilesDir() == null) { showMapNotAvailableMessage(NoMapAvailableMessage.eNoMapDueTo... |
@Test public void testLoadTileMissingFile() throws IOException { File temp = File.createTempFile("temp", ".txt"); String path = temp.getAbsolutePath(); temp.delete(); SerializableTile newTile = new SerializableTile(new File(path)); assertEquals(0, newTile.getTileData().length); } | public byte[] getTileData() { return (tData == null)? new byte[0] : tData; } | SerializableTile { public byte[] getTileData() { return (tData == null)? new byte[0] : tData; } } | SerializableTile { public byte[] getTileData() { return (tData == null)? new byte[0] : tData; } SerializableTile(File sTileFile); SerializableTile(byte[] tileBytes, String etag); } | SerializableTile { public byte[] getTileData() { return (tData == null)? new byte[0] : tData; } SerializableTile(File sTileFile); SerializableTile(byte[] tileBytes, String etag); static String bytesToHex(byte[] bytes); byte[] getTileData(); void setTileData(byte[] tileData); void clearHeaders(); Map<String, String> ge... | SerializableTile { public byte[] getTileData() { return (tData == null)? new byte[0] : tData; } SerializableTile(File sTileFile); SerializableTile(byte[] tileBytes, String etag); static String bytesToHex(byte[] bytes); byte[] getTileData(); void setTileData(byte[] tileData); void clearHeaders(); Map<String, String> ge... |
@Test public void testLoadTileValidHeaderNoData() throws IOException { File temp = File.createTempFile("temp", ".txt"); FileOutputStream fos = new FileOutputStream(temp); byte[] tileData = {(byte) 0xde, (byte) 0xca, (byte) 0xfb, (byte) 0xad}; fos.write(tileData); fos.flush(); fos.close(); assertTrue(temp.exists()); Ser... | public byte[] getTileData() { return (tData == null)? new byte[0] : tData; } | SerializableTile { public byte[] getTileData() { return (tData == null)? new byte[0] : tData; } } | SerializableTile { public byte[] getTileData() { return (tData == null)? new byte[0] : tData; } SerializableTile(File sTileFile); SerializableTile(byte[] tileBytes, String etag); } | SerializableTile { public byte[] getTileData() { return (tData == null)? new byte[0] : tData; } SerializableTile(File sTileFile); SerializableTile(byte[] tileBytes, String etag); static String bytesToHex(byte[] bytes); byte[] getTileData(); void setTileData(byte[] tileData); void clearHeaders(); Map<String, String> ge... | SerializableTile { public byte[] getTileData() { return (tData == null)? new byte[0] : tData; } SerializableTile(File sTileFile); SerializableTile(byte[] tileBytes, String etag); static String bytesToHex(byte[] bytes); byte[] getTileData(); void setTileData(byte[] tileData); void clearHeaders(); Map<String, String> ge... |
@Test public void testLoadTileInvalidPayload() throws IOException { File temp = File.createTempFile("temp", ".txt"); FileOutputStream fos = new FileOutputStream(temp); byte[] tileData = {(byte) 0xde, (byte) 0xca, (byte) 0xfb, (byte) 0xad, (byte) 0xaf, (byte) 0xad, (byte) 0xaf, (byte) 0xad, (byte) 0xaf, (byte) 0xad, (by... | public byte[] getTileData() { return (tData == null)? new byte[0] : tData; } | SerializableTile { public byte[] getTileData() { return (tData == null)? new byte[0] : tData; } } | SerializableTile { public byte[] getTileData() { return (tData == null)? new byte[0] : tData; } SerializableTile(File sTileFile); SerializableTile(byte[] tileBytes, String etag); } | SerializableTile { public byte[] getTileData() { return (tData == null)? new byte[0] : tData; } SerializableTile(File sTileFile); SerializableTile(byte[] tileBytes, String etag); static String bytesToHex(byte[] bytes); byte[] getTileData(); void setTileData(byte[] tileData); void clearHeaders(); Map<String, String> ge... | SerializableTile { public byte[] getTileData() { return (tData == null)? new byte[0] : tData; } SerializableTile(File sTileFile); SerializableTile(byte[] tileBytes, String etag); static String bytesToHex(byte[] bytes); byte[] getTileData(); void setTileData(byte[] tileData); void clearHeaders(); Map<String, String> ge... |
@Test public void shouldBeNull_whenInputLocalDateIsNull_ofConvert2Date() { LocalDate input = null; Date output = DateConverterUtils.convert2Date(input); Date expected = null; assertThat(output).isEqualTo(expected); } | public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } | DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } } | DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } private DateConverterUtils(); } | DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } private DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDateTime); static LocalDateTime c... | DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } private DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDateTime); static LocalDateTime c... |
@Test public void shouldBeOk_whenEncodeHelloString() { String input = "hello"; String output = Base64Utils.encode(input); String expected = "aGVsbG8="; assertThat(output).isEqualTo(expected); } | public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } | Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } } | Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } private Base64Utils(); } | Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String decode(byte[] data); static String decode(String data); } | Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String decode(byte[] data); static String decode(String data); } |
@Test public void shouldBeOk_whenEncodeHelloByte() { byte[] input = "hello".getBytes(); String output = Base64Utils.encode(input); String expected = "aGVsbG8="; assertThat(output).isEqualTo(expected); } | public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } | Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } } | Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } private Base64Utils(); } | Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String decode(byte[] data); static String decode(String data); } | Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String decode(byte[] data); static String decode(String data); } |
@Test public void shouldBeNull_whenDecodeNullString() { String input = null; String output = Base64Utils.decode(input); String expected = null; assertThat(output).isEqualTo(expected); } | public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String deco... | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String deco... |
@Test public void shouldBeNull_whenDecodeNullByte() { byte[] input = null; String output = Base64Utils.decode(input); String expected = null; assertThat(output).isEqualTo(expected); } | public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String deco... | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String deco... |
@Test public void shouldBeNull_whenDecodeInvalidString() { String input = "aGVsbG8=xxxx"; String output = Base64Utils.decode(input); String expected = null; assertThat(output).isEqualTo(expected); } | public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String deco... | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String deco... |
@Test public void shouldBeNull_whenDecodeInvalidByte() { byte[] input = "aGVsbG8=xxxx".getBytes(); String output = Base64Utils.decode(input); String expected = null; assertThat(output).isEqualTo(expected); } | public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String deco... | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String deco... |
@Test public void shouldBeOk_whenDecodeHelloString() { String input = "aGVsbG8="; String output = Base64Utils.decode(input); String expected = "hello"; assertThat(output).isEqualTo(expected); } | public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String deco... | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String deco... |
@Test public void shouldBeOk_whenDecodeHelloByte() { byte[] input = "aGVsbG8=".getBytes(); String output = Base64Utils.decode(input); String expected = "hello"; assertThat(output).isEqualTo(expected); } | public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); } | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String deco... | Base64Utils { public static String decode(byte[] data) { if (data == null) { return null; } try { return new String(Base64.getDecoder().decode(data)); } catch (IllegalArgumentException ex) { return null; } } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String deco... |
@Test public void shouldBeOk_whenHaveOnlyKeyValue() { String output = new CookieSpecBuilder("X-CSRF-Token", "xyz").build(); String expected = "X-CSRF-Token=xyz; Path=/; HttpOnly"; assertThat(output).isEqualTo(expected); } | public String build() { List<String> builder = new ArrayList<>(); builder.add(String.format("%s=%s", getKey(), getValue())); if (hasText(getPath())) { builder.add(String.format("Path=%s", getPath())); } if (Objects.equals(Boolean.TRUE, getHttpOnly())) { builder.add("HttpOnly"); } if (hasText(getSameSite())) { builder.a... | CookieSpecBuilder { public String build() { List<String> builder = new ArrayList<>(); builder.add(String.format("%s=%s", getKey(), getValue())); if (hasText(getPath())) { builder.add(String.format("Path=%s", getPath())); } if (Objects.equals(Boolean.TRUE, getHttpOnly())) { builder.add("HttpOnly"); } if (hasText(getSame... | CookieSpecBuilder { public String build() { List<String> builder = new ArrayList<>(); builder.add(String.format("%s=%s", getKey(), getValue())); if (hasText(getPath())) { builder.add(String.format("Path=%s", getPath())); } if (Objects.equals(Boolean.TRUE, getHttpOnly())) { builder.add("HttpOnly"); } if (hasText(getSame... | CookieSpecBuilder { public String build() { List<String> builder = new ArrayList<>(); builder.add(String.format("%s=%s", getKey(), getValue())); if (hasText(getPath())) { builder.add(String.format("Path=%s", getPath())); } if (Objects.equals(Boolean.TRUE, getHttpOnly())) { builder.add("HttpOnly"); } if (hasText(getSame... | CookieSpecBuilder { public String build() { List<String> builder = new ArrayList<>(); builder.add(String.format("%s=%s", getKey(), getValue())); if (hasText(getPath())) { builder.add(String.format("Path=%s", getPath())); } if (Objects.equals(Boolean.TRUE, getHttpOnly())) { builder.add("HttpOnly"); } if (hasText(getSame... |
@Test public void shouldBeEmptyString_whenEmptyParameter() { QuerystringBuilder input = new QuerystringBuilder(); String output = input.build(); String expected = ""; assertThat(output).isEqualTo(expected); } | public String build() { return getParams().entrySet() .stream() .map(param -> param.getKey() + "=" + encode(param.getValue())) .collect(Collectors.joining("&")); } | QuerystringBuilder { public String build() { return getParams().entrySet() .stream() .map(param -> param.getKey() + "=" + encode(param.getValue())) .collect(Collectors.joining("&")); } } | QuerystringBuilder { public String build() { return getParams().entrySet() .stream() .map(param -> param.getKey() + "=" + encode(param.getValue())) .collect(Collectors.joining("&")); } } | QuerystringBuilder { public String build() { return getParams().entrySet() .stream() .map(param -> param.getKey() + "=" + encode(param.getValue())) .collect(Collectors.joining("&")); } QuerystringBuilder addParameter(String name, String value); String build(); } | QuerystringBuilder { public String build() { return getParams().entrySet() .stream() .map(param -> param.getKey() + "=" + encode(param.getValue())) .collect(Collectors.joining("&")); } QuerystringBuilder addParameter(String name, String value); String build(); } |
@Test public void shouldBeOk_whenInputLocalDateIs20170101T010101_ofConvert2Date() { LocalDate input = createLocalDate("2017-01-01T01:01:01"); Date output = DateConverterUtils.convert2Date(input); Date expected = createDate("2017-01-01T00:00:00"); assertThat(output).isEqualTo(expected); } | public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } | DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } } | DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } private DateConverterUtils(); } | DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } private DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDateTime); static LocalDateTime c... | DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } private DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDateTime); static LocalDateTime c... |
@Test public void test() { String output = generator.generate(); int expected = 36; assertThat(output.length()).isEqualTo(expected); } | @Override public String generate() { return UUID.randomUUID().toString(); } | DefaultUUIDGenerator implements UUIDGenerator { @Override public String generate() { return UUID.randomUUID().toString(); } } | DefaultUUIDGenerator implements UUIDGenerator { @Override public String generate() { return UUID.randomUUID().toString(); } } | DefaultUUIDGenerator implements UUIDGenerator { @Override public String generate() { return UUID.randomUUID().toString(); } @Override String generate(); } | DefaultUUIDGenerator implements UUIDGenerator { @Override public String generate() { return UUID.randomUUID().toString(); } @Override String generate(); } |
@Test public void test() { String output = generator.generate(); int expected = 24; assertThat(output.length()).isEqualTo(expected); } | @Override public String generate() { return ObjectId.get().toString(); } | DefaultIdGenerator implements IdGenerator { @Override public String generate() { return ObjectId.get().toString(); } } | DefaultIdGenerator implements IdGenerator { @Override public String generate() { return ObjectId.get().toString(); } } | DefaultIdGenerator implements IdGenerator { @Override public String generate() { return ObjectId.get().toString(); } @Override String generate(); } | DefaultIdGenerator implements IdGenerator { @Override public String generate() { return ObjectId.get().toString(); } @Override String generate(); } |
@Test public void shouldBeSingleElement() { Collection<? extends GrantedAuthority> output = userDetails.getAuthorities(); int expected = 1; assertThat(output.size()).isEqualTo(expected); assertThat(output.iterator().next().getAuthority()).isEqualTo("admin"); } | @Override public Collection<? extends GrantedAuthority> getAuthorities() { return authorities().stream() .map(SimpleGrantedAuthority::new) .collect(Collectors.toList()); } | DefaultUserDetails implements UserDetails { @Override public Collection<? extends GrantedAuthority> getAuthorities() { return authorities().stream() .map(SimpleGrantedAuthority::new) .collect(Collectors.toList()); } } | DefaultUserDetails implements UserDetails { @Override public Collection<? extends GrantedAuthority> getAuthorities() { return authorities().stream() .map(SimpleGrantedAuthority::new) .collect(Collectors.toList()); } } | DefaultUserDetails implements UserDetails { @Override public Collection<? extends GrantedAuthority> getAuthorities() { return authorities().stream() .map(SimpleGrantedAuthority::new) .collect(Collectors.toList()); } @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override String getPassword(); @Ove... | DefaultUserDetails implements UserDetails { @Override public Collection<? extends GrantedAuthority> getAuthorities() { return authorities().stream() .map(SimpleGrantedAuthority::new) .collect(Collectors.toList()); } @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override String getPassword(); @Ove... |
@Test public void shouldBeTrue_whenIsAccountNonExpired() { boolean output = userDetails.isAccountNonExpired(); boolean expected = true; assertThat(output).isEqualTo(expected); } | @Override public boolean isAccountNonExpired() { return true; } | DefaultUserDetails implements UserDetails { @Override public boolean isAccountNonExpired() { return true; } } | DefaultUserDetails implements UserDetails { @Override public boolean isAccountNonExpired() { return true; } } | DefaultUserDetails implements UserDetails { @Override public boolean isAccountNonExpired() { return true; } @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override String getPassword(); @Override String getUsername(); @Override boolean isAccountNonExpired(); @Override boolean isAccountNonLocked();... | DefaultUserDetails implements UserDetails { @Override public boolean isAccountNonExpired() { return true; } @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override String getPassword(); @Override String getUsername(); @Override boolean isAccountNonExpired(); @Override boolean isAccountNonLocked();... |
@Test public void shouldBeTrue_whenIsAccountNonLocked() { boolean output = userDetails.isAccountNonLocked(); boolean expected = true; assertThat(output).isEqualTo(expected); } | @Override public boolean isAccountNonLocked() { return true; } | DefaultUserDetails implements UserDetails { @Override public boolean isAccountNonLocked() { return true; } } | DefaultUserDetails implements UserDetails { @Override public boolean isAccountNonLocked() { return true; } } | DefaultUserDetails implements UserDetails { @Override public boolean isAccountNonLocked() { return true; } @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override String getPassword(); @Override String getUsername(); @Override boolean isAccountNonExpired(); @Override boolean isAccountNonLocked(); ... | DefaultUserDetails implements UserDetails { @Override public boolean isAccountNonLocked() { return true; } @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override String getPassword(); @Override String getUsername(); @Override boolean isAccountNonExpired(); @Override boolean isAccountNonLocked(); ... |
@Test public void shouldBeTrue_whenIsCredentialsNonExpired() { boolean output = userDetails.isCredentialsNonExpired(); boolean expected = true; assertThat(output).isEqualTo(expected); } | @Override public boolean isCredentialsNonExpired() { return true; } | DefaultUserDetails implements UserDetails { @Override public boolean isCredentialsNonExpired() { return true; } } | DefaultUserDetails implements UserDetails { @Override public boolean isCredentialsNonExpired() { return true; } } | DefaultUserDetails implements UserDetails { @Override public boolean isCredentialsNonExpired() { return true; } @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override String getPassword(); @Override String getUsername(); @Override boolean isAccountNonExpired(); @Override boolean isAccountNonLocke... | DefaultUserDetails implements UserDetails { @Override public boolean isCredentialsNonExpired() { return true; } @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override String getPassword(); @Override String getUsername(); @Override boolean isAccountNonExpired(); @Override boolean isAccountNonLocke... |
@Test public void shouldBeTrue_whenIsEnabled() { boolean output = userDetails.isEnabled(); boolean expected = true; assertThat(output).isEqualTo(expected); } | @Override public boolean isEnabled() { return true; } | DefaultUserDetails implements UserDetails { @Override public boolean isEnabled() { return true; } } | DefaultUserDetails implements UserDetails { @Override public boolean isEnabled() { return true; } } | DefaultUserDetails implements UserDetails { @Override public boolean isEnabled() { return true; } @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override String getPassword(); @Override String getUsername(); @Override boolean isAccountNonExpired(); @Override boolean isAccountNonLocked(); @Override... | DefaultUserDetails implements UserDetails { @Override public boolean isEnabled() { return true; } @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override String getPassword(); @Override String getUsername(); @Override boolean isAccountNonExpired(); @Override boolean isAccountNonLocked(); @Override... |
@Test public void shouldBeMinus1405401465_whenCallHashCode() { int output = userDetails.hashCode(); int expected = -1405401465; assertThat(output).isEqualTo(expected); } | @Override public int hashCode() { int hash = 5; return 89 * hash + Objects.hashCode(this.username); } | DefaultUserDetails implements UserDetails { @Override public int hashCode() { int hash = 5; return 89 * hash + Objects.hashCode(this.username); } } | DefaultUserDetails implements UserDetails { @Override public int hashCode() { int hash = 5; return 89 * hash + Objects.hashCode(this.username); } } | DefaultUserDetails implements UserDetails { @Override public int hashCode() { int hash = 5; return 89 * hash + Objects.hashCode(this.username); } @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override String getPassword(); @Override String getUsername(); @Override boolean isAccountNonExpired(); @... | DefaultUserDetails implements UserDetails { @Override public int hashCode() { int hash = 5; return 89 * hash + Objects.hashCode(this.username); } @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override String getPassword(); @Override String getUsername(); @Override boolean isAccountNonExpired(); @... |
@Test public void shouldBeFalse_whenNotEqualsUsername() { UserDetails obj = DefaultUserDetails.builder() .username("admin") .build(); boolean output = userDetails.equals(obj); boolean expected = false; assertThat(output).isEqualTo(expected); } | @Override public boolean equals(Object obj) { return ObjectEquals.of(this) .equals(obj, (orgin, other) -> Objects.equals(orgin.getUsername(), other.getUsername())); } | DefaultUserDetails implements UserDetails { @Override public boolean equals(Object obj) { return ObjectEquals.of(this) .equals(obj, (orgin, other) -> Objects.equals(orgin.getUsername(), other.getUsername())); } } | DefaultUserDetails implements UserDetails { @Override public boolean equals(Object obj) { return ObjectEquals.of(this) .equals(obj, (orgin, other) -> Objects.equals(orgin.getUsername(), other.getUsername())); } } | DefaultUserDetails implements UserDetails { @Override public boolean equals(Object obj) { return ObjectEquals.of(this) .equals(obj, (orgin, other) -> Objects.equals(orgin.getUsername(), other.getUsername())); } @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override String getPassword(); @Override... | DefaultUserDetails implements UserDetails { @Override public boolean equals(Object obj) { return ObjectEquals.of(this) .equals(obj, (orgin, other) -> Objects.equals(orgin.getUsername(), other.getUsername())); } @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override String getPassword(); @Override... |
@Test public void shouldBeTrue_whenEqualsUsername() { UserDetails obj = DefaultUserDetails.builder() .username("jittagornp") .build(); boolean output = userDetails.equals(obj); boolean expected = true; assertThat(output).isEqualTo(expected); } | @Override public boolean equals(Object obj) { return ObjectEquals.of(this) .equals(obj, (orgin, other) -> Objects.equals(orgin.getUsername(), other.getUsername())); } | DefaultUserDetails implements UserDetails { @Override public boolean equals(Object obj) { return ObjectEquals.of(this) .equals(obj, (orgin, other) -> Objects.equals(orgin.getUsername(), other.getUsername())); } } | DefaultUserDetails implements UserDetails { @Override public boolean equals(Object obj) { return ObjectEquals.of(this) .equals(obj, (orgin, other) -> Objects.equals(orgin.getUsername(), other.getUsername())); } } | DefaultUserDetails implements UserDetails { @Override public boolean equals(Object obj) { return ObjectEquals.of(this) .equals(obj, (orgin, other) -> Objects.equals(orgin.getUsername(), other.getUsername())); } @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override String getPassword(); @Override... | DefaultUserDetails implements UserDetails { @Override public boolean equals(Object obj) { return ObjectEquals.of(this) .equals(obj, (orgin, other) -> Objects.equals(orgin.getUsername(), other.getUsername())); } @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override String getPassword(); @Override... |
@Test public void shouldBeNull_whenInputLocalDateTimeIsNull_ofConvert2Date() { LocalDateTime input = null; Date output = DateConverterUtils.convert2Date(input); Date expected = null; assertThat(output).isEqualTo(expected); } | public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } | DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } } | DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } private DateConverterUtils(); } | DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } private DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDateTime); static LocalDateTime c... | DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } private DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDateTime); static LocalDateTime c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.