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 testGetParent() throws Exception { Box b1 = isoFile.getMovieBox().getBoxes(TrackBox.class).get(1).getSampleTableBox().getTimeToSampleBox(); Assert.assertEquals(isoFile.getMovieBox().getBoxes(TrackBox.class).get(1).getSampleTableBox(), Path.getPath(b1, "..")); } | public static Box getPath(Box box, String path) { List<? extends Box> all = getPaths(box, path, true); return all.isEmpty() ? null : all.get(0); } | Path { public static Box getPath(Box box, String path) { List<? extends Box> all = getPaths(box, path, true); return all.isEmpty() ? null : all.get(0); } } | Path { public static Box getPath(Box box, String path) { List<? extends Box> all = getPaths(box, path, true); return all.isEmpty() ? null : all.get(0); } private Path(); } | Path { public static Box getPath(Box box, String path) { List<? extends Box> all = getPaths(box, path, true); return all.isEmpty() ? null : all.get(0); } private Path(); static String createPath(Box box); static Box getPath(Box box, String path); static List<Box> getPaths(Box box, String path); static List<Box> getPat... | Path { public static Box getPath(Box box, String path) { List<? extends Box> all = getPaths(box, path, true); return all.isEmpty() ? null : all.get(0); } private Path(); static String createPath(Box box); static Box getPath(Box box, String path); static List<Box> getPaths(Box box, String path); static List<Box> getPat... |
@Test public void testGetDecodingTimeEntries() throws Exception { LinkedList<TimeToSampleBox.Entry> e = new LinkedList<TimeToSampleBox.Entry>(); e.add(new TimeToSampleBox.Entry(2, 3)); e.add(new TimeToSampleBox.Entry(3, 4)); e.add(new TimeToSampleBox.Entry(3, 5)); e.add(new TimeToSampleBox.Entry(2, 6)); List<TimeToSamp... | public List<TimeToSampleBox.Entry> getDecodingTimeEntries() { return getDecodingTimeEntries(origTrack.getDecodingTimeEntries(), fromSample, toSample); } | CroppedTrack extends AbstractTrack { public List<TimeToSampleBox.Entry> getDecodingTimeEntries() { return getDecodingTimeEntries(origTrack.getDecodingTimeEntries(), fromSample, toSample); } } | CroppedTrack extends AbstractTrack { public List<TimeToSampleBox.Entry> getDecodingTimeEntries() { return getDecodingTimeEntries(origTrack.getDecodingTimeEntries(), fromSample, toSample); } CroppedTrack(Track origTrack, long fromSample, long toSample); } | CroppedTrack extends AbstractTrack { public List<TimeToSampleBox.Entry> getDecodingTimeEntries() { return getDecodingTimeEntries(origTrack.getDecodingTimeEntries(), fromSample, toSample); } CroppedTrack(Track origTrack, long fromSample, long toSample); List<ByteBuffer> getSamples(); SampleDescriptionBox getSampleDescri... | CroppedTrack extends AbstractTrack { public List<TimeToSampleBox.Entry> getDecodingTimeEntries() { return getDecodingTimeEntries(origTrack.getDecodingTimeEntries(), fromSample, toSample); } CroppedTrack(Track origTrack, long fromSample, long toSample); List<ByteBuffer> getSamples(); SampleDescriptionBox getSampleDescri... |
@Test public void testGetCompositionTimes() throws Exception { LinkedList<CompositionTimeToSample.Entry> e = new LinkedList<CompositionTimeToSample.Entry>(); e.add(new CompositionTimeToSample.Entry(2, 3)); e.add(new CompositionTimeToSample.Entry(3, 4)); e.add(new CompositionTimeToSample.Entry(3, 5)); e.add(new Composit... | public List<CompositionTimeToSample.Entry> getCompositionTimeEntries() { return getCompositionTimeEntries(origTrack.getCompositionTimeEntries(), fromSample, toSample); } | CroppedTrack extends AbstractTrack { public List<CompositionTimeToSample.Entry> getCompositionTimeEntries() { return getCompositionTimeEntries(origTrack.getCompositionTimeEntries(), fromSample, toSample); } } | CroppedTrack extends AbstractTrack { public List<CompositionTimeToSample.Entry> getCompositionTimeEntries() { return getCompositionTimeEntries(origTrack.getCompositionTimeEntries(), fromSample, toSample); } CroppedTrack(Track origTrack, long fromSample, long toSample); } | CroppedTrack extends AbstractTrack { public List<CompositionTimeToSample.Entry> getCompositionTimeEntries() { return getCompositionTimeEntries(origTrack.getCompositionTimeEntries(), fromSample, toSample); } CroppedTrack(Track origTrack, long fromSample, long toSample); List<ByteBuffer> getSamples(); SampleDescriptionBo... | CroppedTrack extends AbstractTrack { public List<CompositionTimeToSample.Entry> getCompositionTimeEntries() { return getCompositionTimeEntries(origTrack.getCompositionTimeEntries(), fromSample, toSample); } CroppedTrack(Track origTrack, long fromSample, long toSample); List<ByteBuffer> getSamples(); SampleDescriptionBo... |
@Test public void testSimple() throws IOException { long l = 0x11223344; SampleFlags sf = new SampleFlags(ByteBuffer.wrap(new byte[]{0x11, 0x22, 0x33, 0x44})); ByteBuffer b = ByteBuffer.allocate(4); sf.getContent(b); b.rewind(); Assert.assertEquals(l, IsoTypeReader.readUInt32(b)); } | public void getContent(ByteBuffer os) { BitWriterBuffer bitWriterBuffer = new BitWriterBuffer(os); bitWriterBuffer.writeBits(reserved, 6); bitWriterBuffer.writeBits(sampleDependsOn, 2); bitWriterBuffer.writeBits(sampleIsDependedOn, 2); bitWriterBuffer.writeBits(sampleHasRedundancy, 2); bitWriterBuffer.writeBits(sampleP... | SampleFlags { public void getContent(ByteBuffer os) { BitWriterBuffer bitWriterBuffer = new BitWriterBuffer(os); bitWriterBuffer.writeBits(reserved, 6); bitWriterBuffer.writeBits(sampleDependsOn, 2); bitWriterBuffer.writeBits(sampleIsDependedOn, 2); bitWriterBuffer.writeBits(sampleHasRedundancy, 2); bitWriterBuffer.wri... | SampleFlags { public void getContent(ByteBuffer os) { BitWriterBuffer bitWriterBuffer = new BitWriterBuffer(os); bitWriterBuffer.writeBits(reserved, 6); bitWriterBuffer.writeBits(sampleDependsOn, 2); bitWriterBuffer.writeBits(sampleIsDependedOn, 2); bitWriterBuffer.writeBits(sampleHasRedundancy, 2); bitWriterBuffer.wri... | SampleFlags { public void getContent(ByteBuffer os) { BitWriterBuffer bitWriterBuffer = new BitWriterBuffer(os); bitWriterBuffer.writeBits(reserved, 6); bitWriterBuffer.writeBits(sampleDependsOn, 2); bitWriterBuffer.writeBits(sampleIsDependedOn, 2); bitWriterBuffer.writeBits(sampleHasRedundancy, 2); bitWriterBuffer.wri... | SampleFlags { public void getContent(ByteBuffer os) { BitWriterBuffer bitWriterBuffer = new BitWriterBuffer(os); bitWriterBuffer.writeBits(reserved, 6); bitWriterBuffer.writeBits(sampleDependsOn, 2); bitWriterBuffer.writeBits(sampleIsDependedOn, 2); bitWriterBuffer.writeBits(sampleHasRedundancy, 2); bitWriterBuffer.wri... |
@Test public void testParse() throws Exception { SampleDependencyTypeBox stsc = new SampleDependencyTypeBox(); List<SampleDependencyTypeBox.Entry> l = new LinkedList<SampleDependencyTypeBox.Entry>(); for (int i = 0; i < 0xcf; i++) { SampleDependencyTypeBox.Entry e = new SampleDependencyTypeBox.Entry(i); l.add(e); } sts... | public void setEntries(List<Entry> entries) { this.entries = entries; } | SampleDependencyTypeBox extends AbstractFullBox { public void setEntries(List<Entry> entries) { this.entries = entries; } } | SampleDependencyTypeBox extends AbstractFullBox { public void setEntries(List<Entry> entries) { this.entries = entries; } SampleDependencyTypeBox(); } | SampleDependencyTypeBox extends AbstractFullBox { public void setEntries(List<Entry> entries) { this.entries = entries; } SampleDependencyTypeBox(); @Override void _parseDetails(ByteBuffer content); List<Entry> getEntries(); void setEntries(List<Entry> entries); @Override String toString(); } | SampleDependencyTypeBox extends AbstractFullBox { public void setEntries(List<Entry> entries) { this.entries = entries; } SampleDependencyTypeBox(); @Override void _parseDetails(ByteBuffer content); List<Entry> getEntries(); void setEntries(List<Entry> entries); @Override String toString(); static final String TYPE; } |
@Test public void testGotAll() throws IOException { String input = SampleListTest.class.getProtectionDomain().getCodeSource().getLocation().getFile() + "/Beethoven - Bagatelle op.119 no.11 i.m4a"; IsoFile isoFile = new IsoFile(input); TrackBox tb = isoFile.getBoxes(MovieBox.class).get(0).getBoxes(TrackBox.class).get(0)... | @Override public ByteBuffer get(int index) { long offset = offsets[index]; int sampleSize = l2i(sizes[index]); for (MediaDataBox mediaDataBox : mdats) { if ((mediaDataBox.getDataStartPosition() <= offset) && (offset + sampleSize <= mediaDataBox.getDataEndPosition())) { return mediaDataBox.getContent(offset - mediaDataB... | SampleList extends AbstractList<ByteBuffer> { @Override public ByteBuffer get(int index) { long offset = offsets[index]; int sampleSize = l2i(sizes[index]); for (MediaDataBox mediaDataBox : mdats) { if ((mediaDataBox.getDataStartPosition() <= offset) && (offset + sampleSize <= mediaDataBox.getDataEndPosition())) { retu... | SampleList extends AbstractList<ByteBuffer> { @Override public ByteBuffer get(int index) { long offset = offsets[index]; int sampleSize = l2i(sizes[index]); for (MediaDataBox mediaDataBox : mdats) { if ((mediaDataBox.getDataStartPosition() <= offset) && (offset + sampleSize <= mediaDataBox.getDataEndPosition())) { retu... | SampleList extends AbstractList<ByteBuffer> { @Override public ByteBuffer get(int index) { long offset = offsets[index]; int sampleSize = l2i(sizes[index]); for (MediaDataBox mediaDataBox : mdats) { if ((mediaDataBox.getDataStartPosition() <= offset) && (offset + sampleSize <= mediaDataBox.getDataEndPosition())) { retu... | SampleList extends AbstractList<ByteBuffer> { @Override public ByteBuffer get(int index) { long offset = offsets[index]; int sampleSize = l2i(sizes[index]); for (MediaDataBox mediaDataBox : mdats) { if ((mediaDataBox.getDataStartPosition() <= offset) && (offset + sampleSize <= mediaDataBox.getDataEndPosition())) { retu... |
@Test public void testFixedPoint1616() throws IOException { final double fixedPointTest1 = 10.13; final double fixedPointTest2 = -10.13; ByteBuffer bb = ByteBuffer.allocate(8); IsoTypeWriter.writeFixedPoint1616(bb, fixedPointTest1); IsoTypeWriter.writeFixedPoint1616(bb, fixedPointTest2); bb.rewind(); Assert.assertEqual... | public static double readFixedPoint1616(ByteBuffer bb) { byte[] bytes = new byte[4]; bb.get(bytes); int result = 0; result |= ((bytes[0] << 24) & 0xFF000000); result |= ((bytes[1] << 16) & 0xFF0000); result |= ((bytes[2] << 8) & 0xFF00); result |= ((bytes[3]) & 0xFF); return ((double) result) / 65536; } | IsoTypeReader { public static double readFixedPoint1616(ByteBuffer bb) { byte[] bytes = new byte[4]; bb.get(bytes); int result = 0; result |= ((bytes[0] << 24) & 0xFF000000); result |= ((bytes[1] << 16) & 0xFF0000); result |= ((bytes[2] << 8) & 0xFF00); result |= ((bytes[3]) & 0xFF); return ((double) result) / 65536; }... | IsoTypeReader { public static double readFixedPoint1616(ByteBuffer bb) { byte[] bytes = new byte[4]; bb.get(bytes); int result = 0; result |= ((bytes[0] << 24) & 0xFF000000); result |= ((bytes[1] << 16) & 0xFF0000); result |= ((bytes[2] << 8) & 0xFF00); result |= ((bytes[3]) & 0xFF); return ((double) result) / 65536; }... | IsoTypeReader { public static double readFixedPoint1616(ByteBuffer bb) { byte[] bytes = new byte[4]; bb.get(bytes); int result = 0; result |= ((bytes[0] << 24) & 0xFF000000); result |= ((bytes[1] << 16) & 0xFF0000); result |= ((bytes[2] << 8) & 0xFF00); result |= ((bytes[3]) & 0xFF); return ((double) result) / 65536; }... | IsoTypeReader { public static double readFixedPoint1616(ByteBuffer bb) { byte[] bytes = new byte[4]; bb.get(bytes); int result = 0; result |= ((bytes[0] << 24) & 0xFF000000); result |= ((bytes[1] << 16) & 0xFF0000); result |= ((bytes[2] << 8) & 0xFF00); result |= ((bytes[3]) & 0xFF); return ((double) result) / 65536; }... |
@Test public void testFixedPoint0230() throws IOException { final double fixedPointTest1 = 1.13; final double fixedPointTest2 = -1.13; ByteBuffer bb = ByteBuffer.allocate(8); IsoTypeWriter.writeFixedPoint0230(bb, fixedPointTest1); IsoTypeWriter.writeFixedPoint0230(bb, fixedPointTest2); bb.rewind(); Assert.assertEquals(... | public static double readFixedPoint0230(ByteBuffer bb) { byte[] bytes = new byte[4]; bb.get(bytes); int result = 0; result |= ((bytes[0] << 24) & 0xFF000000); result |= ((bytes[1] << 16) & 0xFF0000); result |= ((bytes[2] << 8) & 0xFF00); result |= ((bytes[3]) & 0xFF); return ((double) result) / (1 << 30); } | IsoTypeReader { public static double readFixedPoint0230(ByteBuffer bb) { byte[] bytes = new byte[4]; bb.get(bytes); int result = 0; result |= ((bytes[0] << 24) & 0xFF000000); result |= ((bytes[1] << 16) & 0xFF0000); result |= ((bytes[2] << 8) & 0xFF00); result |= ((bytes[3]) & 0xFF); return ((double) result) / (1 << 30... | IsoTypeReader { public static double readFixedPoint0230(ByteBuffer bb) { byte[] bytes = new byte[4]; bb.get(bytes); int result = 0; result |= ((bytes[0] << 24) & 0xFF000000); result |= ((bytes[1] << 16) & 0xFF0000); result |= ((bytes[2] << 8) & 0xFF00); result |= ((bytes[3]) & 0xFF); return ((double) result) / (1 << 30... | IsoTypeReader { public static double readFixedPoint0230(ByteBuffer bb) { byte[] bytes = new byte[4]; bb.get(bytes); int result = 0; result |= ((bytes[0] << 24) & 0xFF000000); result |= ((bytes[1] << 16) & 0xFF0000); result |= ((bytes[2] << 8) & 0xFF00); result |= ((bytes[3]) & 0xFF); return ((double) result) / (1 << 30... | IsoTypeReader { public static double readFixedPoint0230(ByteBuffer bb) { byte[] bytes = new byte[4]; bb.get(bytes); int result = 0; result |= ((bytes[0] << 24) & 0xFF000000); result |= ((bytes[1] << 16) & 0xFF0000); result |= ((bytes[2] << 8) & 0xFF00); result |= ((bytes[3]) & 0xFF); return ((double) result) / (1 << 30... |
@Test public void testFixedPoint88() throws IOException { final double fixedPointTest1 = 10.13; final double fixedPointTest2 = -10.13; ByteBuffer bb = ByteBuffer.allocate(4); IsoTypeWriter.writeFixedPoint88(bb, fixedPointTest1); IsoTypeWriter.writeFixedPoint88(bb, fixedPointTest2); bb.rewind(); Assert.assertEquals("fix... | public static float readFixedPoint88(ByteBuffer bb) { byte[] bytes = new byte[2]; bb.get(bytes); short result = 0; result |= ((bytes[0] << 8) & 0xFF00); result |= ((bytes[1]) & 0xFF); return ((float) result) / 256; } | IsoTypeReader { public static float readFixedPoint88(ByteBuffer bb) { byte[] bytes = new byte[2]; bb.get(bytes); short result = 0; result |= ((bytes[0] << 8) & 0xFF00); result |= ((bytes[1]) & 0xFF); return ((float) result) / 256; } } | IsoTypeReader { public static float readFixedPoint88(ByteBuffer bb) { byte[] bytes = new byte[2]; bb.get(bytes); short result = 0; result |= ((bytes[0] << 8) & 0xFF00); result |= ((bytes[1]) & 0xFF); return ((float) result) / 256; } } | IsoTypeReader { public static float readFixedPoint88(ByteBuffer bb) { byte[] bytes = new byte[2]; bb.get(bytes); short result = 0; result |= ((bytes[0] << 8) & 0xFF00); result |= ((bytes[1]) & 0xFF); return ((float) result) / 256; } static long readUInt32BE(ByteBuffer bb); static long readUInt32(ByteBuffer bb); static... | IsoTypeReader { public static float readFixedPoint88(ByteBuffer bb) { byte[] bytes = new byte[2]; bb.get(bytes); short result = 0; result |= ((bytes[0] << 8) & 0xFF00); result |= ((bytes[1]) & 0xFF); return ((float) result) / 256; } static long readUInt32BE(ByteBuffer bb); static long readUInt32(ByteBuffer bb); static... |
@Test public void testRead4cc() throws IOException { ByteBuffer bb = ByteBuffer.wrap("abcd".getBytes()); String code = IsoTypeReader.read4cc(bb); Assert.assertEquals(4, bb.position()); Assert.assertEquals("abcd", code); } | public static String read4cc(ByteBuffer bb) { bb.get(codeBytes); int result = ((codeBytes[0] << 24) & 0xFF000000); result |= ((codeBytes[1] << 16) & 0xFF0000); result |= ((codeBytes[2] << 8) & 0xFF00); result |= ((codeBytes[3]) & 0xFF); String code; if ((code = (String) codeCache.get(result)) != null) { return code; } ... | IsoTypeReader { public static String read4cc(ByteBuffer bb) { bb.get(codeBytes); int result = ((codeBytes[0] << 24) & 0xFF000000); result |= ((codeBytes[1] << 16) & 0xFF0000); result |= ((codeBytes[2] << 8) & 0xFF00); result |= ((codeBytes[3]) & 0xFF); String code; if ((code = (String) codeCache.get(result)) != null) {... | IsoTypeReader { public static String read4cc(ByteBuffer bb) { bb.get(codeBytes); int result = ((codeBytes[0] << 24) & 0xFF000000); result |= ((codeBytes[1] << 16) & 0xFF0000); result |= ((codeBytes[2] << 8) & 0xFF00); result |= ((codeBytes[3]) & 0xFF); String code; if ((code = (String) codeCache.get(result)) != null) {... | IsoTypeReader { public static String read4cc(ByteBuffer bb) { bb.get(codeBytes); int result = ((codeBytes[0] << 24) & 0xFF000000); result |= ((codeBytes[1] << 16) & 0xFF0000); result |= ((codeBytes[2] << 8) & 0xFF00); result |= ((codeBytes[3]) & 0xFF); String code; if ((code = (String) codeCache.get(result)) != null) {... | IsoTypeReader { public static String read4cc(ByteBuffer bb) { bb.get(codeBytes); int result = ((codeBytes[0] << 24) & 0xFF000000); result |= ((codeBytes[1] << 16) & 0xFF0000); result |= ((codeBytes[2] << 8) & 0xFF00); result |= ((codeBytes[3]) & 0xFF); String code; if ((code = (String) codeCache.get(result)) != null) {... |
@Test public void testWriteWithinBuffer() { ByteBuffer b = ByteBuffer.allocate(2); b.put((byte) 0); BitWriterBuffer bwb = new BitWriterBuffer(b); bwb.writeBits(15, 4); Assert.assertEquals("0000000011110000", toString(b)); } | public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position % 8; if (numBits <... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... |
@Test public void testSimple() { ByteBuffer bb = ByteBuffer.allocate(4); BitWriterBuffer bitWriterBuffer = new BitWriterBuffer(bb); bitWriterBuffer.writeBits(15, 4); bb.rewind(); int test = IsoTypeReader.readUInt8(bb); Assert.assertEquals(15 << 4, test); } | public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position % 8; if (numBits <... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... |
@Test public void testSimpleOnByteBorder() { ByteBuffer bb = ByteBuffer.allocate(4); BitWriterBuffer bitWriterBuffer = new BitWriterBuffer(bb); bitWriterBuffer.writeBits(15, 4); bitWriterBuffer.writeBits(15, 4); bitWriterBuffer.writeBits(15, 4); bb.rewind(); int test = IsoTypeReader.readUInt8(bb); Assert.assertEquals(2... | public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position % 8; if (numBits <... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... |
@Test public void testSimpleCrossByteBorder() { ByteBuffer bb = ByteBuffer.allocate(2); BitWriterBuffer bitWriterBuffer = new BitWriterBuffer(bb); bitWriterBuffer.writeBits(1, 4); bitWriterBuffer.writeBits(1, 5); bitWriterBuffer.writeBits(1, 3); Assert.assertEquals("0001000010010000", toString(bb)); } | public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position % 8; if (numBits <... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... |
@Test public void testMultiByte() { ByteBuffer bb = ByteBuffer.allocate(4); BitWriterBuffer bitWriterBuffer = new BitWriterBuffer(bb); bitWriterBuffer.writeBits(0, 1); bitWriterBuffer.writeBits(65535, 16); bb.rewind(); int test = IsoTypeReader.readUInt8(bb); Assert.assertEquals(127, test); test = IsoTypeReader.readUInt... | public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position % 8; if (numBits <... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... |
@Test public void testPattern() { ByteBuffer bb = ByteBuffer.allocate(1); BitWriterBuffer bwb = new BitWriterBuffer(bb); bwb.writeBits(1, 1); bwb.writeBits(1, 2); bwb.writeBits(1, 3); bwb.writeBits(1, 2); Assert.assertEquals("10100101", toString(bb)); } | public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position % 8; if (numBits <... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... |
@Test public void testWriterReaderRoundTrip() { ByteBuffer b = ByteBuffer.allocate(3); BitWriterBuffer bwb = new BitWriterBuffer(b); bwb.writeBits(1, 1); bwb.writeBits(1, 2); bwb.writeBits(1, 3); bwb.writeBits(1, 4); bwb.writeBits(1, 5); bwb.writeBits(7, 6); b.rewind(); Assert.assertEquals("101001000100001000111000", t... | public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position % 8; if (numBits <... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... | BitWriterBuffer { public void writeBits(int i, int numBits) { assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " + "Please mask the value before writing it and make your code is really working as intended.", i, (1<<numBits)-1); int left = 8 - position ... |
@Test public void readFromTheMiddle() { ByteBuffer b = ByteBuffer.wrap(new byte[]{0, -1}); b.get(); BitReaderBuffer brb = new BitReaderBuffer(b); Assert.assertEquals(15, brb.readBits(4)); Assert.assertEquals(15, brb.readBits(4)); } | public int readBits(int i) { byte b = buffer.get(initialPos + position / 8); int v = b < 0 ? b + 256 : b; int left = 8 - position % 8; int rc; if (i <= left) { rc = (v << (position % 8) & 0xFF) >> ((position % 8) + (left - i)); position += i; } else { int now = left; int then = i - left; rc = readBits(now); rc = rc << ... | BitReaderBuffer { public int readBits(int i) { byte b = buffer.get(initialPos + position / 8); int v = b < 0 ? b + 256 : b; int left = 8 - position % 8; int rc; if (i <= left) { rc = (v << (position % 8) & 0xFF) >> ((position % 8) + (left - i)); position += i; } else { int now = left; int then = i - left; rc = readBits... | BitReaderBuffer { public int readBits(int i) { byte b = buffer.get(initialPos + position / 8); int v = b < 0 ? b + 256 : b; int left = 8 - position % 8; int rc; if (i <= left) { rc = (v << (position % 8) & 0xFF) >> ((position % 8) + (left - i)); position += i; } else { int now = left; int then = i - left; rc = readBits... | BitReaderBuffer { public int readBits(int i) { byte b = buffer.get(initialPos + position / 8); int v = b < 0 ? b + 256 : b; int left = 8 - position % 8; int rc; if (i <= left) { rc = (v << (position % 8) & 0xFF) >> ((position % 8) + (left - i)); position += i; } else { int now = left; int then = i - left; rc = readBits... | BitReaderBuffer { public int readBits(int i) { byte b = buffer.get(initialPos + position / 8); int v = b < 0 ? b + 256 : b; int left = 8 - position % 8; int rc; if (i <= left) { rc = (v << (position % 8) & 0xFF) >> ((position % 8) + (left - i)); position += i; } else { int now = left; int then = i - left; rc = readBits... |
@Test public void baseType() throws Exception { MultiValueMap<String, String> params = new LinkedMultiValueMap<>(16); params.add("age", "20"); String response = mockMvc.perform(get("/baseType") .contentType(APPLICATION_JSON_UTF8) .params(params)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsStri... | @RequestMapping(value = "/baseType") public String baseType(@RequestParam("age") int age) { return "age:" + age; } | BindController { @RequestMapping(value = "/baseType") public String baseType(@RequestParam("age") int age) { return "age:" + age; } } | BindController { @RequestMapping(value = "/baseType") public String baseType(@RequestParam("age") int age) { return "age:" + age; } } | BindController { @RequestMapping(value = "/baseType") public String baseType(@RequestParam("age") int age) { return "age:" + age; } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapping(value = "/array") ... | BindController { @RequestMapping(value = "/baseType") public String baseType(@RequestParam("age") int age) { return "age:" + age; } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapping(value = "/array") ... |
@Test public void date2() throws Exception { MultiValueMap<String, String> params = new LinkedMultiValueMap<>(16); params.add("date2", "2020-03-14"); String response = mockMvc.perform(get("/date2") .contentType(APPLICATION_JSON_UTF8) .params(params)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAs... | @RequestMapping(value = "date2") public String date2(Date date2) { return Objects.nonNull(date2) ? date2.toString() : "绑定date2参数失败,date2为null"; } | BindController { @RequestMapping(value = "date2") public String date2(Date date2) { return Objects.nonNull(date2) ? date2.toString() : "绑定date2参数失败,date2为null"; } } | BindController { @RequestMapping(value = "date2") public String date2(Date date2) { return Objects.nonNull(date2) ? date2.toString() : "绑定date2参数失败,date2为null"; } } | BindController { @RequestMapping(value = "date2") public String date2(Date date2) { return Objects.nonNull(date2) ? date2.toString() : "绑定date2参数失败,date2为null"; } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @Re... | BindController { @RequestMapping(value = "date2") public String date2(Date date2) { return Objects.nonNull(date2) ? date2.toString() : "绑定date2参数失败,date2为null"; } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @Re... |
@Test public void book() throws Exception { String contentType = "zccoder/txt"; String response = mockMvc.perform(get("/book") .contentType(contentType)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); System.out.println(response); } | @GetMapping(value = "/book") public String book(HttpServletRequest request) { String contentType = request.getContentType(); if (contentType == null) { return "book.default"; } String typeTxt = "zccoder/txt"; if (typeTxt.equalsIgnoreCase(contentType)) { return "book.txt"; } String typeHtml = "zccoder/html"; if (typeHtm... | BindController { @GetMapping(value = "/book") public String book(HttpServletRequest request) { String contentType = request.getContentType(); if (contentType == null) { return "book.default"; } String typeTxt = "zccoder/txt"; if (typeTxt.equalsIgnoreCase(contentType)) { return "book.txt"; } String typeHtml = "zccoder/h... | BindController { @GetMapping(value = "/book") public String book(HttpServletRequest request) { String contentType = request.getContentType(); if (contentType == null) { return "book.default"; } String typeTxt = "zccoder/txt"; if (typeTxt.equalsIgnoreCase(contentType)) { return "book.txt"; } String typeHtml = "zccoder/h... | BindController { @GetMapping(value = "/book") public String book(HttpServletRequest request) { String contentType = request.getContentType(); if (contentType == null) { return "book.default"; } String typeTxt = "zccoder/txt"; if (typeTxt.equalsIgnoreCase(contentType)) { return "book.txt"; } String typeHtml = "zccoder/h... | BindController { @GetMapping(value = "/book") public String book(HttpServletRequest request) { String contentType = request.getContentType(); if (contentType == null) { return "book.default"; } String typeTxt = "zccoder/txt"; if (typeTxt.equalsIgnoreCase(contentType)) { return "book.txt"; } String typeHtml = "zccoder/h... |
@Test public void getSubject() throws Exception { String subjectId = "111"; String response = mockMvc.perform(get("/subject/" + subjectId) .contentType(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); System.out.println(response); } | @GetMapping(value = "/subject/{subjectId}") public String getSubject(@PathVariable("subjectId") String subjectId) { return "this is get method,subject:" + subjectId; } | BindController { @GetMapping(value = "/subject/{subjectId}") public String getSubject(@PathVariable("subjectId") String subjectId) { return "this is get method,subject:" + subjectId; } } | BindController { @GetMapping(value = "/subject/{subjectId}") public String getSubject(@PathVariable("subjectId") String subjectId) { return "this is get method,subject:" + subjectId; } } | BindController { @GetMapping(value = "/subject/{subjectId}") public String getSubject(@PathVariable("subjectId") String subjectId) { return "this is get method,subject:" + subjectId; } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseT... | BindController { @GetMapping(value = "/subject/{subjectId}") public String getSubject(@PathVariable("subjectId") String subjectId) { return "this is get method,subject:" + subjectId; } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseT... |
@Test public void postSubject() throws Exception { String subjectId = "111"; String response = mockMvc.perform(post("/subject/" + subjectId) .contentType(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); System.out.println(response); } | @PostMapping(value = "/subject/{subjectId}") public String postSubject(@PathVariable("subjectId") String subjectId) { return "this is post method,subject:" + subjectId; } | BindController { @PostMapping(value = "/subject/{subjectId}") public String postSubject(@PathVariable("subjectId") String subjectId) { return "this is post method,subject:" + subjectId; } } | BindController { @PostMapping(value = "/subject/{subjectId}") public String postSubject(@PathVariable("subjectId") String subjectId) { return "this is post method,subject:" + subjectId; } } | BindController { @PostMapping(value = "/subject/{subjectId}") public String postSubject(@PathVariable("subjectId") String subjectId) { return "this is post method,subject:" + subjectId; } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String ba... | BindController { @PostMapping(value = "/subject/{subjectId}") public String postSubject(@PathVariable("subjectId") String subjectId) { return "this is post method,subject:" + subjectId; } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String ba... |
@Test public void deleteSubject() throws Exception { String subjectId = "111"; String response = mockMvc.perform(delete("/subject/" + subjectId) .contentType(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); System.out.println(response); } | @DeleteMapping(value = "/subject/{subjectId}") public String deleteSubject(@PathVariable("subjectId") String subjectId) { return "this is delete method,subject:" + subjectId; } | BindController { @DeleteMapping(value = "/subject/{subjectId}") public String deleteSubject(@PathVariable("subjectId") String subjectId) { return "this is delete method,subject:" + subjectId; } } | BindController { @DeleteMapping(value = "/subject/{subjectId}") public String deleteSubject(@PathVariable("subjectId") String subjectId) { return "this is delete method,subject:" + subjectId; } } | BindController { @DeleteMapping(value = "/subject/{subjectId}") public String deleteSubject(@PathVariable("subjectId") String subjectId) { return "this is delete method,subject:" + subjectId; } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") Str... | BindController { @DeleteMapping(value = "/subject/{subjectId}") public String deleteSubject(@PathVariable("subjectId") String subjectId) { return "this is delete method,subject:" + subjectId; } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") Str... |
@Test public void putSubject() throws Exception { String subjectId = "111"; String response = mockMvc.perform(put("/subject/" + subjectId) .contentType(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); System.out.println(response); } | @PutMapping(value = "/subject/{subjectId}") public String putSubject(@PathVariable("subjectId") String subjectId) { return "this is put method,subject:" + subjectId; } | BindController { @PutMapping(value = "/subject/{subjectId}") public String putSubject(@PathVariable("subjectId") String subjectId) { return "this is put method,subject:" + subjectId; } } | BindController { @PutMapping(value = "/subject/{subjectId}") public String putSubject(@PathVariable("subjectId") String subjectId) { return "this is put method,subject:" + subjectId; } } | BindController { @PutMapping(value = "/subject/{subjectId}") public String putSubject(@PathVariable("subjectId") String subjectId) { return "this is put method,subject:" + subjectId; } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseT... | BindController { @PutMapping(value = "/subject/{subjectId}") public String putSubject(@PathVariable("subjectId") String subjectId) { return "this is put method,subject:" + subjectId; } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseT... |
@Test public void updateAgeByIdTest() { EmployeeService employeeService = ctx.getBean(EmployeeService.class); employeeService.updateAgeById(1, 55); } | @Transactional(rollbackFor = Exception.class) public void updateAgeById(Integer id, Integer age) { this.employeeRepository.updateAgeById(id, age); } | EmployeeService { @Transactional(rollbackFor = Exception.class) public void updateAgeById(Integer id, Integer age) { this.employeeRepository.updateAgeById(id, age); } } | EmployeeService { @Transactional(rollbackFor = Exception.class) public void updateAgeById(Integer id, Integer age) { this.employeeRepository.updateAgeById(id, age); } } | EmployeeService { @Transactional(rollbackFor = Exception.class) public void updateAgeById(Integer id, Integer age) { this.employeeRepository.updateAgeById(id, age); } @Transactional(rollbackFor = Exception.class) void updateAgeById(Integer id, Integer age); @Transactional(rollbackFor = Exception.class) void save(List<... | EmployeeService { @Transactional(rollbackFor = Exception.class) public void updateAgeById(Integer id, Integer age) { this.employeeRepository.updateAgeById(id, age); } @Transactional(rollbackFor = Exception.class) void updateAgeById(Integer id, Integer age); @Transactional(rollbackFor = Exception.class) void save(List<... |
@Test public void say() throws Exception { String response = mockMvc.perform(get("/hello/say") .contentType(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); System.out.println(response); } | @RequestMapping(value = "say", method = RequestMethod.GET) @ResponseBody public String say() { return girlProperties.getCupSize(); } | HelloController { @RequestMapping(value = "say", method = RequestMethod.GET) @ResponseBody public String say() { return girlProperties.getCupSize(); } } | HelloController { @RequestMapping(value = "say", method = RequestMethod.GET) @ResponseBody public String say() { return girlProperties.getCupSize(); } } | HelloController { @RequestMapping(value = "say", method = RequestMethod.GET) @ResponseBody public String say() { return girlProperties.getCupSize(); } @RequestMapping(method = RequestMethod.GET) String index(); @RequestMapping(value = "say", method = RequestMethod.GET) @ResponseBody String say(); @GetMapping(value = "... | HelloController { @RequestMapping(value = "say", method = RequestMethod.GET) @ResponseBody public String say() { return girlProperties.getCupSize(); } @RequestMapping(method = RequestMethod.GET) String index(); @RequestMapping(value = "say", method = RequestMethod.GET) @ResponseBody String say(); @GetMapping(value = "... |
@Test public void sayOne() throws Exception { MultiValueMap<String, String> params = new LinkedMultiValueMap<>(16); params.add("id", "5"); String response = mockMvc.perform(get("/hello/say/one") .contentType(APPLICATION_JSON_UTF8) .params(params)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsStr... | @GetMapping(value = "/say/one") @ResponseBody public String sayOne(@RequestParam(value = "id", required = false, defaultValue = "0") Integer myId) { return "id:" + myId; } | HelloController { @GetMapping(value = "/say/one") @ResponseBody public String sayOne(@RequestParam(value = "id", required = false, defaultValue = "0") Integer myId) { return "id:" + myId; } } | HelloController { @GetMapping(value = "/say/one") @ResponseBody public String sayOne(@RequestParam(value = "id", required = false, defaultValue = "0") Integer myId) { return "id:" + myId; } } | HelloController { @GetMapping(value = "/say/one") @ResponseBody public String sayOne(@RequestParam(value = "id", required = false, defaultValue = "0") Integer myId) { return "id:" + myId; } @RequestMapping(method = RequestMethod.GET) String index(); @RequestMapping(value = "say", method = RequestMethod.GET) @ResponseB... | HelloController { @GetMapping(value = "/say/one") @ResponseBody public String sayOne(@RequestParam(value = "id", required = false, defaultValue = "0") Integer myId) { return "id:" + myId; } @RequestMapping(method = RequestMethod.GET) String index(); @RequestMapping(value = "say", method = RequestMethod.GET) @ResponseB... |
@Test public void listGirl() throws Exception { String response = mockMvc.perform(get("/girls") .contentType(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); System.out.println(response); } | @GetMapping public List<Girl> listGirl() { return girlRepository.findAll(); } | GirlController { @GetMapping public List<Girl> listGirl() { return girlRepository.findAll(); } } | GirlController { @GetMapping public List<Girl> listGirl() { return girlRepository.findAll(); } } | GirlController { @GetMapping public List<Girl> listGirl() { return girlRepository.findAll(); } @GetMapping List<Girl> listGirl(); @PostMapping Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult); @GetMapping("/{id}") Girl getGirlById(@PathVariable("id") Integer id); @PutMapping("/{id}") Girl updateGirl... | GirlController { @GetMapping public List<Girl> listGirl() { return girlRepository.findAll(); } @GetMapping List<Girl> listGirl(); @PostMapping Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult); @GetMapping("/{id}") Girl getGirlById(@PathVariable("id") Integer id); @PutMapping("/{id}") Girl updateGirl... |
@Test public void baseType2() throws Exception { MultiValueMap<String, String> params = new LinkedMultiValueMap<>(16); params.add("age", "20"); String response = mockMvc.perform(get("/baseType") .contentType(APPLICATION_JSON_UTF8) .params(params)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsStr... | @RequestMapping(value = "/baseType2") public String baseType2(Integer age) { return "age:" + age; } | BindController { @RequestMapping(value = "/baseType2") public String baseType2(Integer age) { return "age:" + age; } } | BindController { @RequestMapping(value = "/baseType2") public String baseType2(Integer age) { return "age:" + age; } } | BindController { @RequestMapping(value = "/baseType2") public String baseType2(Integer age) { return "age:" + age; } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapping(value = "/array") String array(St... | BindController { @RequestMapping(value = "/baseType2") public String baseType2(Integer age) { return "age:" + age; } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapping(value = "/array") String array(St... |
@Test public void girlAdd() throws Exception { MultiValueMap<String, String> params = new LinkedMultiValueMap<>(16); params.add("cupSize", "B"); params.add("age", "20"); String response = mockMvc.perform(post("/girls") .contentType(APPLICATION_JSON_UTF8) .params(params)) .andExpect(status().isOk()) .andReturn() .getRes... | @PostMapping public Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult) { if (bindingResult.hasErrors()) { FieldError fieldError = bindingResult.getFieldError(); if (Objects.nonNull(fieldError)) { return ResultUtil.error(ResultUtil.RESPONSE_CODE_ERROR_PARAM, fieldError.getDefaultMessage()); } return Res... | GirlController { @PostMapping public Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult) { if (bindingResult.hasErrors()) { FieldError fieldError = bindingResult.getFieldError(); if (Objects.nonNull(fieldError)) { return ResultUtil.error(ResultUtil.RESPONSE_CODE_ERROR_PARAM, fieldError.getDefaultMessage... | GirlController { @PostMapping public Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult) { if (bindingResult.hasErrors()) { FieldError fieldError = bindingResult.getFieldError(); if (Objects.nonNull(fieldError)) { return ResultUtil.error(ResultUtil.RESPONSE_CODE_ERROR_PARAM, fieldError.getDefaultMessage... | GirlController { @PostMapping public Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult) { if (bindingResult.hasErrors()) { FieldError fieldError = bindingResult.getFieldError(); if (Objects.nonNull(fieldError)) { return ResultUtil.error(ResultUtil.RESPONSE_CODE_ERROR_PARAM, fieldError.getDefaultMessage... | GirlController { @PostMapping public Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult) { if (bindingResult.hasErrors()) { FieldError fieldError = bindingResult.getFieldError(); if (Objects.nonNull(fieldError)) { return ResultUtil.error(ResultUtil.RESPONSE_CODE_ERROR_PARAM, fieldError.getDefaultMessage... |
@Test public void getGirlById() throws Exception { int id = 3; String response = mockMvc.perform(get("/girls/" + id) .contentType(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); TypeReference<Girl> typeReference = new TypeReference<Girl>() { }; Girl girl = objectMa... | @GetMapping("/{id}") public Girl getGirlById(@PathVariable("id") Integer id) { return girlRepository.findById(id).orElse(null); } | GirlController { @GetMapping("/{id}") public Girl getGirlById(@PathVariable("id") Integer id) { return girlRepository.findById(id).orElse(null); } } | GirlController { @GetMapping("/{id}") public Girl getGirlById(@PathVariable("id") Integer id) { return girlRepository.findById(id).orElse(null); } } | GirlController { @GetMapping("/{id}") public Girl getGirlById(@PathVariable("id") Integer id) { return girlRepository.findById(id).orElse(null); } @GetMapping List<Girl> listGirl(); @PostMapping Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult); @GetMapping("/{id}") Girl getGirlById(@PathVariable("id... | GirlController { @GetMapping("/{id}") public Girl getGirlById(@PathVariable("id") Integer id) { return girlRepository.findById(id).orElse(null); } @GetMapping List<Girl> listGirl(); @PostMapping Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult); @GetMapping("/{id}") Girl getGirlById(@PathVariable("id... |
@Test public void updateGirlById() throws Exception { int id = 3; MultiValueMap<String, String> params = new LinkedMultiValueMap<>(16); params.add("cupSize", "C"); params.add("age", "22"); String response = mockMvc.perform(put("/girls/" + id) .contentType(APPLICATION_JSON_UTF8) .params(params)) .andExpect(status().isOk... | @PutMapping("/{id}") public Girl updateGirlById(@PathVariable("id") Integer id, @RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setId(id); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } | GirlController { @PutMapping("/{id}") public Girl updateGirlById(@PathVariable("id") Integer id, @RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setId(id); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } } | GirlController { @PutMapping("/{id}") public Girl updateGirlById(@PathVariable("id") Integer id, @RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setId(id); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } } | GirlController { @PutMapping("/{id}") public Girl updateGirlById(@PathVariable("id") Integer id, @RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setId(id); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } @GetMapping List<Girl> li... | GirlController { @PutMapping("/{id}") public Girl updateGirlById(@PathVariable("id") Integer id, @RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setId(id); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } @GetMapping List<Girl> li... |
@Test public void removeGirl() throws Exception { int id = 2; String response = mockMvc.perform(delete("/girls/" + id) .contentType(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); System.out.println(response); } | @DeleteMapping("/{id}") public void removeGirl(@PathVariable("id") Integer id) { girlRepository.deleteById(id); } | GirlController { @DeleteMapping("/{id}") public void removeGirl(@PathVariable("id") Integer id) { girlRepository.deleteById(id); } } | GirlController { @DeleteMapping("/{id}") public void removeGirl(@PathVariable("id") Integer id) { girlRepository.deleteById(id); } } | GirlController { @DeleteMapping("/{id}") public void removeGirl(@PathVariable("id") Integer id) { girlRepository.deleteById(id); } @GetMapping List<Girl> listGirl(); @PostMapping Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult); @GetMapping("/{id}") Girl getGirlById(@PathVariable("id") Integer id); ... | GirlController { @DeleteMapping("/{id}") public void removeGirl(@PathVariable("id") Integer id) { girlRepository.deleteById(id); } @GetMapping List<Girl> listGirl(); @PostMapping Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult); @GetMapping("/{id}") Girl getGirlById(@PathVariable("id") Integer id); ... |
@Test public void listGirlByAge() throws Exception { int age = 8; String response = mockMvc.perform(get("/girls/age/" + age) .contentType(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); TypeReference<List<Girl>> typeReference = new TypeReference<List<Girl>>() { }; ... | @GetMapping("/age/{age}") public List<Girl> listGirlByAge(@PathVariable("age") Integer age) { return girlRepository.findByAge(age); } | GirlController { @GetMapping("/age/{age}") public List<Girl> listGirlByAge(@PathVariable("age") Integer age) { return girlRepository.findByAge(age); } } | GirlController { @GetMapping("/age/{age}") public List<Girl> listGirlByAge(@PathVariable("age") Integer age) { return girlRepository.findByAge(age); } } | GirlController { @GetMapping("/age/{age}") public List<Girl> listGirlByAge(@PathVariable("age") Integer age) { return girlRepository.findByAge(age); } @GetMapping List<Girl> listGirl(); @PostMapping Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult); @GetMapping("/{id}") Girl getGirlById(@PathVariable... | GirlController { @GetMapping("/age/{age}") public List<Girl> listGirlByAge(@PathVariable("age") Integer age) { return girlRepository.findByAge(age); } @GetMapping List<Girl> listGirl(); @PostMapping Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult); @GetMapping("/{id}") Girl getGirlById(@PathVariable... |
@Test public void saveGirlTwo() throws Exception { String response = mockMvc.perform(post("/girls/two") .contentType(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); System.out.println(response); } | @PostMapping("/two") public void saveGirlTwo() { girlService.saveTwo(); } | GirlController { @PostMapping("/two") public void saveGirlTwo() { girlService.saveTwo(); } } | GirlController { @PostMapping("/two") public void saveGirlTwo() { girlService.saveTwo(); } } | GirlController { @PostMapping("/two") public void saveGirlTwo() { girlService.saveTwo(); } @GetMapping List<Girl> listGirl(); @PostMapping Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult); @GetMapping("/{id}") Girl getGirlById(@PathVariable("id") Integer id); @PutMapping("/{id}") Girl updateGirlById... | GirlController { @PostMapping("/two") public void saveGirlTwo() { girlService.saveTwo(); } @GetMapping List<Girl> listGirl(); @PostMapping Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult); @GetMapping("/{id}") Girl getGirlById(@PathVariable("id") Integer id); @PutMapping("/{id}") Girl updateGirlById... |
@Test public void saveTest(){ TodoItem todoItem = new TodoItem("imooc"); repository.save(todoItem); Assert.assertNull(repository.query(todoItem.getName())); } | public void save(TodoItem item){ items.put(item.getName(),item); } | TodoRepository { public void save(TodoItem item){ items.put(item.getName(),item); } } | TodoRepository { public void save(TodoItem item){ items.put(item.getName(),item); } } | TodoRepository { public void save(TodoItem item){ items.put(item.getName(),item); } void save(TodoItem item); TodoItem query(String name); } | TodoRepository { public void save(TodoItem item){ items.put(item.getName(),item); } void save(TodoItem item); TodoItem query(String name); } |
@Test public void sendSimpleMail() { this.mailService.sendSimpleMail(TO, "这是第一封邮件", "大家好,这是我的第一封邮件"); } | public void sendSimpleMail(String to, String subject, String content) { SimpleMailMessage message = new SimpleMailMessage(); message.setTo(to); message.setSubject(subject); message.setText(content); message.setFrom(from); this.mailSender.send(message); } | MailService { public void sendSimpleMail(String to, String subject, String content) { SimpleMailMessage message = new SimpleMailMessage(); message.setTo(to); message.setSubject(subject); message.setText(content); message.setFrom(from); this.mailSender.send(message); } } | MailService { public void sendSimpleMail(String to, String subject, String content) { SimpleMailMessage message = new SimpleMailMessage(); message.setTo(to); message.setSubject(subject); message.setText(content); message.setFrom(from); this.mailSender.send(message); } } | MailService { public void sendSimpleMail(String to, String subject, String content) { SimpleMailMessage message = new SimpleMailMessage(); message.setTo(to); message.setSubject(subject); message.setText(content); message.setFrom(from); this.mailSender.send(message); } void sendSimpleMail(String to, String subject, Str... | MailService { public void sendSimpleMail(String to, String subject, String content) { SimpleMailMessage message = new SimpleMailMessage(); message.setTo(to); message.setSubject(subject); message.setText(content); message.setFrom(from); this.mailSender.send(message); } void sendSimpleMail(String to, String subject, Str... |
@Test public void sendHtmlMail() throws Exception { StringBuilder content = new StringBuilder(128); content.append("<html\n>"); content.append("<body>\n"); content.append("<h3> Hello World!这是一封Html邮件</h3>\n"); content.append("</body>\n"); content.append("</html>"); this.mailService.sendHtmlMail(TO, "这是一封html邮件", conten... | public void sendHtmlMail(String to, String subject, String content) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.setText(content, true); helper.setFrom(from); this.mailS... | MailService { public void sendHtmlMail(String to, String subject, String content) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.setText(content, true); helper.setFrom(fro... | MailService { public void sendHtmlMail(String to, String subject, String content) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.setText(content, true); helper.setFrom(fro... | MailService { public void sendHtmlMail(String to, String subject, String content) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.setText(content, true); helper.setFrom(fro... | MailService { public void sendHtmlMail(String to, String subject, String content) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.setText(content, true); helper.setFrom(fro... |
@Test public void sendAttachmentsMail() throws Exception { String filePath = "d:\\48-boot-mail-hello.zip"; this.mailService.sendAttachmentsMail(TO, "这是一封带附件的邮件", "这是一封带附件的邮件内容", new String[]{filePath}); } | public void sendAttachmentsMail(String to, String subject, String content, String[] filePaths) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.setText(content, true); FileS... | MailService { public void sendAttachmentsMail(String to, String subject, String content, String[] filePaths) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.setText(content... | MailService { public void sendAttachmentsMail(String to, String subject, String content, String[] filePaths) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.setText(content... | MailService { public void sendAttachmentsMail(String to, String subject, String content, String[] filePaths) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.setText(content... | MailService { public void sendAttachmentsMail(String to, String subject, String content, String[] filePaths) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.setText(content... |
@Test public void array() throws Exception { MultiValueMap<String, String> params = new LinkedMultiValueMap<>(16); params.add("name", "Tom,Lucy"); String response = mockMvc.perform(get("/array") .contentType(APPLICATION_JSON_UTF8) .params(params)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsStr... | @RequestMapping(value = "/array") public String array(String[] name) { StringBuilder stringBuilder = new StringBuilder(); for (String item : name) { stringBuilder.append(item).append(" "); } return stringBuilder.toString(); } | BindController { @RequestMapping(value = "/array") public String array(String[] name) { StringBuilder stringBuilder = new StringBuilder(); for (String item : name) { stringBuilder.append(item).append(" "); } return stringBuilder.toString(); } } | BindController { @RequestMapping(value = "/array") public String array(String[] name) { StringBuilder stringBuilder = new StringBuilder(); for (String item : name) { stringBuilder.append(item).append(" "); } return stringBuilder.toString(); } } | BindController { @RequestMapping(value = "/array") public String array(String[] name) { StringBuilder stringBuilder = new StringBuilder(); for (String item : name) { stringBuilder.append(item).append(" "); } return stringBuilder.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") in... | BindController { @RequestMapping(value = "/array") public String array(String[] name) { StringBuilder stringBuilder = new StringBuilder(); for (String item : name) { stringBuilder.append(item).append(" "); } return stringBuilder.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") in... |
@Test public void sendInlineResourceMail() { String rscPath = "d:\\thumb.jpg"; String rscId = "img001"; StringBuilder content = new StringBuilder(128); content.append("<html\n>"); content.append("<body>\n"); content.append("<h3> 这是有图片的邮件</h3>\n"); content.append("<img src=\'cid:").append(rscId).append("\'></img>\n"); c... | public void sendInlineResourceMail(String to, String subject, String content, String rscPath, String rscId) { logger.info("发送图片邮件开始:{},{},{},{},{}", to, subject, content, rscPath, rscId); MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper; try { helper = new MimeMessageHelper(message, t... | MailService { public void sendInlineResourceMail(String to, String subject, String content, String rscPath, String rscId) { logger.info("发送图片邮件开始:{},{},{},{},{}", to, subject, content, rscPath, rscId); MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper; try { helper = new MimeMessageHel... | MailService { public void sendInlineResourceMail(String to, String subject, String content, String rscPath, String rscId) { logger.info("发送图片邮件开始:{},{},{},{},{}", to, subject, content, rscPath, rscId); MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper; try { helper = new MimeMessageHel... | MailService { public void sendInlineResourceMail(String to, String subject, String content, String rscPath, String rscId) { logger.info("发送图片邮件开始:{},{},{},{},{}", to, subject, content, rscPath, rscId); MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper; try { helper = new MimeMessageHel... | MailService { public void sendInlineResourceMail(String to, String subject, String content, String rscPath, String rscId) { logger.info("发送图片邮件开始:{},{},{},{},{}", to, subject, content, rscPath, rscId); MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper; try { helper = new MimeMessageHel... |
@Test public void sendTemplateMail() throws Exception { Context context = new Context(); context.setVariable("id", "006"); String emailContent = this.templateEngine.process("emailTemplate", context); this.mailService.sendHtmlMail(TO, "这是一封模版邮件", emailContent); } | public void sendHtmlMail(String to, String subject, String content) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.setText(content, true); helper.setFrom(from); this.mailS... | MailService { public void sendHtmlMail(String to, String subject, String content) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.setText(content, true); helper.setFrom(fro... | MailService { public void sendHtmlMail(String to, String subject, String content) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.setText(content, true); helper.setFrom(fro... | MailService { public void sendHtmlMail(String to, String subject, String content) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.setText(content, true); helper.setFrom(fro... | MailService { public void sendHtmlMail(String to, String subject, String content) throws Exception { MimeMessage message = this.mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setTo(to); helper.setSubject(subject); helper.setText(content, true); helper.setFrom(fro... |
@Test public void sayHelloTest() { this.helloService.sayHello(); } | public void sayHello() { System.out.println("Hello World"); } | HelloService { public void sayHello() { System.out.println("Hello World"); } } | HelloService { public void sayHello() { System.out.println("Hello World"); } } | HelloService { public void sayHello() { System.out.println("Hello World"); } void sayHello(); } | HelloService { public void sayHello() { System.out.println("Hello World"); } void sayHello(); } |
@Test public void addStudents() { Session session = sessionFactory.getCurrentSession(); Transaction tx = session.beginTransaction(); Teachers t1 = new Teachers("T001", "张老师"); Teachers t2 = new Teachers("T002", "李老师"); Teachers t3 = new Teachers("T003", "陈老师"); Teachers t4 = new Teachers("T004", "刘老师"); Students s1 = n... | public void setTeachers(Set<Teachers> teachers) { this.teachers = teachers; } | Students { public void setTeachers(Set<Teachers> teachers) { this.teachers = teachers; } } | Students { public void setTeachers(Set<Teachers> teachers) { this.teachers = teachers; } Students(); Students(String sname, String gender, Date birthday, String major); } | Students { public void setTeachers(Set<Teachers> teachers) { this.teachers = teachers; } Students(); Students(String sname, String gender, Date birthday, String major); @Override String toString(); Set<Teachers> getTeachers(); void setTeachers(Set<Teachers> teachers); String getSname(); void setSname(String sname); In... | Students { public void setTeachers(Set<Teachers> teachers) { this.teachers = teachers; } Students(); Students(String sname, String gender, Date birthday, String major); @Override String toString(); Set<Teachers> getTeachers(); void setTeachers(Set<Teachers> teachers); String getSname(); void setSname(String sname); In... |
@Test public void addStudents() { Session session = sessionFactory.getCurrentSession(); Transaction tx = session.beginTransaction(); Teachers t1 = new Teachers("T001", "张老师"); Teachers t2 = new Teachers("T002", "李老师"); Teachers t3 = new Teachers("T003", "陈老师"); Teachers t4 = new Teachers("T004", "刘老师"); Students s1 = n... | public void setTeachers(Set<Teachers> teachers) { this.teachers = teachers; } | Students { public void setTeachers(Set<Teachers> teachers) { this.teachers = teachers; } } | Students { public void setTeachers(Set<Teachers> teachers) { this.teachers = teachers; } Students(); Students(String sname, String gender, Date birthday, String major); } | Students { public void setTeachers(Set<Teachers> teachers) { this.teachers = teachers; } Students(); Students(String sname, String gender, Date birthday, String major); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); Set<Teachers> getTeachers(); void setTeachers(Set<Teachers>... | Students { public void setTeachers(Set<Teachers> teachers) { this.teachers = teachers; } Students(); Students(String sname, String gender, Date birthday, String major); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); Set<Teachers> getTeachers(); void setTeachers(Set<Teachers>... |
@Test public void addStudents() { Session session = sessionFactory.getCurrentSession(); Transaction tx = session.beginTransaction(); ClassRoom c1 = new ClassRoom("C001", "软件工程"); ClassRoom c2 = new ClassRoom("C002", "网络工程"); Students s1 = new Students("张三", "男", new Date(), "计算机"); Students s2 = new Students("李四", "男",... | public void setClassRoom(ClassRoom classRoom) { this.classRoom = classRoom; } | Students { public void setClassRoom(ClassRoom classRoom) { this.classRoom = classRoom; } } | Students { public void setClassRoom(ClassRoom classRoom) { this.classRoom = classRoom; } Students(); Students(String sname, String gender, Date birthday, String major); } | Students { public void setClassRoom(ClassRoom classRoom) { this.classRoom = classRoom; } Students(); Students(String sname, String gender, Date birthday, String major); @Override String toString(); String getSname(); void setSname(String sname); ClassRoom getClassRoom(); void setClassRoom(ClassRoom classRoom); Integer... | Students { public void setClassRoom(ClassRoom classRoom) { this.classRoom = classRoom; } Students(); Students(String sname, String gender, Date birthday, String major); @Override String toString(); String getSname(); void setSname(String sname); ClassRoom getClassRoom(); void setClassRoom(ClassRoom classRoom); Integer... |
@Test public void findOne() throws Exception { } | public Girl findOne(Integer id) { return girlRepository.findOne(id); } | GirlService { public Girl findOne(Integer id) { return girlRepository.findOne(id); } } | GirlService { public Girl findOne(Integer id) { return girlRepository.findOne(id); } } | GirlService { public Girl findOne(Integer id) { return girlRepository.findOne(id); } @Transactional void insertTwo(); void getAge(Integer id); Girl findOne(Integer id); } | GirlService { public Girl findOne(Integer id) { return girlRepository.findOne(id); } @Transactional void insertTwo(); void getAge(Integer id); Girl findOne(Integer id); } |
@Test public void girlList() throws Exception { mvc.perform(MockMvcRequestBuilders.get("/girls")) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.content().string("abc")); } | @GetMapping(value = "/girls") public List<Girl> girlList() { logger.info("girlList"); return girlRepository.findAll(); } | GirlController { @GetMapping(value = "/girls") public List<Girl> girlList() { logger.info("girlList"); return girlRepository.findAll(); } } | GirlController { @GetMapping(value = "/girls") public List<Girl> girlList() { logger.info("girlList"); return girlRepository.findAll(); } } | GirlController { @GetMapping(value = "/girls") public List<Girl> girlList() { logger.info("girlList"); return girlRepository.findAll(); } @GetMapping(value = "/girls") List<Girl> girlList(); @PostMapping(value = "/girls") Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult); @GetMapping(value = "/girls/... | GirlController { @GetMapping(value = "/girls") public List<Girl> girlList() { logger.info("girlList"); return girlRepository.findAll(); } @GetMapping(value = "/girls") List<Girl> girlList(); @PostMapping(value = "/girls") Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult); @GetMapping(value = "/girls/... |
@Test public void testGetConnection() throws Exception { Connection connection = JDBCUtil.getConnection(); Assert.assertNotNull(connection); } | public static Connection getConnection() throws Exception { InputStream inputStream = JDBCUtil.class.getClassLoader().getResourceAsStream("db.properties"); Properties properties = new Properties(); properties.load(inputStream); String url = properties.getProperty("jdbc.url"); String user = properties.getProperty("jdbc.... | JDBCUtil { public static Connection getConnection() throws Exception { InputStream inputStream = JDBCUtil.class.getClassLoader().getResourceAsStream("db.properties"); Properties properties = new Properties(); properties.load(inputStream); String url = properties.getProperty("jdbc.url"); String user = properties.getProp... | JDBCUtil { public static Connection getConnection() throws Exception { InputStream inputStream = JDBCUtil.class.getClassLoader().getResourceAsStream("db.properties"); Properties properties = new Properties(); properties.load(inputStream); String url = properties.getProperty("jdbc.url"); String user = properties.getProp... | JDBCUtil { public static Connection getConnection() throws Exception { InputStream inputStream = JDBCUtil.class.getClassLoader().getResourceAsStream("db.properties"); Properties properties = new Properties(); properties.load(inputStream); String url = properties.getProperty("jdbc.url"); String user = properties.getProp... | JDBCUtil { public static Connection getConnection() throws Exception { InputStream inputStream = JDBCUtil.class.getClassLoader().getResourceAsStream("db.properties"); Properties properties = new Properties(); properties.load(inputStream); String url = properties.getProperty("jdbc.url"); String user = properties.getProp... |
@Test public void testUpdate() { employeeService.update(1, 55); } | @Transactional public void update(Integer id, Integer age) { employeeRepository.update(id, age); } | EmployeeService { @Transactional public void update(Integer id, Integer age) { employeeRepository.update(id, age); } } | EmployeeService { @Transactional public void update(Integer id, Integer age) { employeeRepository.update(id, age); } } | EmployeeService { @Transactional public void update(Integer id, Integer age) { employeeRepository.update(id, age); } @Transactional void update(Integer id, Integer age); } | EmployeeService { @Transactional public void update(Integer id, Integer age) { employeeRepository.update(id, age); } @Transactional void update(Integer id, Integer age); } |
@Test public void object() throws Exception { MultiValueMap<String, String> params = new LinkedMultiValueMap<>(16); params.add("name", "Tom"); params.add("age", "20"); params.add("contactInfo.phone", "10086"); params.add("contactInfo.address", "11号"); params.add("admin.name", "Lucy"); params.add("admin.age", "18"); Str... | @RequestMapping(value = "/object") public String object(User user, Admin admin) { return user.toString() + " ### " + admin.toString(); } | BindController { @RequestMapping(value = "/object") public String object(User user, Admin admin) { return user.toString() + " ### " + admin.toString(); } } | BindController { @RequestMapping(value = "/object") public String object(User user, Admin admin) { return user.toString() + " ### " + admin.toString(); } } | BindController { @RequestMapping(value = "/object") public String object(User user, Admin admin) { return user.toString() + " ### " + admin.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapp... | BindController { @RequestMapping(value = "/object") public String object(User user, Admin admin) { return user.toString() + " ### " + admin.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapp... |
@Test public void testQuery() { StudentDAO studentDAO = new StudentDAOImpl(); List<Student> students = studentDAO.query(); for (Student student : students) { System.out.println("id:" + student.getId() + " , name:" + student.getName() + ", age:" + student.getAge()); } } | @Override public List<Student> query() { List<Student> students = new ArrayList<Student>(); Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; String sql = "select id, name , age from student"; try { connection = JDBCUtil.getConnection(); preparedStatement = connection... | StudentDAOImpl implements StudentDAO { @Override public List<Student> query() { List<Student> students = new ArrayList<Student>(); Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; String sql = "select id, name , age from student"; try { connection = JDBCUtil.getConn... | StudentDAOImpl implements StudentDAO { @Override public List<Student> query() { List<Student> students = new ArrayList<Student>(); Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; String sql = "select id, name , age from student"; try { connection = JDBCUtil.getConn... | StudentDAOImpl implements StudentDAO { @Override public List<Student> query() { List<Student> students = new ArrayList<Student>(); Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; String sql = "select id, name , age from student"; try { connection = JDBCUtil.getConn... | StudentDAOImpl implements StudentDAO { @Override public List<Student> query() { List<Student> students = new ArrayList<Student>(); Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; String sql = "select id, name , age from student"; try { connection = JDBCUtil.getConn... |
@Test public void testSave() { StudentDAO studentDAO = new StudentDAOImpl(); Student student = new Student(); student.setName("test"); student.setAge(30); studentDAO.save(student); } | @Override public void save(Student student) { Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; String sql = "insert into student(name, age) values(?,?)"; try { connection = JDBCUtil.getConnection(); preparedStatement = connection.prepareStatement(sql); preparedStatem... | StudentDAOImpl implements StudentDAO { @Override public void save(Student student) { Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; String sql = "insert into student(name, age) values(?,?)"; try { connection = JDBCUtil.getConnection(); preparedStatement = connecti... | StudentDAOImpl implements StudentDAO { @Override public void save(Student student) { Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; String sql = "insert into student(name, age) values(?,?)"; try { connection = JDBCUtil.getConnection(); preparedStatement = connecti... | StudentDAOImpl implements StudentDAO { @Override public void save(Student student) { Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; String sql = "insert into student(name, age) values(?,?)"; try { connection = JDBCUtil.getConnection(); preparedStatement = connecti... | StudentDAOImpl implements StudentDAO { @Override public void save(Student student) { Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; String sql = "insert into student(name, age) values(?,?)"; try { connection = JDBCUtil.getConnection(); preparedStatement = connecti... |
@Test public void testQuery() { List<Student> students = studentDAO.query(); for (Student student : students) { System.out.println("id:" + student.getId() + " , name:" + student.getName() + ", age:" + student.getAge()); } } | @Override public List<Student> query() { final List<Student> students = new ArrayList<Student>(); String sql = "select id, name , age from student"; jdbcTemplate.query(sql, new RowCallbackHandler(){ @Override public void processRow(ResultSet rs) throws SQLException { int id = rs.getInt("id"); String name = rs.getString... | StudentDAOSpringJdbcImpl implements StudentDAO { @Override public List<Student> query() { final List<Student> students = new ArrayList<Student>(); String sql = "select id, name , age from student"; jdbcTemplate.query(sql, new RowCallbackHandler(){ @Override public void processRow(ResultSet rs) throws SQLException { in... | StudentDAOSpringJdbcImpl implements StudentDAO { @Override public List<Student> query() { final List<Student> students = new ArrayList<Student>(); String sql = "select id, name , age from student"; jdbcTemplate.query(sql, new RowCallbackHandler(){ @Override public void processRow(ResultSet rs) throws SQLException { in... | StudentDAOSpringJdbcImpl implements StudentDAO { @Override public List<Student> query() { final List<Student> students = new ArrayList<Student>(); String sql = "select id, name , age from student"; jdbcTemplate.query(sql, new RowCallbackHandler(){ @Override public void processRow(ResultSet rs) throws SQLException { in... | StudentDAOSpringJdbcImpl implements StudentDAO { @Override public List<Student> query() { final List<Student> students = new ArrayList<Student>(); String sql = "select id, name , age from student"; jdbcTemplate.query(sql, new RowCallbackHandler(){ @Override public void processRow(ResultSet rs) throws SQLException { in... |
@Test public void testSave() { Student student = new Student(); student.setName("test-spring-jdbc"); student.setAge(40); studentDAO.save(student); } | @Override public void save(Student student) { String sql = "insert into student(name, age) values(?,?)"; jdbcTemplate.update(sql, new Object[]{student.getName(), student.getAge()}); } | StudentDAOSpringJdbcImpl implements StudentDAO { @Override public void save(Student student) { String sql = "insert into student(name, age) values(?,?)"; jdbcTemplate.update(sql, new Object[]{student.getName(), student.getAge()}); } } | StudentDAOSpringJdbcImpl implements StudentDAO { @Override public void save(Student student) { String sql = "insert into student(name, age) values(?,?)"; jdbcTemplate.update(sql, new Object[]{student.getName(), student.getAge()}); } } | StudentDAOSpringJdbcImpl implements StudentDAO { @Override public void save(Student student) { String sql = "insert into student(name, age) values(?,?)"; jdbcTemplate.update(sql, new Object[]{student.getName(), student.getAge()}); } @Override List<Student> query(); @Override void save(Student student); JdbcTemplate g... | StudentDAOSpringJdbcImpl implements StudentDAO { @Override public void save(Student student) { String sql = "insert into student(name, age) values(?,?)"; jdbcTemplate.update(sql, new Object[]{student.getName(), student.getAge()}); } @Override List<Student> query(); @Override void save(Student student); JdbcTemplate g... |
@Test public void testGetSessionId() throws InterruptedException { Long sessionId1 = sessionManager.getSessionId(); Thread.sleep(1000); Long sessionId2 = sessionManager.getSessionId(); assertNotEquals( sessionId2.longValue(), sessionId1.longValue()); } | public Long getSessionId() { return sessionIdProvider.get(); } | SessionManager { public Long getSessionId() { return sessionIdProvider.get(); } } | SessionManager { public Long getSessionId() { return sessionIdProvider.get(); } @Inject SessionManager(
@SessionId Provider<Long> sessionIdProvider); } | SessionManager { public Long getSessionId() { return sessionIdProvider.get(); } @Inject SessionManager(
@SessionId Provider<Long> sessionIdProvider); Long getSessionId(); } | SessionManager { public Long getSessionId() { return sessionIdProvider.get(); } @Inject SessionManager(
@SessionId Provider<Long> sessionIdProvider); Long getSessionId(); } |
@Test public void testWithoutTransaction(){ demoService.addUser("tom"); } | @Transactional(rollbackFor = Exception.class) public void addUser(String name) { OperationLog log = new OperationLog(); log.setContent("create user:" + name); operationLogDao.save(log); User user = new User(); user.setName(name); userDao.save(user); } | DemoService { @Transactional(rollbackFor = Exception.class) public void addUser(String name) { OperationLog log = new OperationLog(); log.setContent("create user:" + name); operationLogDao.save(log); User user = new User(); user.setName(name); userDao.save(user); } } | DemoService { @Transactional(rollbackFor = Exception.class) public void addUser(String name) { OperationLog log = new OperationLog(); log.setContent("create user:" + name); operationLogDao.save(log); User user = new User(); user.setName(name); userDao.save(user); } } | DemoService { @Transactional(rollbackFor = Exception.class) public void addUser(String name) { OperationLog log = new OperationLog(); log.setContent("create user:" + name); operationLogDao.save(log); User user = new User(); user.setName(name); userDao.save(user); } @Transactional(rollbackFor = Exception.class) void ad... | DemoService { @Transactional(rollbackFor = Exception.class) public void addUser(String name) { OperationLog log = new OperationLog(); log.setContent("create user:" + name); operationLogDao.save(log); User user = new User(); user.setName(name); userDao.save(user); } @Transactional(rollbackFor = Exception.class) void ad... |
@Test public void listGirl() throws Exception { String response = mockMvc.perform(get("/girls") .contentType(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); System.out.println(response); } | @GetMapping public List<Girl> listGirl() { return girlRepository.findAll(); } | GirlController { @GetMapping public List<Girl> listGirl() { return girlRepository.findAll(); } } | GirlController { @GetMapping public List<Girl> listGirl() { return girlRepository.findAll(); } } | GirlController { @GetMapping public List<Girl> listGirl() { return girlRepository.findAll(); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") String cupSize,
@RequestParam("age") Integer age); @GetMapping("/{id}") Girl getGirlById(@PathVariable("id") Integ... | GirlController { @GetMapping public List<Girl> listGirl() { return girlRepository.findAll(); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") String cupSize,
@RequestParam("age") Integer age); @GetMapping("/{id}") Girl getGirlById(@PathVariable("id") Integ... |
@Test public void girlAdd() throws Exception { MultiValueMap<String, String> params = new LinkedMultiValueMap<>(16); params.add("cupSize", "B"); params.add("age", "20"); String response = mockMvc.perform(post("/girls") .contentType(APPLICATION_JSON_UTF8) .params(params)) .andExpect(status().isOk()) .andReturn() .getRes... | @PostMapping public Girl girlAdd(@RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } | GirlController { @PostMapping public Girl girlAdd(@RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } } | GirlController { @PostMapping public Girl girlAdd(@RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } } | GirlController { @PostMapping public Girl girlAdd(@RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") St... | GirlController { @PostMapping public Girl girlAdd(@RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") St... |
@Test public void list() throws Exception { MultiValueMap<String, String> params = new LinkedMultiValueMap<>(16); params.add("users[0].name", "Tome"); params.add("users[20].name", "Lucy"); String response = mockMvc.perform(get("/list") .contentType(APPLICATION_JSON_UTF8) .params(params)) .andExpect(status().isOk()) .an... | @RequestMapping(value = "list") public String list(UserListForm userListForm) { return "listSize:" + userListForm.getUsers().size() + userListForm.toString(); } | BindController { @RequestMapping(value = "list") public String list(UserListForm userListForm) { return "listSize:" + userListForm.getUsers().size() + userListForm.toString(); } } | BindController { @RequestMapping(value = "list") public String list(UserListForm userListForm) { return "listSize:" + userListForm.getUsers().size() + userListForm.toString(); } } | BindController { @RequestMapping(value = "list") public String list(UserListForm userListForm) { return "listSize:" + userListForm.getUsers().size() + userListForm.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(In... | BindController { @RequestMapping(value = "list") public String list(UserListForm userListForm) { return "listSize:" + userListForm.getUsers().size() + userListForm.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(In... |
@Test public void getGirlById() throws Exception { int id = 3; String response = mockMvc.perform(get("/girls/" + id) .contentType(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); TypeReference<Girl> typeReference = new TypeReference<Girl>() { }; Girl girl = objectMa... | @GetMapping("/{id}") public Girl getGirlById(@PathVariable("id") Integer id) { return girlRepository.findById(id).orElse(null); } | GirlController { @GetMapping("/{id}") public Girl getGirlById(@PathVariable("id") Integer id) { return girlRepository.findById(id).orElse(null); } } | GirlController { @GetMapping("/{id}") public Girl getGirlById(@PathVariable("id") Integer id) { return girlRepository.findById(id).orElse(null); } } | GirlController { @GetMapping("/{id}") public Girl getGirlById(@PathVariable("id") Integer id) { return girlRepository.findById(id).orElse(null); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") String cupSize,
@RequestParam("age") Integer age); @GetMapping... | GirlController { @GetMapping("/{id}") public Girl getGirlById(@PathVariable("id") Integer id) { return girlRepository.findById(id).orElse(null); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") String cupSize,
@RequestParam("age") Integer age); @GetMapping... |
@Test public void updateGirlById() throws Exception { int id = 3; MultiValueMap<String, String> params = new LinkedMultiValueMap<>(16); params.add("cupSize", "C"); params.add("age", "22"); String response = mockMvc.perform(put("/girls/" + id) .contentType(APPLICATION_JSON_UTF8) .params(params)) .andExpect(status().isOk... | @PutMapping("/{id}") public Girl updateGirlById(@PathVariable("id") Integer id, @RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setId(id); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } | GirlController { @PutMapping("/{id}") public Girl updateGirlById(@PathVariable("id") Integer id, @RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setId(id); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } } | GirlController { @PutMapping("/{id}") public Girl updateGirlById(@PathVariable("id") Integer id, @RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setId(id); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } } | GirlController { @PutMapping("/{id}") public Girl updateGirlById(@PathVariable("id") Integer id, @RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setId(id); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } @GetMapping List<Girl> li... | GirlController { @PutMapping("/{id}") public Girl updateGirlById(@PathVariable("id") Integer id, @RequestParam("cupSize") String cupSize, @RequestParam("age") Integer age) { Girl girl = new Girl(); girl.setId(id); girl.setCupSize(cupSize); girl.setAge(age); return girlRepository.save(girl); } @GetMapping List<Girl> li... |
@Test public void removeGirl() throws Exception { int id = 2; String response = mockMvc.perform(delete("/girls/" + id) .contentType(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); System.out.println(response); } | @DeleteMapping("/{id}") public void removeGirl(@PathVariable("id") Integer id) { girlRepository.deleteById(id); } | GirlController { @DeleteMapping("/{id}") public void removeGirl(@PathVariable("id") Integer id) { girlRepository.deleteById(id); } } | GirlController { @DeleteMapping("/{id}") public void removeGirl(@PathVariable("id") Integer id) { girlRepository.deleteById(id); } } | GirlController { @DeleteMapping("/{id}") public void removeGirl(@PathVariable("id") Integer id) { girlRepository.deleteById(id); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") String cupSize,
@RequestParam("age") Integer age); @GetMapping("/{id}") Girl g... | GirlController { @DeleteMapping("/{id}") public void removeGirl(@PathVariable("id") Integer id) { girlRepository.deleteById(id); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") String cupSize,
@RequestParam("age") Integer age); @GetMapping("/{id}") Girl g... |
@Test public void listGirlByAge() throws Exception { int age = 18; String response = mockMvc.perform(get("/girls/age/" + age) .contentType(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); TypeReference<List<Girl>> typeReference = new TypeReference<List<Girl>>() { };... | @GetMapping("/age/{age}") public List<Girl> listGirlByAge(@PathVariable("age") Integer age) { return girlRepository.findByAge(age); } | GirlController { @GetMapping("/age/{age}") public List<Girl> listGirlByAge(@PathVariable("age") Integer age) { return girlRepository.findByAge(age); } } | GirlController { @GetMapping("/age/{age}") public List<Girl> listGirlByAge(@PathVariable("age") Integer age) { return girlRepository.findByAge(age); } } | GirlController { @GetMapping("/age/{age}") public List<Girl> listGirlByAge(@PathVariable("age") Integer age) { return girlRepository.findByAge(age); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") String cupSize,
@RequestParam("age") Integer age); @GetMap... | GirlController { @GetMapping("/age/{age}") public List<Girl> listGirlByAge(@PathVariable("age") Integer age) { return girlRepository.findByAge(age); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") String cupSize,
@RequestParam("age") Integer age); @GetMap... |
@Test public void saveGirlTwo() throws Exception { String response = mockMvc.perform(post("/girls/two") .contentType(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsString(); System.out.println(response); } | @PostMapping("/two") public void saveGirlTwo() { girlService.saveTwo(); } | GirlController { @PostMapping("/two") public void saveGirlTwo() { girlService.saveTwo(); } } | GirlController { @PostMapping("/two") public void saveGirlTwo() { girlService.saveTwo(); } } | GirlController { @PostMapping("/two") public void saveGirlTwo() { girlService.saveTwo(); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") String cupSize,
@RequestParam("age") Integer age); @GetMapping("/{id}") Girl getGirlById(@PathVariable("id") Integer i... | GirlController { @PostMapping("/two") public void saveGirlTwo() { girlService.saveTwo(); } @GetMapping List<Girl> listGirl(); @PostMapping Girl girlAdd(@RequestParam("cupSize") String cupSize,
@RequestParam("age") Integer age); @GetMapping("/{id}") Girl getGirlById(@PathVariable("id") Integer i... |
@Test public void getSeckillList() throws Exception { List<Seckill> list = seckillService.getSeckillList(); logger.info("list={}",list); } | @Override public List<Seckill> getSeckillList() { return seckillDao.queryAll(0, 4); } | SeckillServiceImpl implements SeckillService { @Override public List<Seckill> getSeckillList() { return seckillDao.queryAll(0, 4); } } | SeckillServiceImpl implements SeckillService { @Override public List<Seckill> getSeckillList() { return seckillDao.queryAll(0, 4); } } | SeckillServiceImpl implements SeckillService { @Override public List<Seckill> getSeckillList() { return seckillDao.queryAll(0, 4); } @Override List<Seckill> getSeckillList(); @Override Seckill getById(long seckillId); @Override Exposer exportSeckillUrl(long seckillId); @Transactional(rollbackFor = Exception.class) @Ov... | SeckillServiceImpl implements SeckillService { @Override public List<Seckill> getSeckillList() { return seckillDao.queryAll(0, 4); } @Override List<Seckill> getSeckillList(); @Override Seckill getById(long seckillId); @Override Exposer exportSeckillUrl(long seckillId); @Transactional(rollbackFor = Exception.class) @Ov... |
@Test public void getById() throws Exception { long id = 1000L; Seckill seckill = seckillService.getById(id); logger.info("seckill={}", seckill); } | @Override public Seckill getById(long seckillId) { return seckillDao.queryById(seckillId); } | SeckillServiceImpl implements SeckillService { @Override public Seckill getById(long seckillId) { return seckillDao.queryById(seckillId); } } | SeckillServiceImpl implements SeckillService { @Override public Seckill getById(long seckillId) { return seckillDao.queryById(seckillId); } } | SeckillServiceImpl implements SeckillService { @Override public Seckill getById(long seckillId) { return seckillDao.queryById(seckillId); } @Override List<Seckill> getSeckillList(); @Override Seckill getById(long seckillId); @Override Exposer exportSeckillUrl(long seckillId); @Transactional(rollbackFor = Exception.cla... | SeckillServiceImpl implements SeckillService { @Override public Seckill getById(long seckillId) { return seckillDao.queryById(seckillId); } @Override List<Seckill> getSeckillList(); @Override Seckill getById(long seckillId); @Override Exposer exportSeckillUrl(long seckillId); @Transactional(rollbackFor = Exception.cla... |
@Test public void executeSeckillProcedure(){ long seckillId = 1001L; long phone = 13621254121L; Exposer exposer = seckillService.exportSeckillUrl(seckillId); if(exposer.isExposed()){ String md5 = exposer.getMd5(); SeckillExecution execution = seckillService.executeSeckillProcedure(seckillId,phone,md5); logger.info(exec... | @Override public SeckillExecution executeSeckillProcedure(long seckillId, long userPhone, String md5) { if (md5 == null || !md5.equals(getMd5(seckillId))) { return new SeckillExecution(seckillId, SeckillStatEnum.DATA_REWRITE); } Date killTime = new Date(); Map<String, Object> map = new HashMap<>(16); map.put("seckillId... | SeckillServiceImpl implements SeckillService { @Override public SeckillExecution executeSeckillProcedure(long seckillId, long userPhone, String md5) { if (md5 == null || !md5.equals(getMd5(seckillId))) { return new SeckillExecution(seckillId, SeckillStatEnum.DATA_REWRITE); } Date killTime = new Date(); Map<String, Obje... | SeckillServiceImpl implements SeckillService { @Override public SeckillExecution executeSeckillProcedure(long seckillId, long userPhone, String md5) { if (md5 == null || !md5.equals(getMd5(seckillId))) { return new SeckillExecution(seckillId, SeckillStatEnum.DATA_REWRITE); } Date killTime = new Date(); Map<String, Obje... | SeckillServiceImpl implements SeckillService { @Override public SeckillExecution executeSeckillProcedure(long seckillId, long userPhone, String md5) { if (md5 == null || !md5.equals(getMd5(seckillId))) { return new SeckillExecution(seckillId, SeckillStatEnum.DATA_REWRITE); } Date killTime = new Date(); Map<String, Obje... | SeckillServiceImpl implements SeckillService { @Override public SeckillExecution executeSeckillProcedure(long seckillId, long userPhone, String md5) { if (md5 == null || !md5.equals(getMd5(seckillId))) { return new SeckillExecution(seckillId, SeckillStatEnum.DATA_REWRITE); } Date killTime = new Date(); Map<String, Obje... |
@Test public void testSay() { BeanAnnotation bean = super.getBean("beanAnnotation", BeanAnnotation.class); bean.say("This is test."); bean = super.getBean("beanAnnotation", BeanAnnotation.class); bean.say("This is test."); } | public void say(String arg) { System.out.println("BeanAnnotation : " + arg); } | BeanAnnotation { public void say(String arg) { System.out.println("BeanAnnotation : " + arg); } } | BeanAnnotation { public void say(String arg) { System.out.println("BeanAnnotation : " + arg); } } | BeanAnnotation { public void say(String arg) { System.out.println("BeanAnnotation : " + arg); } void say(String arg); } | BeanAnnotation { public void say(String arg) { System.out.println("BeanAnnotation : " + arg); } void say(String arg); } |
@Test public void set() throws Exception { MultiValueMap<String, String> params = new LinkedMultiValueMap<>(16); params.add("users[0].name", "Tome"); String response = mockMvc.perform(get("/set") .contentType(APPLICATION_JSON_UTF8) .params(params)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAsSt... | @RequestMapping(value = "set") public String set(UserSetForm userSetForm) { return userSetForm.toString(); } | BindController { @RequestMapping(value = "set") public String set(UserSetForm userSetForm) { return userSetForm.toString(); } } | BindController { @RequestMapping(value = "set") public String set(UserSetForm userSetForm) { return userSetForm.toString(); } } | BindController { @RequestMapping(value = "set") public String set(UserSetForm userSetForm) { return userSetForm.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapping(value = "/array") String... | BindController { @RequestMapping(value = "set") public String set(UserSetForm userSetForm) { return userSetForm.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapping(value = "/array") String... |
@Test public void testScpoe() { BeanAnnotation bean = super.getBean("beanAnnotation", BeanAnnotation.class); bean.myHashCode(); bean = super.getBean("beanAnnotation", BeanAnnotation.class); bean.myHashCode(); } | void myHashCode() { System.out.println("BeanAnnotation : " + this.hashCode()); } | BeanAnnotation { void myHashCode() { System.out.println("BeanAnnotation : " + this.hashCode()); } } | BeanAnnotation { void myHashCode() { System.out.println("BeanAnnotation : " + this.hashCode()); } } | BeanAnnotation { void myHashCode() { System.out.println("BeanAnnotation : " + this.hashCode()); } void say(String arg); } | BeanAnnotation { void myHashCode() { System.out.println("BeanAnnotation : " + this.hashCode()); } void say(String arg); } |
@Test public void testSay() { BeanScope beanScope = super.getBean("beanScope", BeanScope.class); beanScope.say(); BeanScope beanScope2 = super.getBean("beanScope", BeanScope.class); beanScope2.say(); } | public void say() { System.out.println("BeanScope say : " + this.hashCode()); } | BeanScope { public void say() { System.out.println("BeanScope say : " + this.hashCode()); } } | BeanScope { public void say() { System.out.println("BeanScope say : " + this.hashCode()); } } | BeanScope { public void say() { System.out.println("BeanScope say : " + this.hashCode()); } void say(); } | BeanScope { public void say() { System.out.println("BeanScope say : " + this.hashCode()); } void say(); } |
@Test public void testSay2() { BeanScope beanScope = super.getBean("beanScopeSingleton", BeanScope.class); beanScope.say(); BeanScope beanScope2 = super.getBean("beanScopeSingleton", BeanScope.class); beanScope2.say(); } | public void say() { System.out.println("BeanScope say : " + this.hashCode()); } | BeanScope { public void say() { System.out.println("BeanScope say : " + this.hashCode()); } } | BeanScope { public void say() { System.out.println("BeanScope say : " + this.hashCode()); } } | BeanScope { public void say() { System.out.println("BeanScope say : " + this.hashCode()); } void say(); } | BeanScope { public void say() { System.out.println("BeanScope say : " + this.hashCode()); } void say(); } |
@Test public void testGetSessionId() throws InterruptedException { Long sessionId1 = sessionManager.getSessionId(); Thread.sleep(1000); Long sessionId2 = sessionManager.getSessionId(); assertNotEquals(sessionId1.longValue(), sessionId2.longValue()); } | public Long getSessionId() { return sessionIdProvider.get(); } | SessionManager { public Long getSessionId() { return sessionIdProvider.get(); } } | SessionManager { public Long getSessionId() { return sessionIdProvider.get(); } @Inject SessionManager(@SessionId Provider<Long> sessionIdProvider); } | SessionManager { public Long getSessionId() { return sessionIdProvider.get(); } @Inject SessionManager(@SessionId Provider<Long> sessionIdProvider); Long getSessionId(); } | SessionManager { public Long getSessionId() { return sessionIdProvider.get(); } @Inject SessionManager(@SessionId Provider<Long> sessionIdProvider); Long getSessionId(); } |
@Test public void testSend1() { Order order = new Order(); order.setId("201809062009010001"); order.setName("测试订单1"); order.setMessageId(System.currentTimeMillis() + "$" + UUID.randomUUID().toString().replaceAll("-", "")); this.orderSender.send(order); } | public void send(Order order) { CorrelationData correlationData = new CorrelationData(); correlationData.setId(order.getMessageId()); this.rabbitTemplate.convertAndSend("order-exchange", "order.a", order, correlationData); } | OrderSender { public void send(Order order) { CorrelationData correlationData = new CorrelationData(); correlationData.setId(order.getMessageId()); this.rabbitTemplate.convertAndSend("order-exchange", "order.a", order, correlationData); } } | OrderSender { public void send(Order order) { CorrelationData correlationData = new CorrelationData(); correlationData.setId(order.getMessageId()); this.rabbitTemplate.convertAndSend("order-exchange", "order.a", order, correlationData); } @Autowired OrderSender(
RabbitTemplate rabbitTemplate); } | OrderSender { public void send(Order order) { CorrelationData correlationData = new CorrelationData(); correlationData.setId(order.getMessageId()); this.rabbitTemplate.convertAndSend("order-exchange", "order.a", order, correlationData); } @Autowired OrderSender(
RabbitTemplate rabbitTemplate); void send(Or... | OrderSender { public void send(Order order) { CorrelationData correlationData = new CorrelationData(); correlationData.setId(order.getMessageId()); this.rabbitTemplate.convertAndSend("order-exchange", "order.a", order, correlationData); } @Autowired OrderSender(
RabbitTemplate rabbitTemplate); void send(Or... |
@Test public void map() throws Exception { MultiValueMap<String, String> params = new LinkedMultiValueMap<>(16); params.add("users['x'].name", "Tom"); params.add("users['y'].age", "1"); params.add("users['y'].name", "Lucy"); String response = mockMvc.perform(get("/map") .contentType(APPLICATION_JSON_UTF8) .params(param... | @RequestMapping(value = "map") public String map(UserMapForm userMapForm) { return userMapForm.toString(); } | BindController { @RequestMapping(value = "map") public String map(UserMapForm userMapForm) { return userMapForm.toString(); } } | BindController { @RequestMapping(value = "map") public String map(UserMapForm userMapForm) { return userMapForm.toString(); } } | BindController { @RequestMapping(value = "map") public String map(UserMapForm userMapForm) { return userMapForm.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapping(value = "/array") String... | BindController { @RequestMapping(value = "map") public String map(UserMapForm userMapForm) { return userMapForm.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapping(value = "/array") String... |
@Test public void json() throws Exception { User user = new User(); user.setName("Jim"); user.setAge(16); ContactInfo contactInfo = new ContactInfo(); contactInfo.setAddress("beijing"); contactInfo.setPhone("10010"); user.setContactInfo(contactInfo); String request = super.objectMapper.writeValueAsString(user); System.... | @RequestMapping(value = "json") public String json(@RequestBody User user) { return user.toString(); } | BindController { @RequestMapping(value = "json") public String json(@RequestBody User user) { return user.toString(); } } | BindController { @RequestMapping(value = "json") public String json(@RequestBody User user) { return user.toString(); } } | BindController { @RequestMapping(value = "json") public String json(@RequestBody User user) { return user.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapping(value = "/array") String array... | BindController { @RequestMapping(value = "json") public String json(@RequestBody User user) { return user.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapping(value = "/array") String array... |
@Test public void xml() throws Exception { String request = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><admin><name>Jim</name><age>18</age></admin>"; String response = mockMvc.perform(post("/xml") .contentType(APPLICATION_XML_VALUE) .content(request)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContent... | @RequestMapping(value = "xml", consumes = MediaType.APPLICATION_XML_VALUE, produces = MediaType.APPLICATION_XML_VALUE) public String xml(@RequestBody Admin admin) { return admin.toString(); } | BindController { @RequestMapping(value = "xml", consumes = MediaType.APPLICATION_XML_VALUE, produces = MediaType.APPLICATION_XML_VALUE) public String xml(@RequestBody Admin admin) { return admin.toString(); } } | BindController { @RequestMapping(value = "xml", consumes = MediaType.APPLICATION_XML_VALUE, produces = MediaType.APPLICATION_XML_VALUE) public String xml(@RequestBody Admin admin) { return admin.toString(); } } | BindController { @RequestMapping(value = "xml", consumes = MediaType.APPLICATION_XML_VALUE, produces = MediaType.APPLICATION_XML_VALUE) public String xml(@RequestBody Admin admin) { return admin.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/... | BindController { @RequestMapping(value = "xml", consumes = MediaType.APPLICATION_XML_VALUE, produces = MediaType.APPLICATION_XML_VALUE) public String xml(@RequestBody Admin admin) { return admin.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/... |
@Test public void date1() throws Exception { MultiValueMap<String, String> params = new LinkedMultiValueMap<>(16); params.add("date1", "2020-03-14"); String response = mockMvc.perform(get("/date1") .contentType(APPLICATION_JSON_UTF8) .params(params)) .andExpect(status().isOk()) .andReturn() .getResponse() .getContentAs... | @RequestMapping(value = "date1") public String date1(Date date1) { return date1.toString(); } | BindController { @RequestMapping(value = "date1") public String date1(Date date1) { return date1.toString(); } } | BindController { @RequestMapping(value = "date1") public String date1(Date date1) { return date1.toString(); } } | BindController { @RequestMapping(value = "date1") public String date1(Date date1) { return date1.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapping(value = "/array") String array(String[]... | BindController { @RequestMapping(value = "date1") public String date1(Date date1) { return date1.toString(); } @RequestMapping(value = "/baseType") String baseType(@RequestParam("age") int age); @RequestMapping(value = "/baseType2") String baseType2(Integer age); @RequestMapping(value = "/array") String array(String[]... |
@Test public void givenAStartedIntegerAnimation_whenWeReverseDirectionPastAPageBoundary_thenTheFractionValueIsCorrect() { integerAnimator.onPageScrolled(1, 0f, 0); integerAnimator.onPageScrolled(1, 0.1f, 10); integerAnimator.onPageScrolled(0, 0.9f, 90); assertThat(integerProperty.get()).isEqualTo(90); } | @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixels == 0) { endAnimation(position); } if (positionOffsetPixels >... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... |
@Test public void givenAnIdleIntegerAnimation_whenWeDragTheViewPager_thenTheAnimationStarts() { integerAnimator.onPageScrolled(1, 0f, 0); integerAnimator.onPageScrolled(0, 0.9f, 90); assertThat(integerProperty.get()).isEqualTo(90); } | @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixels == 0) { endAnimation(position); } if (positionOffsetPixels >... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... |
@Test public void givenAnInitialisedIntegerAnimation_whenDestroyIt_thenItIsDetachedFromTheViewPager() { integerAnimator.destroy(); verify(integerViewPager, times(1)).removeOnPageChangeListener(eq(integerAnimator)); } | public void destroy() { viewPager.removeOnPageChangeListener(this); } | ViewPagerAnimator implements ViewPager.OnPageChangeListener { public void destroy() { viewPager.removeOnPageChangeListener(this); } } | ViewPagerAnimator implements ViewPager.OnPageChangeListener { public void destroy() { viewPager.removeOnPageChangeListener(this); } ViewPagerAnimator(@NonNull ViewPager viewPager,
@NonNull Provider<V> provider,
@NonNull Property<V> property,
... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { public void destroy() { viewPager.removeOnPageChangeListener(this); } ViewPagerAnimator(@NonNull ViewPager viewPager,
@NonNull Provider<V> provider,
@NonNull Property<V> property,
... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { public void destroy() { viewPager.removeOnPageChangeListener(this); } ViewPagerAnimator(@NonNull ViewPager viewPager,
@NonNull Provider<V> provider,
@NonNull Property<V> property,
... |
@Test public void givenANewlyCreatedIntegerAnimation_whenItIsInitialised_thenThePageIsSet() { integerAnimator.onPageScrolled(0, 0f, 0); verify(integerProperty, times(1)).set(eq(0)); } | @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixels == 0) { endAnimation(position); } if (positionOffsetPixels >... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... |
@Test public void givenAStartedFloatAnimation_whenWeReverseDirectionPastAPageBoundary_thenTheFractionValueIsCorrect() { numberAnimator.onPageScrolled(1, 0f, 0); numberAnimator.onPageScrolled(1, 0.1f, 10); numberAnimator.onPageScrolled(0, 0.9f, 90); assertThat(numberProperty.get()).isEqualTo(0.9f); } | @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixels == 0) { endAnimation(position); } if (positionOffsetPixels >... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... |
@Test public void givenAStartedArgbAnimation_whenWeReverseDirectionPastAPageBoundary_thenTheFractionValueIsCorrect() { argbAnimator.onPageScrolled(1, 0f, 0); argbAnimator.onPageScrolled(1, 0.1f, 10); argbAnimator.onPageScrolled(0, 0.9f, 90); assertThat(argbProperty.get()).isEqualTo(0xFF1AE500); } | @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixels == 0) { endAnimation(position); } if (positionOffsetPixels >... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... | ViewPagerAnimator implements ViewPager.OnPageChangeListener { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0 && positionOffsetPixels == 0 && !isAnimating()) { onPageSelected(0); } if (isAnimating() && lastPosition != position || positionOffsetPixel... |
@Test public void request(){ BitcoinCurse currentCurse = provider.getCurrentCurse(); assertNotNull(currentCurse.getDate()); assertNotNull(currentCurse.getCoin()); assertNotNull(currentCurse.getEuro()); BitcoinCurse currentCurse2 = provider.getCurrentCurse(); assertSame(currentCurse, currentCurse2); } | @Override public BitcoinCurse getCurrentCurse() { if(lastCurse == null || ttlIsOver()) { try { lastCurse = requestBitcoinCurse(); } catch (IOException e) { log.error("Error while request bitcoin!", e); lastCurse = new BitcoinCurse(DateTime.now().minusDays(1), null, null); } lastCall = DateTime.now(); } return lastCurse... | RestCurseProvider implements BitcoinCurseProvider { @Override public BitcoinCurse getCurrentCurse() { if(lastCurse == null || ttlIsOver()) { try { lastCurse = requestBitcoinCurse(); } catch (IOException e) { log.error("Error while request bitcoin!", e); lastCurse = new BitcoinCurse(DateTime.now().minusDays(1), null, nu... | RestCurseProvider implements BitcoinCurseProvider { @Override public BitcoinCurse getCurrentCurse() { if(lastCurse == null || ttlIsOver()) { try { lastCurse = requestBitcoinCurse(); } catch (IOException e) { log.error("Error while request bitcoin!", e); lastCurse = new BitcoinCurse(DateTime.now().minusDays(1), null, nu... | RestCurseProvider implements BitcoinCurseProvider { @Override public BitcoinCurse getCurrentCurse() { if(lastCurse == null || ttlIsOver()) { try { lastCurse = requestBitcoinCurse(); } catch (IOException e) { log.error("Error while request bitcoin!", e); lastCurse = new BitcoinCurse(DateTime.now().minusDays(1), null, nu... | RestCurseProvider implements BitcoinCurseProvider { @Override public BitcoinCurse getCurrentCurse() { if(lastCurse == null || ttlIsOver()) { try { lastCurse = requestBitcoinCurse(); } catch (IOException e) { log.error("Error while request bitcoin!", e); lastCurse = new BitcoinCurse(DateTime.now().minusDays(1), null, nu... |
@Test public void speechError(){ CalendarReadException e = new CalendarReadException("error"); final PlainTextOutputSpeech result = (PlainTextOutputSpeech)toTest.speechError(e); assertEquals("Es tut mir leid. Ich konnte die Termine nicht auslesen.", result.getText()); } | public OutputSpeech speechError(Throwable t) { final String speechText; if (t instanceof AlexaExcpetion) { speechText = messageService.de(((AlexaExcpetion)t).getMessageKey()); } else { speechText = messageService.de("event.error"); } return speechMessage(speechText); } | SpeechService { public OutputSpeech speechError(Throwable t) { final String speechText; if (t instanceof AlexaExcpetion) { speechText = messageService.de(((AlexaExcpetion)t).getMessageKey()); } else { speechText = messageService.de("event.error"); } return speechMessage(speechText); } } | SpeechService { public OutputSpeech speechError(Throwable t) { final String speechText; if (t instanceof AlexaExcpetion) { speechText = messageService.de(((AlexaExcpetion)t).getMessageKey()); } else { speechText = messageService.de("event.error"); } return speechMessage(speechText); } } | SpeechService { public OutputSpeech speechError(Throwable t) { final String speechText; if (t instanceof AlexaExcpetion) { speechText = messageService.de(((AlexaExcpetion)t).getMessageKey()); } else { speechText = messageService.de("event.error"); } return speechMessage(speechText); } OutputSpeech speechWelcomeMessage... | SpeechService { public OutputSpeech speechError(Throwable t) { final String speechText; if (t instanceof AlexaExcpetion) { speechText = messageService.de(((AlexaExcpetion)t).getMessageKey()); } else { speechText = messageService.de("event.error"); } return speechMessage(speechText); } OutputSpeech speechWelcomeMessage... |
@Test public void readEvents_empty(){ List<Event> events = Collections.emptyList(); final String moment = "heute"; final PlainTextOutputSpeech result = (PlainTextOutputSpeech)toTest.readEvents(aLocale, moment, events); assertEquals("Es stehen " + moment + " keine Termine an.", result.getText()); } | public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... |
@Test public void readEvents_singleEventTodayNoTime() { Event event = new Event(); event.setStart(DateTime.now(), false); event.setSummary("<summary>"); List<Event> events = Arrays.asList(event); final String moment = "heute"; final SsmlOutputSpeech result = (SsmlOutputSpeech)toTest.readEvents(aLocale, moment, events);... | public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... |
@Test public void readEvents_singleEventTodayIncludesTime() { final DateTime start = DateTime.now(); final Event event = new Event(); event.setStart(start, true); event.setSummary("<summary>"); final List<Event> events = Arrays.asList(event); final String moment = "heute"; final SsmlOutputSpeech result = (SsmlOutputSpe... | public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... |
@Test public void readEvents_singleEventTodayDuration() { final DateTime start = DateTime.now(); final DateTime end = start.plusHours(1).plusMinutes(1); final Event event = new Event(); event.setStart(start, true); event.setEnd(end, true); event.setSummary("<summary>"); final List<Event> events = Arrays.asList(event); ... | public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... |
@Test public void readEvents_singleEventTomorrowNoTime() { Event event = new Event(); event.setStart(DateTime.now().plusDays(1), false); event.setSummary("<summary>"); List<Event> events = Arrays.asList(event); final String moment = "morgen"; final SsmlOutputSpeech result = (SsmlOutputSpeech)toTest.readEvents(aLocale, ... | public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... |
@Test public void readEvents_singleEventTomorrowIncludesTime() { final DateTime start = DateTime.now().plusDays(1); final Event event = new Event(); event.setStart(start, true); event.setSummary("<summary>"); final List<Event> events = Arrays.asList(event); final String moment = "morgen"; final SsmlOutputSpeech result ... | public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... |
@Test public void readEvents_singleEventTomorrowDuration() { final DateTime start = DateTime.now().plusDays(1); final DateTime end = start.plusHours(1).plusMinutes(1); final Event event = new Event(); event.setStart(start, true); event.setEnd(end, true); event.setSummary("<summary>"); final List<Event> events = Arrays.... | public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... |
@Test public void readEvents_singleEventNextWeekNoTime() { final DateTime start = DateTime.now().plusWeeks(1); final Event event = new Event(); event.setStart(start, false); event.setSummary("<summary>"); List<Event> events = Arrays.asList(event); final String moment = "morgen"; final SsmlOutputSpeech result = (SsmlOut... | public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... |
@Test public void readEvents_singleEventNextWeekIncludesTime() { final DateTime start = DateTime.now().plusWeeks(1); final Event event = new Event(); event.setStart(start, true); event.setSummary("<summary>"); final List<Event> events = Arrays.asList(event); final String moment = "morgen"; final SsmlOutputSpeech result... | public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... |
@Test(expected = IllegalArgumentException.class) public void argumentsNotEnough() throws NoSuchMethodException { TestClass toTest = new TestClass(); Method method = TestClass.class.getMethod("integer", Integer.class); ReflectionUtils.call(method, toTest); } | public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } } | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } static Object call(Method... | ReflectionUtils { public static Object call(Method method, Object target, Argument...arguments) { checkArguments(method, arguments); Object[] methodArguments = collectArguments(method, arguments); return org.springframework.util.ReflectionUtils.invokeMethod(method, target, methodArguments); } static Object call(Method... |
@Test public void readEvents_singleEventNextWeekDuration() { final DateTime start = DateTime.now().plusWeeks(1); final DateTime end = start.plusHours(1).plusMinutes(1); final Event event = new Event(); event.setStart(start, true); event.setEnd(end, true); event.setSummary("<summary>"); final List<Event> events = Arrays... | public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } } | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... | SpeechService { public OutputSpeech readEvents(Locale locale, List<Event> events) { return readEvents(locale, "", events); } OutputSpeech speechWelcomeMessage(Locale locale); OutputSpeech speechBye(Locale locale); OutputSpeech speechHelpMessage(Locale locale); OutputSpeech speechGeneralConfirmation(Locale locale); Out... |
@Test public void confirmNewEvent_sameDay() { final String title = "hello world"; final DateTime from = DateTime.parse("2010-08-13T20:15"); final DateTime to = from.plusHours(1); final SsmlOutputSpeech result = (SsmlOutputSpeech)toTest.confirmNewEvent(title, from, to, aLocale); assertEquals(String.format("<speak>Kann i... | public OutputSpeech confirmNewEvent(String title, DateTime from, DateTime to, Locale locale) { final String speechText; if(from.getYear() == to.getYear() && from.getDayOfYear() == to.getDayOfYear()) { speechText = messageService.de("event.new.confirm.sameday", from.toString(DAY_FORMAT, locale), from.toString(DATE_YEAR_... | SpeechService { public OutputSpeech confirmNewEvent(String title, DateTime from, DateTime to, Locale locale) { final String speechText; if(from.getYear() == to.getYear() && from.getDayOfYear() == to.getDayOfYear()) { speechText = messageService.de("event.new.confirm.sameday", from.toString(DAY_FORMAT, locale), from.toS... | SpeechService { public OutputSpeech confirmNewEvent(String title, DateTime from, DateTime to, Locale locale) { final String speechText; if(from.getYear() == to.getYear() && from.getDayOfYear() == to.getDayOfYear()) { speechText = messageService.de("event.new.confirm.sameday", from.toString(DAY_FORMAT, locale), from.toS... | SpeechService { public OutputSpeech confirmNewEvent(String title, DateTime from, DateTime to, Locale locale) { final String speechText; if(from.getYear() == to.getYear() && from.getDayOfYear() == to.getDayOfYear()) { speechText = messageService.de("event.new.confirm.sameday", from.toString(DAY_FORMAT, locale), from.toS... | SpeechService { public OutputSpeech confirmNewEvent(String title, DateTime from, DateTime to, Locale locale) { final String speechText; if(from.getYear() == to.getYear() && from.getDayOfYear() == to.getDayOfYear()) { speechText = messageService.de("event.new.confirm.sameday", from.toString(DAY_FORMAT, locale), from.toS... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.